update.sh 3.75 KB
Newer Older
Ximin Luo's avatar
Ximin Luo committed
1 2 3 4
#!/bin/sh

. ./vars.sh.frag

5 6 7 8
case "$(git rev-parse --abbrev-ref HEAD)" in
pending-*)	abort 1 "You are on a pending-release branch, $0 can only be run on another branch, like master";;
esac

9 10 11 12 13 14
if [ -n "$VER" ]; then
	if [ ! -d "$PWD/src/$PKGBASE" ]; then
		abort 1 "Using crate $CRATE with version $VER but default-version is not packaged." \
		"Package that first by running this script without the explicit version."
	fi
fi
Ximin Luo's avatar
Ximin Luo committed
15 16
if [ ! -d "$PKGDIR/debian" ]; then
	mkdir -p "$PKGDIR/debian"
17
	echo 'overlay = "."' > "$PKGCFG"
Ximin Luo's avatar
Ximin Luo committed
18 19
	git add "$PKGDIR"
fi
20
if [ ! -f "$PKGDIR/debian/copyright" ]; then
21 22 23 24 25 26
	cat <<-eof > "$PKGDIR/debian/copyright"
	FIXME fill me in using ./copyright.debcargo.hint as a guide

	You may find the following useful too:

	Files: debian/*
Ximin Luo's avatar
Ximin Luo committed
27 28 29
	Copyright:
	 2018 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
	 2018 $DEBFULLNAME <$DEBEMAIL>
30 31 32 33

	The reason we don't put this in debian/copyright.debcargo.hint itself is
	documented here: https://salsa.debian.org/rust-team/debcargo-conf/issues/5
	eof
34
fi
35 36 37 38 39 40 41
if [ -n "$VER" -a "$(sed -ne 's/^semver_suffix\s*=\s*//p' "$PKGCFG")" != "true" ]; then
	if grep -q semver_suffix "$PKGCFG"; then
		sed -i -e 's/^\(semver_suffix\s*=\s*\).*/\1true/' "$PKGCFG"
	else
		sed -i -e '1isemver_suffix = true' "$PKGCFG"
	fi
fi
Ximin Luo's avatar
Ximin Luo committed
42

43
run_debcargo
Ximin Luo's avatar
Ximin Luo committed
44

45
if ! git diff --quiet -- "$PKGDIR_REL"; then
46
	read -p "Update wrote some changes to $PKGDIR_REL, press enter to git diff..." x || true
Ximin Luo's avatar
Ximin Luo committed
47
	git diff -- "$PKGDIR_REL"
Ximin Luo's avatar
Ximin Luo committed
48
	echo >&2 "-- end of git diff --"
Ximin Luo's avatar
Ximin Luo committed
49 50 51
fi

cat >&2 <<eof
52 53 54 55 56 57
Automatic update of $CRATE finished; now it's your turn to manually review it.

Deal with any FIXMEs mentioned above, by editing any corresponding source files
in $PKGDIR_REL. If a hint file is listed, indicated by (•), you should edit the
*NON*-hint file, without the suffix .debcargo.hint, and git-add the hint file
exactly as output by debcargo. So for example:
Ximin Luo's avatar
Ximin Luo committed
58

59 60
to deal with a FIXME in:
	    build/$PKGNAME/debian/copyright.debcargo.hint
61
you should edit (and git-add when ready):
62
	    src/$PKGNAME/debian/copyright
63
and directly git-add without editing:
64
	    src/$PKGNAME/debian/copyright.debcargo.hint
65

66 67
When done, git-add all your changes plus any unmodified hint files, and re-run
this command (\`./update.sh $*\`).
68

Ximin Luo's avatar
Ximin Luo committed
69 70 71
For issues with debian/control, edit src/$PKGNAME/debian/debcargo.toml instead.
You can find docs for that in debcargo.toml.example in the debcargo git repo.

72 73 74 75 76
Check that your fixes actually get rid of the FIXMEs. Of course, you can ignore
FIXMEs listed in hint files, assuming you actually fixed the issues in the
corresponding non-hint files. (We have no way to auto-detect this so you have
to be honest!) You should also ignore the FIXME in the Distribution field in
the top entry of debian/changelog, that will be dealt with in the next step.
Ximin Luo's avatar
Ximin Luo committed
77

78
If there was a \`git diff\` above, check it to see if debcargo made changes to
79 80 81
any auto-generated hint files. If so, you should make the equivalent changes to
the non-hint files, and git-add these too.

82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
You can test-build your package by running:

  cd build && ./build.sh $CRATE $VER

This assumes that you have set up sbuild; see "DD instructions" in README.rst
for details. Try to fix any lintian errors, but note that some errors are due
to lintian being out-of-date and/or are expected at this stage of the process
(e.g. bad-distribution-in-changes-file). Ask on IRC when in doubt.

When satisfied with the output (both of debcargo after running ./update.sh, and
of lintian after running ./build.sh), you can commit and push all your changes.

Then, ask a Debian Developer to run \`./release.sh $*\`. This finalises your
changes in the changelog, and allows them to build and upload the package. If
you're not a Debian Developer and are unable to upload, please don't run that
script or else you will need to revert the changes that it makes to your git.
Ximin Luo's avatar
Ximin Luo committed
98
eof