2020-09-27 00:14:46 +00:00
|
|
|
#!/usr/bin/perl
|
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
|
2020-09-27 00:14:46 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2005-05-15 16:46:50 +00:00
|
|
|
die "Missing \$MIRROR variable" unless $ENV{MIRROR};
|
|
|
|
die "Missing \$DI_CODENAME variable" unless $ENV{DI_CODENAME};
|
2006-02-06 10:17:58 -01:00
|
|
|
die "Missing \$BASEDIR variable" unless $ENV{BASEDIR};
|
2009-02-11 23:22:17 -01:00
|
|
|
die "Missing \$ARCHES variable" unless $ENV{ARCHES};
|
|
|
|
|
2020-09-27 00:14:46 +00:00
|
|
|
my $catz = $ENV{BASEDIR} . "/tools/catz";
|
|
|
|
|
2009-02-11 23:22:17 -01:00
|
|
|
# Early exit if we're building a source-only CD
|
|
|
|
exit 0 if $ENV{ARCHES} =~ /^\s*source\s*$/;
|
|
|
|
|
|
|
|
my @ARCHES;
|
|
|
|
if ( $ENV{ARCHES} ) {
|
2014-08-20 13:24:38 +00:00
|
|
|
push @ARCHES, 'i386' if $ENV{ARCHES} =~ /(^|\s)i386(\s|$)/;
|
|
|
|
push @ARCHES, 'amd64' if $ENV{ARCHES} =~ /(^|\s)amd64(\s|$)/;
|
2010-08-20 15:04:23 +00:00
|
|
|
push @ARCHES, grep { !/^(source|i386|amd64)$/ } split /\s+/, $ENV{ARCHES};
|
2009-02-11 23:22:17 -01:00
|
|
|
}
|
|
|
|
@ARCHES = qw{i386 amd64} unless @ARCHES;
|
2005-05-15 16:46:50 +00:00
|
|
|
|
2012-03-05 21:40:51 -01:00
|
|
|
my @VARIANTS;
|
|
|
|
if ( $ENV{VARIANTS} ) {
|
|
|
|
@VARIANTS = split(" ", $ENV{VARIANTS});
|
|
|
|
}
|
2009-08-09 14:32:55 +00:00
|
|
|
|
2003-12-24 16:19:14 -01:00
|
|
|
my $DATE=`date`;
|
|
|
|
chomp $DATE;
|
2008-11-13 22:19:30 -01:00
|
|
|
open(OUT, ">debian-installer") || die "write: $!";
|
2003-12-24 16:19:14 -01:00
|
|
|
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
|
|
|
*
|
- Since amd64 is not on standard debian mirrors, and generate_d-i+k_list
must be runnable on them, make it chack for absence of amd64 Packages
files and add a dummy kernel for amd64. This will need to be manually
kept up-to-date by the amd64 people for now.
- Didn't fix generate_di_list the same way, since doing so would be too
hard. Next time tasks/debian-installer is updated using this script on
a machine w/o the unofficial amd64 archive, the am64 info in the file
will be lost.
- Add DO NOT EDIT warning messages to generated files in cvs.
- Check and revert manual modifications to tasks/base-sarge. This file is
automatically generated and those mods would have been lost:
- Add fileutils to generate_d-i+k_list, "until kernels get fixed",
whatever that means.
- arcboot was already in generate_d-i+k_list.
- Update tasks/debian-installer+kernel using generate_d-i+k_list.
- Sort package lists in tasks/base-sarge to ease comparisons when
updating.
- Update tasks/base-sarge for debootstrap 0.2.45. This includes the
following removals:
- aboot: already listed in debian-installer+kernel
- gcc-3.2-base, libdb2, libgcrypt1, libgnutls7, libident,
libdb2, libtasn1-0: obsolete
- modconf: obsoleted by d-i
- setserial: not base anymore
- slang1: turned into slang1a-utf8
- libident: not needed by base anymore
- lilo: in debian-installer+kernel
- mbr: not installed anymore
- pcmcia-cs: in debian-installer+kernel
- syslinux: not installed
- "filesutils": typo; fileutils in generate_d-i+k_list for m68k
- quik: in debian-installer+kernel
- yaboot: in debian-installer+kernel
- arcboot: in debian-installer+kernel
- delo: in debian-installer+kernel
And the following additions:
- libdb4.2, libgcrypt11, libgcrypt7, libgnutls10, libgnutls11,
libgpg-error0, libtasn1-2: new libraries
- console-tools: now installed by debootstrap even on s390
2005-01-02 22:31:45 -01:00
|
|
|
* DO NOT EDIT THIS FILE, edit the above script
|
|
|
|
*
|
2003-03-08 13:08:00 -01:00
|
|
|
* Last update: $DATE
|
|
|
|
*/
|
|
|
|
EOF
|
|
|
|
|
2020-09-27 00:14:46 +00:00
|
|
|
sub di_ker_abi_to_number ($$$$) {
|
|
|
|
# Make up a version we can compare sensibly from
|
|
|
|
# the version and ABI
|
|
|
|
my $maj = shift;
|
|
|
|
my $min = shift;
|
|
|
|
my $patch = shift;
|
|
|
|
my $abi = shift;
|
|
|
|
my $kernel_ver = ($maj * 1000000000)
|
|
|
|
+ ($min * 1000000)
|
|
|
|
+ ($patch * 1000)
|
|
|
|
+ $abi;
|
|
|
|
return $kernel_ver;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub number_to_di_ker_abi ($) {
|
|
|
|
# Convert back to a useful string
|
|
|
|
my $num = shift;
|
|
|
|
my $maj = int($num / 1000000000);
|
|
|
|
$num -= ($maj * 1000000000);
|
|
|
|
my $min = int($num / 1000000);
|
|
|
|
$num -= ($min * 1000000);
|
|
|
|
my $patch = int($num / 1000);
|
|
|
|
$num -= ($patch * 1000);
|
|
|
|
my $abi = $num;
|
|
|
|
return "$maj.$min.$patch-$abi";
|
|
|
|
}
|
|
|
|
|
2003-12-24 16:19:14 -01:00
|
|
|
my @common_excludes = read_exclude("exclude-udebs");
|
2009-02-11 23:22:17 -01:00
|
|
|
my $mirror_path = "$ENV{MIRROR}/dists/$ENV{DI_CODENAME}";
|
|
|
|
my @components = qw(main);
|
|
|
|
push @components, 'contrib' if $ENV{CONTRIB};
|
|
|
|
push @components, 'non-free' if $ENV{NONFREE};
|
2017-10-08 20:04:03 +00:00
|
|
|
push @components, 'unreleased' if $ENV{UNRELEASED};
|
2009-02-11 23:22:17 -01:00
|
|
|
push @components, 'local' if $ENV{LOCAL};
|
2003-12-24 16:19:14 -01:00
|
|
|
|
|
|
|
foreach my $arch (@ARCHES) {
|
2004-07-11 15:35:36 +00:00
|
|
|
(my $cpparch = $arch) =~ s/-/_/g;
|
2009-02-11 23:22:17 -01:00
|
|
|
my $output = '';
|
|
|
|
for my $component ( @components ) {
|
2016-11-15 08:06:41 -01:00
|
|
|
my $pgz="$mirror_path/$component/debian-installer/binary-$arch/Packages.gz";
|
|
|
|
my $pxz="$mirror_path/$component/debian-installer/binary-$arch/Packages.xz";
|
2017-10-08 20:04:03 +00:00
|
|
|
if ( $component eq 'unreleased' and $ENV{UNRELEASED} ) {
|
|
|
|
$pgz="$ENV{MIRROR}/dists/unreleased/main/debian-installer/binary-$arch/Packages.gz";
|
|
|
|
$pxz="$ENV{MIRROR}/dists/unreleased/main/debian-installer/binary-$arch/Packages.xz";
|
|
|
|
}
|
2009-02-11 23:22:17 -01:00
|
|
|
if ( $component eq 'local' and $ENV{LOCALDEBS} ) {
|
2016-11-15 08:06:41 -01:00
|
|
|
$pgz="$ENV{LOCALDEBS}/dists/$ENV{DI_CODENAME}/local/debian-installer/binary-$arch/Packages.gz";
|
|
|
|
$pxz="$ENV{LOCALDEBS}/dists/$ENV{DI_CODENAME}/local/debian-installer/binary-$arch/Packages.xz";
|
2009-02-11 23:22:17 -01:00
|
|
|
}
|
|
|
|
|
|
|
|
my @exclude = @common_excludes;
|
|
|
|
push @exclude, read_exclude("exclude-udebs-$arch")
|
|
|
|
if -e exclude_path("exclude-udebs-$arch");
|
|
|
|
|
2020-09-27 00:14:46 +00:00
|
|
|
my $pz = $pgz;
|
|
|
|
if (! -f $pz) {
|
|
|
|
$pz = $pxz;
|
|
|
|
}
|
|
|
|
if (! -f $pz) {
|
2016-11-15 08:06:41 -01:00
|
|
|
print "Missing package file for $arch/$component.\n";
|
|
|
|
next;
|
2020-09-27 00:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Two passes here
|
|
|
|
# First, need to find the highest kernel ABI in the archive
|
|
|
|
# Next, list all the udebs that:
|
|
|
|
# 1. are not otherwise excluded
|
|
|
|
# 2. are not kernel driver udebs, OR
|
|
|
|
# are kernel driver udebs with the right kernel ABI
|
|
|
|
|
|
|
|
unless ( open (PZ, "$catz $pz |") ) {
|
|
|
|
warn "failed to read package file $pz: $1";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
my @output_udebs;
|
|
|
|
my %driver_udebs;
|
|
|
|
my $highest_kernel_ver = 0;
|
|
|
|
|
|
|
|
while (defined (my $line = <PZ>)) {
|
|
|
|
chomp $line;
|
|
|
|
if ($line =~ m/^Package: (\S+)/) {
|
|
|
|
my $udeb = $1;
|
|
|
|
if (grep { $udeb =~ /^${_}$/ } @exclude) {
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
if ($udeb =~ m/-modules-([0-9]*)\.([0-9]*)\.([0-9]*)-(\d+)-.*-di/) {
|
|
|
|
my $kernel_ver = di_ker_abi_to_number($1, $2, $3, $4);
|
|
|
|
if ($kernel_ver > $highest_kernel_ver) {
|
|
|
|
$highest_kernel_ver = $kernel_ver;
|
|
|
|
}
|
|
|
|
# Append this driver udeb to a list for that kernel_ver
|
|
|
|
push(@{ $driver_udebs{$kernel_ver} }, $udeb);
|
|
|
|
} else {
|
|
|
|
#print "found non-driver udeb $udeb\n";
|
|
|
|
push @output_udebs, $udeb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close PZ;
|
|
|
|
$output .= "/* First, generic udebs */\n";
|
|
|
|
foreach my $udeb (@output_udebs) {
|
|
|
|
$output .= "$udeb\n";
|
|
|
|
}
|
|
|
|
my $num_this_abi = scalar (@{ $driver_udebs{$highest_kernel_ver}});
|
|
|
|
$output .= "/* Next: $num_this_abi udebs for kernel/ABI version ";
|
|
|
|
$output .= number_to_di_ker_abi($highest_kernel_ver);
|
|
|
|
$output .= " */\n";
|
|
|
|
foreach my $udeb (@{ $driver_udebs{$highest_kernel_ver}}) {
|
|
|
|
$output .= "$udeb\n";
|
|
|
|
}
|
|
|
|
foreach my $key (keys (%driver_udebs)) {
|
|
|
|
if ($key != $highest_kernel_ver) {
|
|
|
|
$num_this_abi = scalar (@{ $driver_udebs{$key}});
|
|
|
|
$output .= "/* IGNORING $num_this_abi udebs for kernel/ABI version ";
|
|
|
|
$output .= number_to_di_ker_abi($key);
|
|
|
|
$output .= " */\n";
|
|
|
|
}
|
|
|
|
}
|
2009-02-11 23:22:17 -01:00
|
|
|
}
|
2016-11-15 08:06:41 -01:00
|
|
|
|
2009-02-11 23:22:17 -01:00
|
|
|
next unless $output;
|
|
|
|
print OUT "#ifdef ARCH_$cpparch\n";
|
|
|
|
print OUT $output;
|
|
|
|
print OUT "#endif /* ARCH_$cpparch */\n";
|
2003-12-24 16:19:14 -01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub read_exclude {
|
|
|
|
my $file=exclude_path(shift);
|
2009-02-11 23:22:17 -01:00
|
|
|
unless ( open (IN, "<$file") ) {
|
|
|
|
warn "failed to read exclude file $file";
|
|
|
|
return;
|
|
|
|
}
|
2003-12-24 16:19:14 -01:00
|
|
|
my @ret;
|
|
|
|
while (<IN>) {
|
|
|
|
chomp;
|
|
|
|
s/^#.*//;
|
|
|
|
next unless length;
|
2009-08-09 14:32:55 +00:00
|
|
|
my ($pkg,@cond) = split(" ", $_);
|
|
|
|
my $skip = 0;
|
|
|
|
foreach my $cond ( @cond ) {
|
|
|
|
if ($cond =~ /^!(.*)/) {
|
|
|
|
$skip = 1 if grep { $_ eq $1 } @VARIANTS;
|
|
|
|
} else {
|
|
|
|
$skip = 1 unless grep { $_ eq $cond } @VARIANTS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
next if $skip;
|
|
|
|
$pkg=quotemeta($pkg);
|
|
|
|
$pkg=~s/\\\*/.*/g;
|
|
|
|
push @ret, $pkg;
|
2003-12-24 16:19:14 -01:00
|
|
|
}
|
|
|
|
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
|
|
|
}
|