5 git
diff --quiet --cached || \
6 abort
1 "You have other pending changes to git, please complete it or stash it away and re-run this script."
8 git
diff --quiet -- "$PKGDIR_REL" || \
9 abort
1 "Please git-add your changes to $PKGDIR_REL before running"
11 RELBRANCH
="pending-$PKGNAME"
12 git fetch origin
--prune
14 if head -n1 "$PKGDIR/debian/changelog" |
grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
; then
15 abort
0 "Package already released."
18 PREVBRANCH
="$(git rev-parse --abbrev-ref HEAD)"
20 pending-
$PKGNAME) true
;;
21 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";;
22 *) if git rev-parse
-q --verify "refs/heads/$RELBRANCH" >/dev
/null || \
23 git rev-parse
-q --verify "refs/remotes/origin/$RELBRANCH" >/dev
/null
; then
24 git checkout
"$RELBRANCH"
26 git checkout
-b "$RELBRANCH"
30 if head -n1 "$PKGDIR/debian/changelog" |
grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
; then
31 git checkout
"$PREVBRANCH"
32 abort
0 "Package already released on branch $RELBRANCH. If that was a mistake then run \`git branch -D $RELBRANCH\`, and re-run this script ($0 $*)"
36 sed -i -e s
/UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
/UNRELEASED
/ debian
/changelog
38 git add debian
/changelog
41 rm -rf "$BUILDDIR" "$(dirname "$BUILDDIR")/rust-${PKGNAME}_$VER"*.orig.
tar.
*
42 $DEBCARGO package
--config "$PKGCFG" --directory "$BUILDDIR" --changelog-ready "$CRATE" "$VER"
44 git
diff --exit-code -- "$PKGDIR_REL" || \
45 abort
1 "Release attempt resulted in git diffs to $PKGDIR_REL. Check it, git add or reset as appropriate, and re-run this again."
47 git commit
-m "Release package $PKGNAME"
49 ( cd "$BUILDDIR" && dpkg-buildpackage
-d -S --no-sign )
51 cat >"$BUILDDIR/../sbuild-and-sign.sh" <<'eof'
55 if [ -n "$DEBCARGO" ]; then
57 elif which debcargo >/dev/null; then
58 DEBCARGO=$(which debcargo)
59 elif [ -f "$HOME/.cargo/bin/debcargo" ]; then
60 DEBCARGO="$HOME/.cargo/bin/debcargo"
62 abort 1 "debcargo not found, run \`cargo install debcargo\` or set DEBCARGO to point to it"
67 DISTRIBUTION="${DISTRIBUTION:-unstable}"
69 PKGNAME=$($DEBCARGO deb-src-name "$CRATE" $VER || abort 1 "couldn't find crate $CRATE")
70 DEBVER=$(dpkg-parsechangelog -l $PKGNAME/debian/changelog -SVersion)
71 DEBSRC=$(dpkg-parsechangelog -l $PKGNAME/debian/changelog -SSource)
72 DEB_HOST_ARCH=$(dpkg-architecture -q DEB_HOST_ARCH)
74 sbuild --no-source --arch-any --arch-all ${CHROOT:+-c $CHROOT }${DISTRIBUTION:+-d $DISTRIBUTION }${DEBSRC}_${DEBVER}.dsc
75 changestool ${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}.changes adddsc ${DEBSRC}_${DEBVER}.dsc
76 debsign ${DEBSIGN_KEYID:+-k $DEBSIGN_KEYID }--no-re-sign ${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}.changes
78 chmod +x
"$BUILDDIR/../sbuild-and-sign.sh"
80 DEBVER
=$
(dpkg-parsechangelog
-l build
/$PKGNAME/debian
/changelog
-SVersion)
81 DEBSRC
=$
(dpkg-parsechangelog
-l build
/$PKGNAME/debian
/changelog
-SSource)
82 DEB_HOST_ARCH
=$
(dpkg-architecture
-q DEB_HOST_ARCH
)
84 Release of $CRATE ready as a source package in ${BUILDDIR#$PWD/}. You need to
85 perform the following steps:
87 Build the package if necessary, and upload
88 ==========================================
90 If the source package is already in Debian and this version does not introduce
91 new binaries, then you can just go ahead and directly dput the source package.
93 dput ${DEBSRC}_${DEBVER}_source.changes
95 If this is a NEW source package or introduces NEW binary packages not already
96 in the Debian archive, you will need to build a binary package out of it. The
97 recommended way is to run something like:
100 ./sbuild-and-sign.sh $CRATE $VER
101 dput ${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}.changes
103 See https://wiki.debian.org/sbuild for instructions on how to set it up. The
104 other tools are from the 'devscripts' package.
106 If the build fails e.g. due to missing Build-Dependencies you should revert
107 what I did (see below) and package those missing Build-Dependencies first.
109 Push this pending-release branch
110 ================================
112 After you have uploaded the package with dput(1), you should push $RELBRANCH so
113 that other people see it's been uploaded. Then, checkout another branch like
114 master to continue development on other packages.
116 git push origin $RELBRANCH && git checkout master
118 Merge the pending-release branch when ACCEPTED
119 ==============================================
121 When it's ACCEPTED by the Debian FTP masters, you may then merge this branch
122 back into the master branch, delete it, and push these updates to origin.
124 git checkout master && git merge $RELBRANCH && git branch -d $RELBRANCH
125 git push origin master :$RELBRANCH
129 The above assumes you are a Debian Developer with upload rights. If not, you
130 should revert what I just did. To do that, run:
132 git checkout master && git branch -D $RELBRANCH
134 Then ask a Debian Developer to re-run me ($0 $*) on your behalf.