release.sh: add a convenience option for doing a no-op source-only upload

This commit is contained in:
Ximin Luo 2020-01-27 22:10:47 +00:00
parent 18699184c5
commit baae6f7cab
4 changed files with 81 additions and 14 deletions

View File

@ -42,6 +42,25 @@ the one in Debian Testing not Debian Unstable. To view a summary of this, run::
It will also give you some follow-up instructions to fix the problem.
Source-only re-upload
=====================
Two aspects of Debian infrastructure policy, run by two different teams,
interact badly when it comes to the Debian Rust Team:
1. Uploads with new binary packages have to be done as binary (not source-only)
uploads, into the FTP team's NEW queue.
2. Uploads that are valid candidates for Debian Testing have to be source-only
uploads, to be considered by the Release team's migration script.
For your convenience, ``./release.sh`` can do these quickly. After a
binary-upload is accepted from the NEW queue, and you merge the relevant
pending branch, do a source-only re-upload by simply running::
RERELEASE=1 ./release.sh <rust-crate-name> [<old-version>]
Remove an obsolete package
==========================

View File

@ -29,8 +29,28 @@ git fetch origin --prune
git merge-base --is-ancestor origin/master HEAD || \
abort 1 "You are not synced with origin/master, please do so before running this script."
if [ "$RERELEASE" = 1 -o "$NOUPDATE" = 1 ]; then
REALVER="$(get_existing_version "$PKGDIR")"
fi
if head -n1 "$PKGDIR/debian/changelog" | grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; then
abort 0 "Package already released."
if [ "$RERELEASE" = 1 ]; then
run_debcargo
( cd "$PKGDIR" && dch -a "No-op source-only re-upload for Debian Testing Migration." )
# sometimes the copyright years need to be updated, try to do this automatically
if git diff -- "$PKGDIR_REL/debian/copyright.debcargo.hint" | patch --no-backup-if-mismatch "$PKGDIR_REL/debian/copyright"; then
git add "$PKGDIR_REL/debian/copyright.debcargo.hint" "$PKGDIR_REL/debian/copyright"
else
git diff -- "$PKGDIR_REL/debian/copyright.debcargo.hint"
abort 1 \
"copyright file needs updating; apply the above diff to $PKGDIR_REL/debian/copyright" \
"then commit your changes, and run me again."
fi
else
abort 0 \
"Package already released. If you want to do a source-only re-upload e.g. to" \
"hoop-jump through the Debian Testing migration requirements, set RERELEASE=1."
fi
fi
if [ -e "$PKGDIR/debian/BLOCK" ]; then
@ -83,7 +103,9 @@ fi
if ! git diff --exit-code -- "$PKGDIR_REL"; then
revert_git_changes
abort 1 "Release attempt resulted in git diffs to $PKGDIR_REL, probably the package needs updating (./update.sh $*)"
abort 1 \
"Release attempt resulted in git diffs to $PKGDIR_REL, probably you need to update the package (./update.sh $*)." \
"Alternatively, set NOUPDATE=1 to override this requirement, but please have a good reason."
fi
if ! ( cd build && SOURCEONLY=1 ./build.sh "$CRATE" $VER ); then
@ -98,10 +120,20 @@ git commit -m "Release package $PKGNAME"
DEBVER=$(dpkg-parsechangelog -l $BUILDDIR/debian/changelog -SVersion)
DEBSRC=$(dpkg-parsechangelog -l $BUILDDIR/debian/changelog -SSource)
DEB_HOST_ARCH=$(dpkg-architecture -q DEB_HOST_ARCH)
cat >&2 <<eof
Release of $CRATE ready as a source package in ${BUILDDIR#$PWD/}. You need to
perform the following steps:
print_upload_instructions() {
if [ "$RERELEASE" = 1 ]; then
cat <<eof
Upload the source package
=========================
Since you set RERELEASE=1, this package is presumably already in Debian. Go
ahead and directly dput the source package.
cd build && dput ${DEBSRC}_${DEBVER}_source.changes
eof
else
cat <<eof
Build the package if necessary, and upload
==========================================
@ -110,7 +142,8 @@ new binaries, then you can just go ahead and directly dput the source package.
cd build && dput ${DEBSRC}_${DEBVER}_source.changes
For your reference, this source package builds $(grep ^Package build/${CRATE//_/-}/debian/control | wc -l) binary package(s).
For your reference, this source package builds $(grep ^Package build/${CRATE//_/-}/debian/control | wc -l) binary package(s):
$(sed -ne 's/^Package: //pg' build/hmac/debian/control | tr '\n' ',')
If this is a NEW source package or introduces NEW binary packages not already
in the Debian archive, you will need to build a binary package out of it. The
@ -123,6 +156,15 @@ for setting up a build environment for release.
If the build fails e.g. due to missing Build-Dependencies you should revert
what I did (see below) and package those missing Build-Dependencies first.
eof
fi
}
cat >&2 <<eof
Release of $CRATE ready as a source package in ${BUILDDIR#$PWD/}. You need to
perform the following steps:
$(print_upload_instructions)
Push this pending-release branch
================================
@ -133,8 +175,8 @@ master to continue development on other packages.
git push origin $RELBRANCH && git checkout master
Merge the pending-release branch when ACCEPTED
==============================================
Merge the pending-release branch if/when ACCEPTED
=================================================
When it's ACCEPTED by the Debian FTP masters, you may then merge this branch
back into the master branch, delete it, and push these updates to origin.
@ -142,13 +184,15 @@ back into the master branch, delete it, and push these updates to origin.
git checkout master && git merge $RELBRANCH && git branch -d $RELBRANCH
git push origin master :$RELBRANCH
----
Delete this branch without merging if/when REJECTED
===================================================
The above assumes you are a Debian Developer with upload rights. If not, you
should revert what I just did. To do that, run:
If your upload is REJECTED, or if you cannot perform an upload in the first
place e.g. because you are not a Debian Developer, you should revert what I
just did. To do that, run:
git checkout master && git branch -D $RELBRANCH
Then ask a Debian Developer to re-run me ($0 $*) on your behalf. Also touch
and commit ${PKGDIR_REL}/debian/RFS so it's easy to track.
Then ask a Debian Developer to re-run me ($0 $*) on your behalf. Also, touch
and commit ${PKGDIR_REL}/debian/RFS so we can track these easier.
eof

View File

@ -7,5 +7,5 @@ if ! shouldbuild "$BUILDDIR/debian/changelog" "$PKGDIR/debian/changelog" && \
exit 0
fi
REALVER="$(sed -nre "s/.*Package .* (.*) from crates.io.*/\1/gp" "$PKGDIR/debian/changelog" | head -n1)"
REALVER="$(get_existing_version "$PKGDIR")"
run_debcargo --no-overlay-write-back --changelog-ready

View File

@ -75,3 +75,7 @@ shouldbuild() {
local src="$2"
test ! -e "$dst" -o "$src" -nt "$dst"
}
get_existing_version() {
sed -nre "s/.*Package .* (.*) from crates.io.*/\1/gp" "$1/debian/changelog" | head -n1
}