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 if head -n1 "$PKGDIR/debian/changelog" |
grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
; then
30 abort
0 "Package already released."
33 PREVBRANCH
="$(git rev-parse --abbrev-ref HEAD)"
35 pending-
$PKGNAME) true
;;
36 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";;
37 *) if git rev-parse
-q --verify "refs/heads/$RELBRANCH" >/dev
/null || \
38 git rev-parse
-q --verify "refs/remotes/origin/$RELBRANCH" >/dev
/null
; then
39 git checkout
"$RELBRANCH"
41 git checkout
-b "$RELBRANCH"
45 if head -n1 "$PKGDIR/debian/changelog" |
grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
; then
46 git checkout
"$PREVBRANCH"
47 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 $*). You might have to delete the remote branch too (\`git push --delete origin $RELBRANCH\`)."
51 sed -i -e s
/UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO
/UNRELEASED
/ debian
/changelog
52 dch
-m -r -D unstable
""
53 git add debian
/changelog
56 revert_git_changes
() {
58 git checkout
-- "$PKGDIR/debian/changelog"
59 git checkout
"$PREVBRANCH"
60 git branch
-d "$RELBRANCH"
63 if ! run_debcargo
--changelog-ready; then
65 abort
1 "Release attempt failed to run debcargo, probably the package needs updating (./update.sh $*)"
68 if ! git
diff --exit-code -- "$PKGDIR_REL"; then
70 abort
1 "Release attempt resulted in git diffs to $PKGDIR_REL, probably the package needs updating (./update.sh $*)"
73 if ! ( cd build
&& SOURCEONLY
=1 .
/build.sh
"$CRATE" $VER ); then
75 abort
1 "Release attempt failed (see messages above), possible reasons are: " \
76 "- build-dependencies not in Debian => release those first." \
77 "- packaged version is out-of-date => run \`./update.sh $*\`"
80 git commit
-m "Release package $PKGNAME"
82 DEBVER
=$
(dpkg-parsechangelog
-l $BUILDDIR/debian
/changelog
-SVersion)
83 DEBSRC
=$
(dpkg-parsechangelog
-l $BUILDDIR/debian
/changelog
-SSource)
84 DEB_HOST_ARCH
=$
(dpkg-architecture
-q DEB_HOST_ARCH
)
86 Release of $CRATE ready as a source package in ${BUILDDIR#$PWD/}. You need to
87 perform the following steps:
89 Build the package if necessary, and upload
90 ==========================================
92 If the source package is already in Debian and this version does not introduce
93 new binaries, then you can just go ahead and directly dput the source package.
95 cd build && dput ${DEBSRC}_${DEBVER}_source.changes
97 If this is a NEW source package or introduces NEW binary packages not already
98 in the Debian archive, you will need to build a binary package out of it. The
99 recommended way is to run something like:
101 cd build && ./build.sh $CRATE $VER && dput ${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}.changes
103 This assumes you followed the "DD instructions" in README.rst, for setting up
104 a build environment for release.
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. Also add your
135 crate to the "Ready for upload" list in TODO.rst so it's easy to track.