Debian migrates from Alioth to Salsa. Salsa is a GitLab instance, which is used to host git repositories for Debian.

I maintain about 90 Debian packages as a member of Debian Emacs Addons Packaging Team. So, migrating these packages by hand can easily become a hurdle. Fortunately, there's already some code written to ease migration. One can find Mehdi Dogguy's scripts, especially his import.sh script. I also found Enrico Zini's fork of the mentioned repository. Enrico Zini's fork contains some changes for better error handling. Since I just want to migrate a bunch of my repositories and don't want to mess things up, I choose to stick with the latter version of the import.sh script.

The first thing one needs to do is to generate access token with api scope. Then one needs to put that token to salsarc file in a directory containing import.sh script. Now it is possible to import Alioth repository to Salsa using something like as follows:

./import.sh https://anonscm.debian.org/cgit/pkg-emacsen/pkg/ace-link.git/ emacsen-team

Now we need to grab somewhere URLs of Alioth repositories to import to Salsa. Typically there is a Vcs-Browser field in debian/control file, which contains URL in question. So, I decided to write some small and ugly Perl script to batch process local clones of Alioth repositories. Note that I placed all clones of pkg-emacsen's Alioth repositories to the same directory. So, the code batch processing can be something like as following:

#!/usr/bin/perl

use warnings;
use strict;

my $root = $ARGV[0];

opendir my $dh, $root or die "$0: opendir: $!";

my @dirs = grep { -d "$root/$_" && ! /^\.{1,2}$|^dh-.*(elpa)+/ } readdir($dh);

closedir $dh;

DIR: foreach (@dirs) {
    print "Processing $_...\n";
    open my $fh, ( $root . $_ . "/debian/control" ) or die "$0: open: $!";
    while (<$fh>) {
        chomp;
        if (m/(Vcs-Browser: )(.*)/) {
            $_ =~ s/(Vcs-Browser: )(.*)/$2/g;
            system "./import.sh $_ emacsen-team";
            next DIR;
        }
    }
    close $fh;
}

To batch process local clones one needs to run the script with the path to the directory with the clones in question as an argument, that is

./batch.pl /home/dogsleg/freedom/packaging/elpa/

You can easily adopt the script to batch import repositories of any Debian team. Moreover, by tweaking grep in @dirs declaration one can blacklist subdirectories that should not be processed.

By the way, importing takes time. It took about 30 minutes to process 90 packages.