Add hook directory support, per configuration file, similar to pbuilder support.

git-svn-id: http://emdebian.org/svn/current@7753 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2011-02-07 12:21:45 +00:00
parent 8eae53de0f
commit 9fda93fe05
2 changed files with 23 additions and 2 deletions

4
debian/changelog vendored
View file

@ -6,8 +6,10 @@ multistrap (2.1.11) unstable; urgency=low
* Remove workaround for apt from lenny. * Remove workaround for apt from lenny.
* Improve the fix for #553599 and generalise it. Handle making a real * Improve the fix for #553599 and generalise it. Handle making a real
directory for amd64 to cope with libc6-amd64 [i386]. directory for amd64 to cope with libc6-amd64 [i386].
* Add hook directory support, per configuration file, similar to
pbuilder support.
-- Neil Williams <codehelp@debian.org> Mon, 07 Feb 2011 12:14:17 +0000 -- Neil Williams <codehelp@debian.org> Mon, 07 Feb 2011 12:21:33 +0000
multistrap (2.1.10) experimental; urgency=low multistrap (2.1.10) experimental; urgency=low

View file

@ -33,7 +33,7 @@ use vars qw/ $progname $ourversion $dstrap $extra @aptsources $mirror
@extrapkgs @includes %source $setupsh $configsh $omitrequired $dryrun @extrapkgs @includes %source $setupsh $configsh $omitrequired $dryrun
$omitpreinst @reinstall $tgzname %uniq %required $check @check %uniq $omitpreinst @reinstall $tgzname %uniq %required $check @check %uniq
$explicit_suite $allow_recommends %omitdebsrc @dsclist @sectoutput $explicit_suite $allow_recommends %omitdebsrc @dsclist @sectoutput
%flatfile %important $addimportant @debconf /; %flatfile %important $addimportant @debconf $hookdir %hooks /;
setlocale(LC_MESSAGES, ""); setlocale(LC_MESSAGES, "");
textdomain("multistrap"); textdomain("multistrap");
@ -897,6 +897,20 @@ sub cascade {
chomp ($fl); chomp ($fl);
push @debconf, $fl; push @debconf, $fl;
} }
my @h = split(' ', lc($keys{$section}{'hookdir'}))
if (defined $keys{$section}{'hookdir'});
foreach my $f (@h) {
opendir (HOOKS, "$f") or next;
my @hookfiles=grep(!m:\.\.?$:, readdir HOOKS);
closedir(HOOKS);
foreach my $hf (@hookfiles) {
my $fl = `realpath $f/$hf 2>/dev/null`;
chomp ($fl);
next if (($fl eq "") or (not -f $fl) or (not -x $fl));
push (@{$hooks{'A'}}, $fl) if ($hf =~ /^A/);
push (@{$hooks{'D'}}, $fl) if ($hf =~ /^D/);
}
}
my @d = split(' ', lc($keys{$section}{'debootstrap'})); my @d = split(' ', lc($keys{$section}{'debootstrap'}));
push @debootstrap, @d; push @debootstrap, @d;
my @b = split(' ', lc($keys{$section}{'bootstrap'})); my @b = split(' ', lc($keys{$section}{'bootstrap'}));
@ -1039,6 +1053,11 @@ sub dump_config {
} }
$plural = ngettext("Debconf preseed file", "Debconf preseed files", scalar @debconf); $plural = ngettext("Debconf preseed file", "Debconf preseed files", scalar @debconf);
printf("%s:\t%s\n", $plural, join(" ", sort @debconf)) if (scalar @debconf > 0); printf("%s:\t%s\n", $plural, join(" ", sort @debconf)) if (scalar @debconf > 0);
$plural = ngettext ("Hook: ", "", scalar @extrapkgs);
print "hooks (A):\t\t$plural".join (", ", sort @{$hooks{'A'}})."\n"
if (defined ($hooks{'A'} and scalar @{$hooks{'A'}} > 0));
print "hooks (D):\t\t$plural".join (", ", sort @{$hooks{'D'}})."\n"
if (defined ($hooks{'D'} and scalar @{$hooks{'D'}} > 0));
$plural = ngettext ("Extra Package: ", "Extra Packages: ", scalar @extrapkgs); $plural = ngettext ("Extra Package: ", "Extra Packages: ", scalar @extrapkgs);
print "additional:\t\t$plural".join (", ", sort @extrapkgs)."\n" if (scalar @extrapkgs > 0); print "additional:\t\t$plural".join (", ", sort @extrapkgs)."\n" if (scalar @extrapkgs > 0);
print "reinstall:\t\t".join (", ", sort (@reinstall))."\n" if (scalar @reinstall > 0); print "reinstall:\t\t".join (", ", sort (@reinstall))."\n" if (scalar @reinstall > 0);