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