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