2003-12-24 16:19:14 -01:00
|
|
|
#!/usr/bin/perl -w
|
2003-03-08 13:08:00 -01:00
|
|
|
# Generate a list of packages required for debian-installer
|
2003-05-10 15:16:08 +00:00
|
|
|
# This script makes use of the following variables that need to be preset:
|
2004-03-08 12:43:40 -01:00
|
|
|
# MIRROR, DI_CODENAME, BASEDIR
|
2003-12-24 16:19:14 -01:00
|
|
|
my @ARCHES=qw{alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel
|
|
|
|
powerpc s390 sparc sh};
|
|
|
|
my $DATE=`date`;
|
|
|
|
chomp $DATE;
|
|
|
|
open(OUT, ">debian-installer") || die "write: $!";
|
|
|
|
print OUT << "EOF";
|
|
|
|
/* List of udebs to be included so that debian-installer works fine
|
2003-03-08 13:08:00 -01:00
|
|
|
*
|
|
|
|
* This list can be generated with the command:
|
2003-05-10 15:16:08 +00:00
|
|
|
* ../tools/generate_di_list
|
2003-03-08 13:08:00 -01:00
|
|
|
*
|
|
|
|
* Last update: $DATE
|
|
|
|
*/
|
|
|
|
EOF
|
|
|
|
|
2003-12-24 16:19:14 -01:00
|
|
|
my @common_excludes = read_exclude("exclude-udebs");
|
|
|
|
|
2004-07-11 21:19:39 +00:00
|
|
|
die "Missing \$MIRROR variable" unless $ENV{MIRROR};
|
|
|
|
die "Missing \$DI_CODENAME variable" unless $ENV{DI_CODENAME};
|
|
|
|
|
2003-12-24 16:19:14 -01:00
|
|
|
foreach my $arch (@ARCHES) {
|
2004-07-11 21:19:39 +00:00
|
|
|
my $packagefile="$ENV{MIRROR}/dists/$ENV{DI_CODENAME}/main/debian-installer/binary-$arch/Packages";
|
|
|
|
unless (-f $packagefile) {
|
|
|
|
print "Missing package file for arch $arch.\n";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
(my $cpparch = $arch) =~ s/-/_/g;
|
|
|
|
print OUT "#ifdef ARCH_$cpparch\n";
|
2003-12-24 16:19:14 -01:00
|
|
|
my @exclude = @common_excludes;
|
|
|
|
push @exclude, read_exclude("exclude-udebs-$arch")
|
|
|
|
if -e exclude_path("exclude-udebs-$arch");
|
|
|
|
UDEB: foreach my $udeb (map { chomp; $_ } `grep-dctrl -n -s Package '' $packagefile`) {
|
|
|
|
foreach my $pattern (@exclude) {
|
|
|
|
if ($udeb =~ /^$pattern$/) {
|
|
|
|
next UDEB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print OUT "$udeb\n";
|
|
|
|
}
|
2004-07-11 21:19:39 +00:00
|
|
|
print OUT "#endif /* ARCH_$cpparch */\n";
|
2003-12-24 16:19:14 -01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub read_exclude {
|
|
|
|
my $file=exclude_path(shift);
|
|
|
|
open (IN, "<$file") || warn "failed to read exclude file $file";
|
|
|
|
my @ret;
|
|
|
|
while (<IN>) {
|
|
|
|
chomp;
|
|
|
|
s/^#.*//;
|
|
|
|
next unless length;
|
|
|
|
$_=quotemeta($_);
|
|
|
|
$_=~s/\\\*/.*/g;
|
|
|
|
push @ret, $_;
|
|
|
|
}
|
|
|
|
close IN;
|
|
|
|
return @ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub exclude_path {
|
|
|
|
my $file=shift;
|
2004-03-08 12:43:40 -01:00
|
|
|
return "$ENV{BASEDIR}/data/$ENV{DI_CODENAME}/$file";
|
2003-12-24 16:19:14 -01:00
|
|
|
}
|