]> pere.pagekite.me Git - homepage.git/blob - blog/images/2024-07-11-debian-snap-to-salsa.sh
Converted pages to actually temp site.
[homepage.git] / blog / images / 2024-07-11-debian-snap-to-salsa.sh
1 #!/bin/sh
2 #
3 # See also https://bugs.debian.org/804722#31
4 #
5 # To get install dependencies:
6 # apt install git-buildpackage devscripts \
7 # virtuoso-opensource-7-common lintian-brush
8
9 set -e
10
11 # Move to this Standards-Version.
12 SV_LATEST=4.7.0
13
14 PKG="$1"
15
16 if [ -z "$PKG" ]; then
17 echo "usage: $0 <PACKAGE>"
18 exit 1
19 fi
20
21 if [ -e "${PKG}-salsa" ]; then
22 echo "error: ${PKG}-salsa already exist, aborting."
23 exit 1
24 fi
25
26 if [ -z "ALLOWFAILURE" ] ; then
27 ALLOWFAILURE=false
28 fi
29
30 # Fetch every snapshotted source package. Manually loop until all
31 # transfers succeed, as 'gbp import-dscs --debsnap' do not fail on
32 # download failures.
33 #if false; then # XXX
34 until debsnap --force -v $PKG || $ALLOWFAILURE ; do sleep 1; done
35 #fi # XXX
36 mkdir ${PKG}-salsa; cd ${PKG}-salsa
37 git init
38 # Specify branches to override any debian/gbp.conf file present in the
39 # source package. Use DEP-14 branch layout.
40 gbp import-dscs \
41 --debian-branch=debian/latest \
42 --upstream-branch=upstream/latest \
43 --pristine-tar ../source-$PKG/*.dsc
44 # Document branch layout for gbp
45 inifile +inifile debian/gbp.conf +create +section DEFAULT +key debian-branch +value debian/latest
46 inifile +inifile debian/gbp.conf +section DEFAULT +key upstream-branch +value upstream/latest
47 git add debian/gbp.conf
48 git commit -m "Added d/gbp.conf to describe branch layout." debian/gbp.conf
49
50 # Add Vcs pointing to Salsa Debian project (must be manually created
51 # and pushed to).
52 if ! grep -q ^Vcs- debian/control ; then
53 awk "BEGIN { s=1 } /^\$/ { if (s==1) { print \"Vcs-Browser: https://salsa.debian.org/debian/$PKG\"; print \"Vcs-Git: https://salsa.debian.org/debian/$PKG.git\" }; s=0 } { print }" < debian/control > debian/control.new && mv debian/control.new debian/control
54 git commit -m "Updated vcs in d/control to Salsa." debian/control
55 fi
56
57 # Tell gbp to enforce the use of pristine-tar.
58 inifile +inifile debian/gbp.conf +section DEFAULT +key pristine-tar +value True
59 git add debian/gbp.conf
60 git commit -m "Updated d/gbp.conf to enforce the use of pristine-tar." debian/gbp.conf
61
62 # Update to latest Standards-Version.
63 SV="$(grep ^Standards-Version: debian/control|awk '{print $2}')"
64 if [ $SV_LATEST != $SV ]; then
65 sed -i "s/\(Standards-Version: \)\(.*\)/\1$SV_LATEST/" debian/control
66 git commit -m "Updated Standards-Version from $SV to $SV_LATEST." debian/control
67 fi
68
69 # Sort debian control files
70 wrap-and-sort -at
71 git commit -m "Use wrap-and-sort -at for debian control files." debian/*
72
73 if [ ! -e debian/source/format ] ; then
74 mkdir debian/source
75 echo '3.0 (quilt)' > debian/source/format
76 git add debian/source/format
77 git commit -m "Set Debian source package format to 3.0 (quilt)." debian/source/format
78 fi
79
80 if grep -q pkg-config debian/control; then
81 sed -i s/pkg-config/pkgconf/ debian/control
82 git commit -m "Replaced obsolete pkg-config build dependency with pkgconf." debian/control
83 fi
84
85 if grep -q libncurses5-dev debian/control; then
86 sed -i s/libncurses5-dev/libncurses-dev/ debian/control
87 git commit -m "Replaced obsolete libncurses5-dev build dependency with libncurses-dev." debian/control
88 fi
89
90 if grep -q libfreetype6-dev debian/control; then
91 sed -i s/libfreetype6-dev/libfreetype-dev/ debian/control
92 git commit -m "Replaced obsolete libfreetype6-dev build dependency with libfreetype-dev." debian/control
93 fi
94
95 lintian-brush --no-update-changelog
96
97 # Create changelog entry
98 gbp dch --qa