6 [ "$ANSWER" = "no" -o "$ANSWER" = n
] && return 1
7 [ "$ANSWER" = "yes" -o "$ANSWER" = y
] && return 0
8 echo "Please answer \"yes\" or \"no\""
19 ### Lets do some sanity checks first
20 for command in bower fedpkg git gulp node npm
22 which $command >/dev
/null
2>&1 || fail_and_bail
"$command not installed"
25 ### Create the directory we'll be working in
26 DIR
=`mktemp -d pcpXXX -p /tmp/`; cd $DIR
28 # We need to differentiate between upstream sources and the later
29 # used distro sources hence the specific checkout to pcp-git
31 git clone git
://git.pcp.io
/pcp.git pcp-git
32 # git clone git@github.com:performancecopilot/pcp pcp-git
35 # We need to use --global for the NAME and USER vars as we're
36 # assuming this script can be run from anywhere (ie, not in an
37 # already existing git repo)
38 DATE
=`date +"%a %b %d %Y"`
39 TAG_DATE
=`date +"%Y%m%d"`
40 NAME
=`git config --get-all user.name`
41 EMAIL
=`git config --get-all user.email`
42 PCP_MAJOR_VERSION
=`grep "^PACKAGE_MAJOR" VERSION.pcp | cut -f2 -d"="`
43 PCP_MINOR_VERSION
=`grep "^PACKAGE_MINOR" VERSION.pcp | cut -f2 -d"="`
44 PCP_REVISION
=`grep "^PACKAGE_REVISION" VERSION.pcp | cut -f2 -d"="`
45 PCP_FULL_VERSION
=`echo $PCP_MAJOR_VERSION.$PCP_MINOR_VERSION.$PCP_REVISION`
46 CHANGELOG_VERSION
=`echo $PCP_FULL_VERSION`
47 GIT_DESCRIBE
=`git describe | rev | cut -f1 -d"g" | rev`
48 PCP_WEB_JS
=`grep "^Source*" build/rpm/fedora.spec | grep "webjs" | cut -f2 -d" " | rev | cut -f1 -d"/" | rev`
49 VECTOR
=`grep "^Source*" build/rpm/fedora.spec | grep "vector" | cut -f2 -d" " | rev | cut -f1 -d"/" | rev`
51 # Checkout the fedora sources pcp
56 GIT_VERSION_TAG
=`echo 0.${TAG_DATE}git${GIT_DESCRIBE}`
58 git
diff pcp.spec ..
/pcp-git
/build
/rpm
/fedora.spec
> ..
/spec-diff
60 if [ -s ..
/spec-diff
]; then
61 CHANGELOG_PRESENT
=`grep \%changelog ../spec-diff`
62 # the space in front of %changelog is because its a diff context line
63 if [ "$CHANGELOG_PRESENT" == " %changelog" ]; then
64 # We don't need to know the difference in spec changelogs
65 # changelogs should only ever grow, make sure we also trim the %changelog
66 # context lines as well
67 sed -i '/\%changelog/,$d' ..
/spec-diff
68 tac ..
/spec-diff |
sed '1,3d' |
tac > spec-diff
69 mv spec-diff ..
/spec-diff
71 # end changelog diff if
73 echo "The above changes will apply to the fedora git tree,"
74 echo -n "would you like to apply the patch? (yes/no): "
77 if [ "$APPLY_DIFF" == 0 ]; then
78 patch -p1 pcp.spec
< ..
/spec-diff
85 git archive
--prefix=pcp-
$CHANGELOG_VERSION/ -o ..
/pcp
/pcp-
$CHANGELOG_VERSION-$GIT_VERSION_TAG.
tar.gz HEAD
87 # if $VECTOR is empty, then we don't need to git archive it separately.
88 if [ ! -z $VECTOR ]; then
90 # git clone git@github.com:netflix/vector.git vector
91 git clone https
://github.com
/Netflix
/vector.git vector
93 ..
/pcp-git
/scripts
/build-vector
94 VECTOR_GIT_DESCRIBE
=`git describe | rev | cut -f1 -d"g" | rev`
95 VECTOR
=`echo vector-${TAG_DATE}git${VECTOR_GIT_DESCRIBE}.tar.gz`
96 cd dist
&& tar czf ..
/..
/pcp
/$VECTOR *
100 # if $PCP_WEB_JS is empty, then we don't need to git archive it separately.
101 if [ ! -z $PCP_WEB_JS ]; then
103 # git clone git@github.com:performancecopilot/pcp-webjs.git pcp-webjs
104 git clone git
://sourceware.org
/git
/pcpfans.git
--branch=webjs pcp-webjs
106 WEB_GIT_DESCRIBE
=`git describe --always | rev | cut -f1 -d"g" | rev`
107 PCP_WEB_JS
=`echo pcp-webjs-${TAG_DATE}git${WEB_GIT_DESCRIBE}.src.tar.gz`
108 git archive
--prefix=pcp-webjs
/ -o ..
/pcp
/$PCP_WEB_JS HEAD
114 sed -i "s/Release:.*/Release: $GIT_VERSION_TAG\%\{\?dist\}/" pcp.spec
115 sed -i "s/^Source0:.*/Source0: %{name}-%{version}-$GIT_VERSION_TAG.tar.gz/" pcp.spec
116 sed -i "s/^Source2:.*/Source2: $PCP_WEB_JS/" pcp.spec
117 sed -i "s/^Source1:.*/Source1: $VECTOR/" pcp.spec
118 sed -i "s/%global buildversion.*/%global buildversion 0/" pcp.spec
119 sed -i "s/^Version:.*/Version: $PCP_FULL_VERSION/" pcp.spec
121 # make note in the comments if any differences from upstream fedora.spec have been merged
122 if [ "$APPLY_DIFF" == 0 ]; then
123 sed -i "s/\%changelog/\%changelog\n* $DATE $NAME <$EMAIL> - $CHANGELOG_VERSION-$GIT_VERSION_TAG\n- Automated weekly rawhide release\n- Applied spec changes from upstream git\n/" pcp.spec
125 sed -i "s/\%changelog/\%changelog\n* $DATE $NAME <$EMAIL> - $CHANGELOG_VERSION-$GIT_VERSION_TAG\n- Automated weekly rawhide release\n/" pcp.spec
128 echo "Please ensure that you have an up to date fedoraproject SSL certificate, you can achieve this by running fedora-cert -n"
130 fedpkg new-sources pcp-
$CHANGELOG_VERSION-$GIT_VERSION_TAG.
tar.gz
$PCP_WEB_JS $VECTOR
132 fedpkg commit
-m "Automated weekly pcp rawhide release: $GIT_VERSION_TAG" -p