--- /dev/null
+Title: More than 200 orphaned Debian packages moved to git, 216 to go
+Tags: english, debian
+Date: 2024-07-11 12:30
+
+<p><a href="https://people.skolelinux.org/pere/blog/Time_to_move_orphaned_Debian_packages_to_git.html">In
+April</a>, I started migrating orphaned Debian packages without any
+version control system listed in debian/control to git. This morning,
+my Debian QA page finally reached 200 QA packages migrated. In
+reality there are a few more, as the packages uploaded by someone else
+after my initial upload have disappeared from my QA uploads list. As
+I am running out of steam and will most likely focus on other parts of
+Debian moving forward, I hope someone else will find time to continue
+the migration to bring the number of orphaned packages without any
+version control system down to zero. Here is the updated recipe if
+someone want to help out.</p>
+
+<p>To locate packages to work on, the following one-liner can be used:</p>
+
+<blockquote><pre>
+PGPASSWORD="udd-mirror" psql --port=5432 --host=udd-mirror.debian.net \
+ --username=udd-mirror udd -c "select source from sources \
+ where release = 'sid' and (vcs_url ilike '%anonscm.debian.org%' \
+ OR vcs_browser ilike '%anonscm.debian.org%' or vcs_url IS NULL \
+ OR vcs_browser IS NULL) AND maintainer ilike '%packages@qa.debian.org%' \
+ order by random() limit 10;"
+</pre></blockquote>
+
+<p>Pick a random package from the list and run the latest edition of
+the script
+<tt><a href="https://people.skolelinux.org/pere/blog/images/2024-07-11-debian-snap-to-salsa.sh">debian-snap-to-salsa</a></tt>
+with the package name as the argument to prepare a git repository with
+the existing packaging. This will download old Debian packages from
+<tt>snapshot.debian.org</tt>. Note that very recent uploads will not
+be included, so check out the package on <tt>tracker.debian.org</tt>.
+Next, run <tt>gbp buildpackage --git-ignore-new</tt> to verify that
+the package build as it should, and then visit
+<a href="https://salsa.debian.org/debian/">https://salsa.debian.org/debian/</a>
+and make sure there is not already a git repository for the package
+there. I also did <tt>git log -p debian/control</tt> and look for vcs
+entries to check if the package used to have a git repository on
+Alioth, and see if it can be a useful starting point moving forward.
+If all this check out, I created a new gitlab project below the Debian
+group on salsa, push the package source there and upload a new version.
+I tend to also ensure build hardening is enabled, if it prove to be
+easy, and check if I can easily fix any lintian issues or bug reports.
+If the process took more than 20 minutes, I dropped it and moved on to
+another package.</p>
+
+<p>If I found patches in debian/patches/ that were not yet passed
+upstream, I would send an email to make sure upstream know about them.
+This has proved to be a valuable step, and caused several new releases
+for software that initially appeared abandoned. :)</p>
+
+<p>As usual, if you use Bitcoin and want to show your support of my
+activities, please send Bitcoin donations to my address
+<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>
--- /dev/null
+#!/bin/sh
+#
+# See also https://bugs.debian.org/804722#31
+#
+# To get install dependencies:
+# apt install git-buildpackage devscripts \
+# virtuoso-opensource-7-common lintian-brush
+
+set -e
+
+# Move to this Standards-Version.
+SV_LATEST=4.7.0
+
+PKG="$1"
+
+if [ -z "$PKG" ]; then
+ echo "usage: $0 <PACKAGE>"
+ exit 1
+fi
+
+if [ -e "${PKG}-salsa" ]; then
+ echo "error: ${PKG}-salsa already exist, aborting."
+ exit 1
+fi
+
+if [ -z "ALLOWFAILURE" ] ; then
+ ALLOWFAILURE=false
+fi
+
+# Fetch every snapshotted source package. Manually loop until all
+# transfers succeed, as 'gbp import-dscs --debsnap' do not fail on
+# download failures.
+#if false; then # XXX
+until debsnap --force -v $PKG || $ALLOWFAILURE ; do sleep 1; done
+#fi # XXX
+mkdir ${PKG}-salsa; cd ${PKG}-salsa
+git init
+# Specify branches to override any debian/gbp.conf file present in the
+# source package. Use DEP-14 branch layout.
+gbp import-dscs \
+ --debian-branch=debian/latest \
+ --upstream-branch=upstream/latest \
+ --pristine-tar ../source-$PKG/*.dsc
+# Document branch layout for gbp
+inifile +inifile debian/gbp.conf +create +section DEFAULT +key debian-branch +value debian/latest
+inifile +inifile debian/gbp.conf +section DEFAULT +key upstream-branch +value upstream/latest
+git add debian/gbp.conf
+git commit -m "Added d/gbp.conf to describe branch layout." debian/gbp.conf
+
+# Add Vcs pointing to Salsa Debian project (must be manually created
+# and pushed to).
+if ! grep -q ^Vcs- debian/control ; then
+ 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
+ git commit -m "Updated vcs in d/control to Salsa." debian/control
+fi
+
+# Tell gbp to enforce the use of pristine-tar.
+inifile +inifile debian/gbp.conf +section DEFAULT +key pristine-tar +value True
+git add debian/gbp.conf
+git commit -m "Updated d/gbp.conf to enforce the use of pristine-tar." debian/gbp.conf
+
+# Update to latest Standards-Version.
+SV="$(grep ^Standards-Version: debian/control|awk '{print $2}')"
+if [ $SV_LATEST != $SV ]; then
+ sed -i "s/\(Standards-Version: \)\(.*\)/\1$SV_LATEST/" debian/control
+ git commit -m "Updated Standards-Version from $SV to $SV_LATEST." debian/control
+fi
+
+# Sort debian control files
+wrap-and-sort -at
+git commit -m "Use wrap-and-sort -at for debian control files." debian/*
+
+if [ ! -e debian/source/format ] ; then
+ mkdir debian/source
+ echo '3.0 (quilt)' > debian/source/format
+ git add debian/source/format
+ git commit -m "Set Debian source package format to 3.0 (quilt)." debian/source/format
+fi
+
+if grep -q pkg-config debian/control; then
+ sed -i s/pkg-config/pkgconf/ debian/control
+ git commit -m "Replaced obsolete pkg-config build dependency with pkgconf." debian/control
+fi
+
+if grep -q libncurses5-dev debian/control; then
+ sed -i s/libncurses5-dev/libncurses-dev/ debian/control
+ git commit -m "Replaced obsolete libncurses5-dev build dependency with libncurses-dev." debian/control
+fi
+
+if grep -q libfreetype6-dev debian/control; then
+ sed -i s/libfreetype6-dev/libfreetype-dev/ debian/control
+ git commit -m "Replaced obsolete libfreetype6-dev build dependency with libfreetype-dev." debian/control
+fi
+
+lintian-brush --no-update-changelog
+
+# Create changelog entry
+gbp dch --qa