5 if test ! -d $PKGDIR_REL; then
6 abort
1 "Cannot find $PKGDIR_REL. Did you run ./new-package.sh before?"
9 if test ! -f "$PKGDIR_REL/debian/changelog"; then
10 abort
1 "Cannot find $PKGDIR_REL/debian/changelog. Did you run ./new-package.sh before?"
13 if git
grep --quiet FIXME
-- "$PKGDIR_REL" :^
"$PKGDIR_REL/debian/*.debcargo.hint" :^
"$PKGDIR_REL/debian/changelog"; then
14 abort
1 "FIXMEs remain in $PKGDIR_REL, fix and commit those first."
17 git
diff --quiet --cached || \
18 abort
1 "You have other pending changes to git, please complete it or stash it away and re-run this script."
20 git
diff --quiet -- "$PKGDIR_REL" || \
21 abort
1 "Please git-add your changes to $PKGDIR_REL before running"
23 type dch
>/dev
/null || \
24 abort
1 "Install devscripts, we need to run dch."
26 RELBRANCH
="pending-$PKGNAME"
27 git fetch origin
--prune
29 git merge-base
--is-ancestor origin
/master HEAD || \
30 abort
1 "You are not synced with origin/master, please do so before running this script."
32 if [ "$RERELEASE" = 1 -o "$NOUPDATE" = 1 ]; then
33 REALVER
="$(get_existing_version "$PKGDIR")"
36 if head -n1 "$PKGDIR/debian/changelog" |
grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
; then
37 if [ "$RERELEASE" = 1 ]; then
39 ( cd "$PKGDIR" && dch
-a "No-op source-only re-upload for Debian Testing Migration." )
40 export REUSE_EXISTING_ORIG_TARBALL
=1
43 "Package already released. If you want to do a source-only re-upload e.g. to" \
44 "hoop-jump through the Debian Testing migration requirements, set RERELEASE=1."
48 if [ -e "$PKGDIR/debian/BLOCK" ]; then
49 abort
1 "TODO items remain in $PKGDIR/debian/BLOCK, please deal with those"
52 PREVBRANCH
="$(git rev-parse --abbrev-ref HEAD)"
54 pending-
$PKGNAME) true
;;
55 pending-
*) abort
1 "You are on a pending-release branch for a package other than $PKGNAME, $0 can only be run on another branch, like master";;
56 *) if git rev-parse
-q --verify "refs/heads/$RELBRANCH" >/dev
/null || \
57 git rev-parse
-q --verify "refs/remotes/origin/$RELBRANCH" >/dev
/null
; then
58 git checkout
"$RELBRANCH"
60 git checkout
-b "$RELBRANCH"
64 if head -n1 "$PKGDIR/debian/changelog" |
grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
; then
65 git checkout
"$PREVBRANCH"
66 abort
0 "Package already released on branch $RELBRANCH. If that was a mistake then run:" \
67 " git branch -D $RELBRANCH" \
68 "And re-run this script ($0 $*). You might have to delete the remote branch too:" \
69 " git push --delete origin $RELBRANCH"
73 sed -i -e s
/UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
/UNRELEASED
/ debian
/changelog
74 if test -z "$DISTRO"; then
75 # To upload to other distro like experimental
78 dch
-m -r -D $DISTRO ""
79 git add debian
/changelog
80 git
rm --ignore-unmatch debian
/RFS
83 revert_git_changes
() {
85 git checkout
-- "$PKGDIR/debian/changelog"
86 git checkout
-q -- "$PKGDIR/debian/RFS" || true
87 git checkout
"$PREVBRANCH"
88 git branch
-d "$RELBRANCH"
91 if ! run_debcargo
--changelog-ready; then
93 abort
1 "Release attempt failed to run debcargo, probably the package needs updating (./update.sh $*)"
96 # sometimes the copyright years need to be updated, try to do this automatically
97 if git
diff -- "$PKGDIR_REL/debian/copyright.debcargo.hint" |
patch -r - --no-backup-if-mismatch "$PKGDIR_REL/debian/copyright"; then
98 git add
"$PKGDIR_REL/debian/copyright.debcargo.hint" "$PKGDIR_REL/debian/copyright"
100 git
diff -- "$PKGDIR_REL/debian/copyright.debcargo.hint"
103 "copyright file needs updating; apply the above diff to $PKGDIR_REL/debian/copyright" \
104 "then commit your changes, and run me again."
107 if ! git
diff --exit-code -- "$PKGDIR_REL"; then
110 "Release attempt resulted in git diffs to $PKGDIR_REL, probably you need to update the package (./update.sh $*)." \
111 "Alternatively, set NOUPDATE=1 to override this requirement, but please have a good reason."
114 if ! ( cd build
&& SOURCEONLY
=1 .
/build.sh
"$CRATE" $VER ); then
116 abort
1 "Release attempt failed (see messages above), possible reasons are: " \
117 "- build-dependencies not in Debian => release those first." \
118 "- packaged version is out-of-date => run \`./update.sh $*\`"
121 git commit
-m "Release package $PKGNAME"
123 DEBVER
=$
(dpkg-parsechangelog
-l $BUILDDIR/debian
/changelog
-SVersion)
124 DEBSRC
=$
(dpkg-parsechangelog
-l $BUILDDIR/debian
/changelog
-SSource)
125 DEB_HOST_ARCH
=$
(dpkg-architecture
-q DEB_HOST_ARCH
)
127 if [ "$RERELEASE" = 1 ]; then
129 ( cd build
&& dput
"${DEBSRC}_${DEBVER}_source.changes" )
130 git push origin
"$RELBRANCH"
134 Source-only re-release of $CRATE uploaded. You need to perform the following steps:
141 Release of $CRATE ready as a source package in ${BUILDDIR#$PWD/}. You need to
142 perform the following steps:
144 Build the package if necessary, and upload
145 ==========================================
147 If the source package is already in Debian and this version does not introduce
148 new binaries, then you can just go ahead and directly dput the source package.
150 cd build && dput ${DEBSRC}_${DEBVER}_source.changes
152 For your reference, this source package builds $(grep ^Package build/${CRATE//_/-}/debian/control | wc -l) binary package(s):
153 $(sed -ne 's/^Package: //pg' build/hmac/debian/control | tr '\n' ',')
155 If this is a NEW source package or introduces NEW binary packages not already
156 in the Debian archive, you will need to build a binary package out of it. The
157 recommended way is to run something like:
159 cd build && ./build.sh $CRATE $VER && dput ${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}.changes
161 This assumes you followed the "Build environment" instructions in README.rst,
162 for setting up a build environment for release.
164 If the build fails e.g. due to missing Build-Dependencies you should revert
165 what I did (see below) and package those missing Build-Dependencies first.
167 Push this pending-release branch
168 ================================
170 After you have uploaded the package with dput(1), you should push $RELBRANCH so
171 that other people see it's been uploaded. Then, checkout another branch like
172 master to continue development on other packages.
174 git push origin $RELBRANCH && git checkout master
181 Merge the pending-release branch if/when ACCEPTED
182 =================================================
184 When it's ACCEPTED by the Debian FTP masters, you may then merge this branch
185 back into the master branch, delete it, and push these updates to origin.
187 git checkout master && git merge $RELBRANCH && git branch -d $RELBRANCH
188 git push origin master :$RELBRANCH
190 Delete this branch without merging if/when REJECTED
191 ===================================================
193 If your upload is REJECTED, or if you cannot perform an upload in the first
194 place e.g. because you are not a Debian Developer, you should revert what I
195 just did. To do that, run:
197 git checkout master && git branch -D $RELBRANCH
199 Then ask a Debian Developer to re-run me ($0 $*) on your behalf. Also, touch
200 and commit ${PKGDIR_REL}/debian/RFS so we can track these easier.