Package: equivs
Followup-For: Bug #449542
Here's a follow-on patch that allows you to include extra files inline in
the control file, eg:
File: /etc/apt/sources.list.d/lovetts.list
deb http://labradoodle/lovetts/ client/
.
deb http://labradoodle/debian etch main contrib non-free
deb http://labradoodle/debian etch-proposed-updates main contrib non-free
.
deb http://security.debian.org/ etch/updates main contrib non-free
The leading space is trimmed, and lines just containing a dot are converted
to blank lines (and two dots - one dot, etc SMTP-style).
It also allows specifying a suite directly, and you can include maintainer
scripts ({pre,post}{inst,rm}) directly.
Patch follows.
Cheers,
aj
diff -Nurb equivs-2.0.7-0.0aj1/debian/changelog
equivs-2.0.7-0.0aj3/debian/changelog
--- equivs-2.0.7-0.0aj1/debian/changelog2007-11-06 23:29:26.0
+1000
+++ equivs-2.0.7-0.0aj3/debian/changelog2007-11-07 14:33:09.0
+1000
@@ -1,3 +1,12 @@
+equivs (2.0.7-0.0aj3) unstable; urgency=low
+
+ * Add support for specifying suite.
+ * Add support for creating files from the control file, by specifying
+File: filename\n contents... fields. Includes support for in place
+specification of postinst and other maintainer scripts.
+
+ -- Anthony Towns [EMAIL PROTECTED] Wed, 07 Nov 2007 14:32:33 +1000
+
equivs (2.0.7-0.0aj1) unstable; urgency=low
* An unuploaded NMU.
diff -Nurb equivs-2.0.7-0.0aj1/usr/bin/equivs-build
equivs-2.0.7-0.0aj3/usr/bin/equivs-build
--- equivs-2.0.7-0.0aj1/usr/bin/equivs-build2007-11-06 23:38:55.0
+1000
+++ equivs-2.0.7-0.0aj3/usr/bin/equivs-build2007-11-07 14:43:06.0
+1000
@@ -61,28 +61,49 @@
# Copy any additional files
my @extra_files = split ,, $control{'Extra-Files'} || ;
-my %install_files= ();
+my %install_files = ();
for (split \n, $control{'Files'} || ) {
-$install_files{$1} = $2 if m/^\s*(\S+)\s+(\S+)\s*$/;
+$install_files{$2} = $1 if m/^\s*(\S+)\s+(\S+)\s*$/;
+}
+my %create_files = ();
+for (@{$control{'File'} || []}) {
+ if (m/^\s*(\S+)\n(.*)$/s) {
+my ($f,$b) = ($1,$2);
+$b =~ s/^ //mg;
+$b =~ s/^[.]([.]*)$/$1/mg;
+$create_files{$f} = $b;
+ }
}
mkdir $builddir/install, 0755;
open INSTALL, '', $builddir/debian/install or
die Cannot open $builddir/debian/installfor writing: $!\n;
-foreach my $file (keys %install_files){
- $file =~ s/ +//g;
- my $target = $install_files{$file};
+foreach my $target (keys %install_files, keys %create_files) {
+ $target =~ s/ +//g;
my $destination;
my $cnt = 0;
+ if ($target =~ m/^(preinst|postinst|prerm|postrm)$/) {
+$destination = debian/$target;
+ } else {
do {
$destination = install/$cnt;
mkdir $builddir/$destination unless -d $builddir/$destination;
$destination .= / . basename($target);
$cnt++;
} while ( -e $builddir/$destination );
+print INSTALL $destination . dirname($target) . \n;
+ }
+ if (defined $install_files{$target}) {
+my $file = $install_files{$target};
copy $file, $builddir/$destination or
die Cannot copy $file to $builddir/$destination: $!\n;
- print INSTALL $destination . dirname($target) . \n;
+ } else {
+open CREATE, , $builddir/$destination or
+ die Cannot create file $builddir/$destination: $!\n;
+print CREATE $create_files{$target};
+print CREATE \n;
+close CREATE;
+ }
}
close INSTALL;
@@ -106,7 +127,6 @@
die Cannot copy $script to $builddir/debian/$destination: $!\n;
}
-
write_control_file($builddir, \%control);
if ($control{'Changelog'}) {
@@ -156,11 +176,12 @@
sub read_control_file {
my ($builddir, $control, $specific_arch, $file) = @_;
+ my @control = ();
my $in;
open($in, $builddir/debian/control.in) or
die Cannot open control file: $!\n;
- read_control_file_section($in, $control) or
+ read_control_file_section($in, [EMAIL PROTECTED]) or
die error: empty control file\n;
close $in;
@@ -174,6 +195,8 @@
chomp($systemname = qx(hostname --fqdn));
+ %{$control} = @control;
+
$control-{'Maintainer'} = $fullname [EMAIL PROTECTED];
$control-{'Architecture'} = $specific_arch ? 'any' : 'all';
@@ -181,10 +204,24 @@
open($in, $file) or
die Cannot open control file $file: $!\n;
- read_control_file_section($in, $control) or
+ @control = ();
+ read_control_file_section($in, [EMAIL PROTECTED]) or
die error: empty control file\n;
close $in;
+ for (my $i = 0; $i $#control; $i += 2) {
+my $k = $control[$i];
+my $v = $control[$i+1];
+if ($k eq File) {
+ my $vv = [];
+ $vv = $control-{$k} if defined $control-{$k};
+ push @{$vv}, $v;
+ $control-{$k} = $vv;
+} else {
+ $control-{$k} = $v;
+}
+ }
+
# Fix Source: entry
$control-{'Source'} = $control-{'Package'};
@@ -201,17 +238,17 @@
my ($cf,$v);
while ($fh) {
chomp;
-next if (m/^\s*$/ or m/^\s*#/);
+next if (m/^\s*$/ or m/^#/);
#