To sync a deb repo
So, today at work we had to download the brand new Ubuntu 14.04, there are two options to do it: apt-mirror and debmirror.
The advantage of apt-mirror is the ability to download a repo with multiple threads, if bandwith is not an issue then your downloads will fly, on the bad side you can't filter unwanted sections of a repo, it's all or nothing.
Debmirror on the other side gives you the ability to filter by repo sections or even regular expressions, over the years I've tuned my filters and now Debian Wheezy fits on just ~12 GB, avoiding nearly 40 Gb of unused packages.
On the bad side debmirror doesn't supports threads, but let's face it, the ability of pruning a repo is priceless, not only because of space but also bandwith, if your company maintains a local Debian/Ubuntu repo then having around 10 GB of games and 5 more on debug packages is pointless.
Our pruning technique will be shared in a future post, but just to have an idea is nothing more than using the --exclude and --exclude-deb-section options from debmirror:
--exclude-deb-section='(games|debug|news|electronics)' --exclude='/myspell-pt.*' \ --exclude='(/libhdf5-doc.*)' \
This procedure is fairly easy on a recent distro, but let's assume we have CentOS 5.9 with Perl 5.8 and debmirror 20090807 and we want the latest debmirror which needs a recent Perl interpreter.
Is not a good idea to start messing with the default Perl installation, the safest choice is installing a new version somewhere like /opt/ and using it from there.
ActivePerl is a perfect choice for this case, just download and install on /opt/ActivePerl/.
Now check the interpreter:
/opt/ActivePerl/bin/perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for i686-linux-thread-multi ...
#!/opt/ActivePerl-5.16/bin/perl -w =head1 NAME
If you try to use this you'll get an error, debmirror needs a module not included in ActivePerl by default "LockFile::Simple", easy fix, just have to install it from CPAN.
Remember to export http_proxy in case you need it.
Sync Baby, Sync!
The rest is easy cake, now you have a recent debmirror with a brand new Perl interpreter running on top of the old crusty CentOS 5. Rejoice.