[Pkg-haskell-commits] [package-plan] 154/457: Add script to unpack all selected packages from Hackage, with patches
Joachim Breitner
nomeata at moszumanska.debian.org
Mon Apr 14 20:05:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
nomeata pushed a commit to branch master
in repository package-plan.
commit 1383693c5fe85d2aedd399a0cbc74692b1e558af
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Jul 18 09:55:50 2013 +0000
Add script to unpack all selected packages from Hackage, with patches
---
unpack-all.pl | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/unpack-all.pl b/unpack-all.pl
new file mode 100644
index 0000000..40441cc
--- /dev/null
+++ b/unpack-all.pl
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+
+# Unpacks all packages to ./unpacked with patches applied
+
+use strict;
+use warnings;
+
+use Dpkg::Version;
+use Cwd;
+use File::Copy;
+use Archive::Tar;
+use File::Slurp;
+use IPC::Run qw( run );
+use Getopt::Long;
+
+my %packages;
+my %versions;
+my %available;
+my %comments;
+my %notest;
+my @flags;
+
+my $allow_upgrade = 0;
+
+GetOptions (
+ ) or die("Error in command line arguments\n");
+
+print "Reading packages.txt...\n";
+open PACKAGES, "<", "packages.txt" or die $!;
+while (<PACKAGES>) {
+ chomp;
+ next if /^#/;
+ next if /^\s*$/;
+ unless (m/^(.*?) (.*?)(?: (.*))?$/) {
+ print "Ignoring unparseable line $.: $_\n";
+ }
+ my ($pkg,$version,$comment) = ($1,$2,$3);
+ $packages{$pkg}++;
+ $versions{$pkg} = $version;
+ next unless $comment;
+ $notest{$pkg}++ if $comment =~ s/notest\s*//;
+ push @flags, $1 while $comment =~ s/(-f[^ ]+)\s*//;
+ $comments{$pkg} = $comment if $comment;
+}
+close PACKAGES;
+
+my $destdir = cwd() . "/unpacked";
+system("rm","-rf",$destdir);
+mkdir "$destdir" or die $!;
+
+print "Unpacking all packages\n";
+for my $pkg (sort keys %versions) {
+ next if (exists $comments{$pkg});
+ my $pkgid = sprintf "%s-%s", $pkg, $versions{$pkg};
+ print "Unpacking $pkgid...";
+ my $out;
+ my $stderr;
+ if (run ["cabal", "unpack", "-d", $destdir, $pkgid], \"", \$out, \$stderr) {
+ print "done\n";
+ } else {
+ print "failed!\n";
+ print $stderr;
+ }
+ my $patchesdir = sprintf "./patches/%s/%s", $pkg, $versions{$pkg};
+ if (-d "$patchesdir") {
+ print "Patching $pkgid...";
+ symlink "../../$patchesdir", "$destdir/$pkgid/patches" or die @!;
+ chdir "$destdir/$pkgid" or die @!;
+ if (run ["quilt", "push", "-a"], \"", \$out, \$stderr) {
+ print "done\n";
+ } else {
+ print "failed!\n";
+ print $stderr;
+ }
+ chdir "../.." or die @!;
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/package-plan.git
More information about the Pkg-haskell-commits
mailing list