po: Update German man pages translation
[dpkg.git] / build-aux / gen-release
blobb32f43c3f97c7f24b406808c9b264db81377f331
1 #!/bin/sh
3 # gen-release
5 # Copyright © 2017-2024 Guillem Jover <guillem@debian.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 set -x
22 set -e
23 set -u
25 # Pre-checks.
27 # Currently requires packages: dpkg-dev, git, schroot and devscripts
28 # (the latter should eventually be replaced by dpkg tools).
29 for req in dpkg-parsechangelog git schroot dch debsign dscverify; do
30 if ! command -v $req >/dev/null 2>&1; then
31 echo "error: missing required command $req" >&2
32 exit 1
34 done
36 if [ "$(dpkg-parsechangelog -SSource)" != 'dpkg' ] || ! [ -e .git ]; then
37 echo "error: not inside the dpkg git tree" >&2
38 exit 1
41 # Setup.
42 dist="${1:-unstable}"
43 relver="${2:-$(dpkg-parsechangelog -SVersion)}"
45 numjobs="$(nproc)"
46 checkflags="-j$numjobs AUTHOR_TESTING=1 TEST_PARALLEL=$numjobs"
48 dircode="$(pwd)"
49 dirtests="$dircode/tests"
50 dirbuild="$(mktemp --tmpdir --directory release-dpkg.XXXXXXXX)"
52 # Update the source chroot.
53 schroot -c "source:$dist" -- sudo eatmydata apt-get --yes update
54 schroot -c "source:$dist" -- sudo eatmydata apt-get --yes upgrade
56 # Setup a clean chroot session.
57 chroot="$(schroot -c "$dist" -b)"
59 echo "Release start: $(date -Iseconds)"
61 cd "$dircode"
63 schroot -c "$chroot" -r -- sudo eatmydata apt-get --yes build-dep \
64 -P pkg.dpkg.author-testing,pkg.dpkg.author-release .
66 if ! git log --format=tformat:%s -s HEAD~2.. | grep 'po: Regenerate'; then
67 # Clean slate.
68 git clean -Xdf
70 # Update the .pot and .po files.
71 echo "$relver" >.dist-version
72 schroot -c "$chroot" -r -- ./autogen
73 schroot -c "$chroot" -r -- ./configure
74 schroot -c "$chroot" -r -- make update-po
75 rm -f .dist-version
76 git commit -a -m 'po: Regenerate .pot files and merge .po files with them'
79 if [ -z "$(git tag --list "$relver")" ]; then
80 # Finalize the actual release.
81 genchangelog='build-aux/gen-changelog'
82 sed -i -e "2e$genchangelog" -e '2,3d' debian/changelog
83 dch -r -D"$dist"
84 git commit -a -m "Release $relver"
85 git tag -s "$relver" -m "Release $relver"
86 elif [ "$(git describe)" != "$relver" ]; then
87 echo "error: mismatched tag for $relver not on git HEAD" >&2
88 exit 1
91 # Clean slate.
92 git clean -Xdf
94 # Prepare the tarball for distribution.
95 schroot -c "$chroot" -r -- ./autogen
96 schroot -c "$chroot" -r -- ./configure
97 if [ "$dist" = unstable ]; then
98 # Generate the CPAN distribution only from main.
99 make dist-cpan
101 # shellcheck disable=SC2086
102 schroot -c "$chroot" -r -- make $checkflags distcheck
104 # Prepare for packaged release.
105 mkdir -p "$dirbuild"
106 cp "dpkg-$relver.tar.xz" "$dirbuild/"
108 # Teardown pre-release chroot.
109 schroot -c "$chroot" -e
111 cd "$dirbuild"
113 # Setup a clean chroot session for the dist tarballs.
114 chroot="$(schroot -c "$dist" -b)"
116 # Build twice, to make sure we can build ourselves with the new dpkg,
117 # and to verify that we are building reproducibly.
119 # Build A and B in a chroot.
120 for iter in a b; do (
121 mkdir -p "build-$iter"
122 cd "build-$iter"
123 tar xaf "../dpkg-$relver.tar.xz"
124 cd "dpkg-$relver"
126 schroot -c "$chroot" -r -- sudo eatmydata apt-get --yes build-dep .
127 schroot -c "$chroot" -r -- dpkg-buildpackage -us -uc --changes-option=-S
129 # Install resulting .debs.
130 schroot -c "$chroot" -r -- sudo eatmydata dpkg -iO ../*.deb
131 ) done
133 # Run functional test-suite.
135 set -x
136 set -e
137 set -u
139 cd "$dirtests"
140 schroot -c "$chroot" -r -- sudo eatmydata apt-get --yes purge pkg-config
141 schroot -c "$chroot" -r -- eatmydata make test-clean clean
142 schroot -c "$chroot" -r -- eatmydata make test 2>&1 | tee test.log
145 schroot -c "$chroot" -r -- sudo eatmydata apt-get --yes install lintian
147 # Verify the result.
148 diff -u build-a/dpkg_*.changes build-b/dpkg_*.changes || true
149 # Prompt to continue? (.buildinfo will differ)
150 diff -u build-a/dpkg_*.buildinfo build-b/dpkg_*.buildinfo || true
151 # Prompt to continue? (Build-Date, Environment will differ).
152 schroot -c "$chroot" -r -- lintian build-b/*.changes build-b/*.deb
154 # Teardown chroot.
155 schroot -c "$chroot" -e
157 # Sign and verify.
158 cd "$dirbuild/build-b"
159 debsign dpkg_"${relver}"_*.changes
160 dscverify dpkg_"${relver}"_*.changes
162 ls -l "$(pwd)"
164 echo "Release process finished (dpkg ${relver}): $(date -Iseconds)"
165 echo " Hint: upload to CPAN"
166 echo " Hint: update https://www.wikidata.org/wiki/Q305892"