]> git.proxmox.com Git - debcargo-conf.git/blob - update.sh
Merge remote-tracking branch 'origin/pending-crossbeam-deque'
[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 sed -i -e 's/^\(overlay.*\)$/\1\nuploaders = ["'"$uploader"'"]/' "$PKGCFG"
40 if [ "$uploader" != "$DEBFULLNAME <$DEBEMAIL>" ]; then
41 echo >&2 "$0: Auto-added $uploader to uploaders in debcargo.toml, based on d/copyright"
42 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
43 fi
44 fi
45
46 run_debcargo
47
48 if ! git diff --quiet -- "$PKGDIR_REL"; then
49 read -p "Update wrote some changes to $PKGDIR_REL, press enter to git diff..." x || true
50 git diff -- "$PKGDIR_REL"
51 echo >&2 "-- end of git diff --"
52 fi
53
54 cat >&2 <<eof
55 Automatic update of $CRATE finished; now it's your turn to manually review it.
56
57 Deal with any FIXMEs mentioned above, by editing any corresponding source files
58 in $PKGDIR_REL. If a hint file is listed, indicated by (•), you should edit the
59 *NON*-hint file, without the suffix .debcargo.hint, and git-add the hint file
60 exactly as output by debcargo. So for example:
61
62 to deal with a FIXME in:
63 build/$PKGNAME/debian/copyright.debcargo.hint
64 you should edit (and git-add when ready):
65 src/$PKGNAME/debian/copyright
66 and directly git-add without editing:
67 src/$PKGNAME/debian/copyright.debcargo.hint
68
69 When done, git-add all your changes plus any unmodified hint files, and re-run
70 this command (\`./update.sh $*\`).
71
72 For issues with debian/control, edit src/$PKGNAME/debian/debcargo.toml instead.
73 You can find docs for that in debcargo.toml.example in the debcargo git repo.
74
75 Check that your fixes actually get rid of the FIXMEs. Of course, you can ignore
76 FIXMEs listed in hint files, assuming you actually fixed the issues in the
77 corresponding non-hint files. (We have no way to auto-detect this so you have
78 to be honest!) You should also ignore the FIXME in the Distribution field in
79 the top entry of debian/changelog, that will be dealt with in the next step.
80
81 If there was a \`git diff\` above, check it to see if debcargo made changes to
82 any auto-generated hint files. If so, you should make the equivalent changes to
83 the non-hint files, and git-add these too.
84
85 You can test-build your package by running:
86
87 cd build && ./build.sh $CRATE $VER
88
89 This assumes that you have set up sbuild; see "DD instructions" in README.rst
90 for details. Try to fix any lintian errors, but note that some errors are due
91 to lintian being out-of-date and/or are expected at this stage of the process
92 (e.g. bad-distribution-in-changes-file). Ask on IRC when in doubt.
93
94 When satisfied with the output (both of debcargo after running ./update.sh, and
95 of lintian after running ./build.sh), you can commit and push all your changes.
96
97 Then, ask a Debian Developer to run \`./release.sh $*\`. This finalises your
98 changes in the changelog, and allows them to build and upload the package. If
99 you're not a Debian Developer and are unable to upload, please don't run that
100 script or else you will need to revert the changes that it makes to your git.
101 eof
102 if [ -n "$VER" ]; then
103 cat >&2 <<eof
104
105 You are packaging an older version of a crate. Please document why it's needed,
106 by adding comments to src/$PKGNAME/debian/debcargo.toml. For example because it
107 is a dependency of other crate(s), and it is not possible to update them to use
108 the latest version of $CRATE. Please also mention the names of these crate(s).
109 eof
110 fi