]> git.proxmox.com Git - debcargo-conf.git/blob - update.sh
Release package subtle
[debcargo-conf.git] / update.sh
1 #!/bin/sh
2
3 . ./vars.sh.frag
4
5 case "$(git rev-parse --abbrev-ref HEAD)" in
6 pending-*) abort 1 "You are on a pending-release branch, $0 can only be run on another branch, like master";;
7 esac
8
9 if [ -n "$VER" ]; then
10 if [ ! -d "$PWD/src/$PKGBASE" ]; then
11 abort 1 "Using crate $CRATE with version $VER but default-version is not packaged." \
12 "Package that first by running this script without the explicit version."
13 fi
14 fi
15 if [ ! -d "$PKGDIR/debian" ]; then
16 mkdir -p "$PKGDIR/debian"
17 cat <<-eof > "$PKGCFG"
18 overlay = "."
19 uploaders = ["$DEBFULLNAME <$DEBEMAIL>"]
20 eof
21 git add "$PKGDIR"
22 fi
23 if [ ! -f "$PKGDIR/debian/copyright" ]; then
24 cat <<-eof > "$PKGDIR/debian/copyright"
25 FIXME fill me in using ./copyright.debcargo.hint as a guide
26 eof
27 fi
28 if [ -n "$VER" -a "$(sed -ne 's/^semver_suffix\s*=\s*//p' "$PKGCFG")" != "true" ]; then
29 if grep -q semver_suffix "$PKGCFG"; then
30 sed -i -e 's/^\(semver_suffix\s*=\s*\).*/\1true/' "$PKGCFG"
31 else
32 sed -i -e '1isemver_suffix = true' "$PKGCFG"
33 fi
34 fi
35
36 if ! grep -q uploaders "$PKGCFG"; then
37 # try to auto-fill in uploaders if debcargo.toml doesn't have it
38 uploader="$(egrep -A1 "[0-9][0-9]*( Debian)? Rust Maintainers" "$PKGDIR/debian/copyright" | tail -n1 | sed -re 's/^\s*[0-9]+\s*//g')"
39 uploader="${uploader:-$DEBFULLNAME <$DEBEMAIL>}"
40 sed -i -e 's/^\(overlay.*\)$/\1\nuploaders = ["'"$uploader"'"]/' "$PKGCFG"
41 echo >&2 "$0: Auto-added $uploader to uploaders in debcargo.toml, based on d/copyright"
42 if [ "$uploader" != "$DEBFULLNAME <$DEBEMAIL>" ]; then
43 read >&2 -p "$0: You may also want to add yourself; ctrl-c if you want to do that, or press enter to continue... " x
44 fi
45 fi
46
47 run_debcargo
48 git add -N "$PKGDIR"
49
50 if ! git diff --quiet -- "$PKGDIR_REL"; then
51 read -p "Update wrote some changes to $PKGDIR_REL, press enter to git diff..." x || true
52 git diff -- "$PKGDIR_REL"
53 echo >&2 "-- end of git diff --"
54 fi
55
56 cat >&2 <<eof
57 Automatic update of $CRATE finished; now it's your turn to manually review it.
58
59 Deal with any FIXMEs mentioned above, by editing any corresponding source files
60 in $PKGDIR_REL. If a hint file is listed, indicated by (•), you should edit the
61 *NON*-hint file, without the suffix .debcargo.hint, and git-add the hint file
62 exactly as output by debcargo. So for example:
63
64 to deal with a FIXME in:
65 build/$PKGNAME/debian/copyright.debcargo.hint
66 you should edit (and git-add when ready):
67 src/$PKGNAME/debian/copyright
68 and directly git-add without editing:
69 src/$PKGNAME/debian/copyright.debcargo.hint
70
71 When done, git-add all your changes plus any unmodified hint files, and re-run
72 this command (\`./update.sh $*\`).
73
74 For issues with debian/control, edit src/$PKGNAME/debian/debcargo.toml instead.
75 You can find docs for that in debcargo.toml.example in the debcargo git repo.
76
77 Check that your fixes actually get rid of the FIXMEs. Of course, you can ignore
78 FIXMEs listed in hint files, assuming you actually fixed the issues in the
79 corresponding non-hint files. (We have no way to auto-detect this so you have
80 to be honest!) You should also ignore the FIXME in the Distribution field in
81 the top entry of debian/changelog, that will be dealt with in the next step.
82
83 If there was a \`git diff\` above, check it to see if debcargo made changes to
84 any auto-generated hint files. If so, you should make the equivalent changes to
85 the non-hint files, and git-add these too.
86
87 You can test-build your package by running:
88
89 cd build && ./build.sh $CRATE $VER
90
91 This assumes that you have set up sbuild; see "Build environment" in README.rst
92 for details. Try to fix any lintian errors, but note that some errors are due
93 to lintian being out-of-date and/or are expected at this stage of the process
94 (e.g. bad-distribution-in-changes-file). Ask on IRC when in doubt.
95
96 If your update includes raising the semver level i.e. from 0.x.* to 0.y.* or
97 from x.*.* to y.*.*., then you should also check the reverse-deps of your
98 package, by running:
99
100 dev/list-rdeps.sh $CRATE
101
102 If any of the reverse-dependencies depend on an older version of your crate,
103 please try to update those too, to depend on the newer version that you just
104 packaged. If this is impossible or too hard, you should retain the old version
105 of your crate by running \`./update.sh $CRATE <OLD SEMVER>\`, where <OLD
106 SEMVER> looks like 0.n or n - but you must have a good reason for this, which
107 you should document in src/$PKGNAME-<OLD SEMVER>/debian/debcargo.toml.
108
109 When satisfied with all of these outputs:
110
111 - of debcargo after running ./update.sh
112 - of lintian after running ./build.sh
113 - of dev/list-rdeps.sh $CRATE
114
115 then you can commit and push all your changes.
116
117 Then, ask a Debian Developer to run \`./release.sh $*\`. This finalises your
118 changes in the changelog, and allows them to build and upload the package. If
119 you're not a Debian Developer and are unable to upload, please don't run that
120 script or else you will need to revert the changes that it makes to your git.
121 eof
122 if [ -n "$VER" ]; then
123 cat >&2 <<eof
124
125 You are packaging an older version of a crate. Please document why it's needed,
126 by adding comments to src/$PKGNAME/debian/debcargo.toml. For example because it
127 is a dependency of other crate(s), and it is not possible to update them to use
128 the latest version of $CRATE. Please also mention the names of these crate(s).
129 eof
130 fi