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