]> pere.pagekite.me Git - homepage.git/blob - blog/data/2024-04-25-debian-vcs-qa.txt
Generated.
[homepage.git] / blog / data / 2024-04-25-debian-vcs-qa.txt
1 Title: 45 orphaned Debian packages moved to git, 391 to go
2 Tags: english, debian
3 Date: 2024-04-25 22:00
4
5 <p>Nine days ago, I started migrating orphaned Debian packages with no
6 version control system listed in debian/control of the source to git.
7 At the time there were 438 such packages. Now there are 391,
8 according to the UDD. In reality it is slightly less, as there is a
9 delay between uploads and UDD updates. In the nine days since, I have
10 thus been able to work my way through ten percent of the packages. I
11 am starting to run out of steam, and hope someone else will also help
12 brushing some dust of these packages. Here is a recipe how to do it.
13
14 I start by picking a random package by querying the UDD for a list of
15 10 random packages from the set of remaining packages:
16
17 <blockquote><pre>
18 PGPASSWORD="udd-mirror" psql --port=5432 --host=udd-mirror.debian.net \
19 --username=udd-mirror udd -c "select source from sources \
20 where release = 'sid' and (vcs_url ilike '%anonscm.debian.org%' \
21 OR vcs_browser ilike '%anonscm.debian.org%' or vcs_url IS NULL \
22 OR vcs_browser IS NULL) AND maintainer ilike '%packages@qa.debian.org%' \
23 order by random() limit 10;"
24 </pre></blockquote>
25
26 <p>Next, I visit http://salsa.debian.org/debian and search for the
27 package name, to ensure no git repository already exist. If it does,
28 I clone it and try to get it to an uploadable state, and add the Vcs-*
29 entries in d/control to make the repository more widely known. These
30 packages are a minority, so I will not cover that use case here.</p>
31
32 <p>For packages without an existing git repository, I run the
33 following script <tt>debian-snap-to-salsa</tt> to prepare a git
34 repository with the existing packaging.</p>
35
36 <blockquote><pre>
37 #!/bin/sh
38 #
39 # See also https://bugs.debian.org/804722#31
40
41 set -e
42
43 # Move to this Standards-Version.
44 SV_LATEST=4.7.0
45
46 PKG="$1"
47
48 if [ -z "$PKG" ]; then
49 echo "usage: $0 <pkgname>"
50 exit 1
51 fi
52
53 if [ -e "${PKG}-salsa" ]; then
54 echo "error: ${PKG}-salsa already exist, aborting."
55 exit 1
56 fi
57
58 if [ -z "ALLOWFAILURE" ] ; then
59 ALLOWFAILURE=false
60 fi
61
62 # Fetch every snapshotted source package. Manually loop until all
63 # transfers succeed, as 'gbp import-dscs --debsnap' do not fail on
64 # download failures.
65 until debsnap --force -v $PKG || $ALLOWFAILURE ; do sleep 1; done
66 mkdir ${PKG}-salsa; cd ${PKG}-salsa
67 git init
68
69 # Specify branches to override any debian/gbp.conf file present in the
70 # source package.
71 gbp import-dscs --debian-branch=master --upstream-branch=upstream \
72 --pristine-tar ../source-$PKG/*.dsc
73
74 # Add Vcs pointing to Salsa Debian project (must be manually created
75 # and pushed to).
76 if ! grep -q ^Vcs- debian/control ; then
77 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
78 git commit -m "Updated vcs in d/control to Salsa." debian/control
79 fi
80
81 # Tell gbp to enforce the use of pristine-tar.
82 inifile +inifile debian/gbp.conf +create +section DEFAULT +key pristine-tar +value True
83 git add debian/gbp.conf
84 git commit -m "Added d/gbp.conf to enforce the use of pristine-tar." debian/gbp.conf
85
86 # Update to latest Standards-Version.
87 SV="$(grep ^Standards-Version: debian/control|awk '{print $2}')"
88 if [ $SV_LATEST != $SV ]; then
89 sed -i "s/\(Standards-Version: \)\(.*\)/\1$SV_LATEST/" debian/control
90 git commit -m "Updated Standards-Version from $SV to $SV_LATEST." debian/control
91 fi
92
93 if grep -q pkg-config debian/control; then
94 sed -i s/pkg-config/pkgconf/ debian/control
95 git commit -m "Replaced obsolete pkg-config build dependency with pkgconf." debian/control
96 fi
97
98 if grep -q libncurses5-dev debian/control; then
99 sed -i s/libncurses5-dev/libncurses-dev/ debian/control
100 git commit -m "Replaced obsolete libncurses5-dev build dependency with libncurses-dev." debian/control
101 fi
102 </pre></blockquote>
103
104 Some times the debsnap script fail to download some of the versions.
105 In those cases I investigate, and if I decide the failing versions
106 will not be missed, I call it using ALLOWFAILURE=true to ignore the
107 problem and create the git repository anyway.</p>
108
109 <p>With the git repository in place, I do a test build (gbp
110 buildpackage) to ensure the build is actually working. If it does not
111 I pick a different package, or if the build failure is trivial to fix,
112 I fix it before continuing. At this stage I revisit
113 http://salsa.debian.org/debian and create the project under this group
114 for the package. I then follow the instructions to publish the local
115 git repository. Here is from a recent example:</p>
116
117 <blockquote><pre>
118 git remote add origin git@salsa.debian.org:debian/perl-byacc.git
119 git push --set-upstream origin master upstream pristine-tar
120 git push --tags
121 </pre></blockquote>
122
123 <p>With a working build, I have a look at the build rules if I want to
124 remove some more dust. I normally try to move to debhelper compat
125 level 13, which involves removing debian/compat and modifying
126 debian/control to build depend on debhelper-compat (=13). I also test
127 with 'Rules-Requires-Root: no' in debian/control and verify in
128 debian/rules that hardening is enabled, and include all of these if
129 the package still build. If it fail to build with level 13, I try
130 with 12, 11, 10 and so on until I find a level where it build, as I do
131 not want to spend a lot of time fixing build issues.</p>
132
133 <p>Some times, when I feel inspired, I make sure debian/copyright is
134 converted to the machine readable format, often by starting with
135 'debhelper -cc' and then cleaning up the autogenerated content until
136 it matches realities. If I feel like it, I might also clean up
137 non-dh-based debian/rules files to use the short style dh build
138 rules.</p>
139
140 <p>Once I have removed all the dust I care to process for the package,
141 I run 'gbp dch' to generate a debian/changelog entry based on the
142 commits done so far, run 'dch -r' to switch from 'UNRELEASED' to
143 'unstable' and get an editor to make sure the 'QA upload' marker is in
144 place and that all long commit descriptions are wrapped into sensible
145 lengths, run 'debcommit --release -a' to commit and tag the new
146 debian/changelog entry, run 'debuild -S' to build a source only
147 package, and 'dput ../perl-byacc_2.0-10_source.changes' to do the
148 upload. During the entire process, and many times per step, I run
149 'debuild' to verify the changes done still work. I also some times
150 verify the set of built files using 'find debian' to see if I can spot
151 any problems (like no file in usr/bin any more or empty package). I
152 also try to fix all lintian issues reported at the end of each
153 'debuild' run.</p>
154
155 <p>If I find Debian specific patches, I try to ensure their metadata
156 is fairly up to date and some times I even try to reach out to
157 upstream, to make the upstream project aware of the patches. Most of
158 my emails bounce, so the success rate is low. For projects with no
159 Homepage entry in debian/control I try to track down one, and for
160 packages with no debian/watch file I try to create one. But at least
161 for some of the packages I have been unable to find a functioning
162 upstream, and must skip both of these.</p>
163
164 <p>If I could handle ten percent in nine days, twenty people could
165 complete the rest in less then five days. I use approximately twenty
166 minutes per package, when I have twenty minutes spare time to spend.
167 Perhaps you got twenty minutes to spare too?</p>
168
169 <p>As usual, if you use Bitcoin and want to show your support of my
170 activities, please send Bitcoin donations to my address
171 <b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>
172
173 <p><strong>Update 2024-05-04:</strong> There is
174 <a href="http://www.hungry.com/~pere/blog/images/2024-05-04-debian-snap-to-salsa.sh">an
175 updated edition of my migration script</a>, last updated
176 2024-05-04.</p>