* Significant cleanup of list2cds. Closes: #451237
This commit is contained in:
parent
eeb3b9abfc
commit
4c2837c737
5
Makefile
5
Makefile
|
@ -17,9 +17,6 @@
|
|||
ifndef VERBOSE_MAKE
|
||||
Q=@
|
||||
endif
|
||||
ifndef SIZELIMIT
|
||||
SIZELIMIT=2000000000000
|
||||
endif
|
||||
ifndef TASK
|
||||
TASK=$(BASEDIR)/tasks/Debian_$(CODENAME)
|
||||
endif
|
||||
|
@ -361,7 +358,7 @@ $(BDIR)/list.exclude: $(BDIR)/rawlist-exclude
|
|||
image-trees: ok genlist
|
||||
# Use list2cds to do the dependency sorting
|
||||
$(Q)for ARCH in $(ARCHES_NOSRC); do \
|
||||
ARCH=$$ARCH $(list2cds) $(BDIR)/list $(SIZELIMIT); \
|
||||
ARCH=$$ARCH $(list2cds) $(BDIR)/list; \
|
||||
done
|
||||
$(Q)if [ "$(SOURCEONLY)"x = "yes"x ] ; then \
|
||||
$(grab_source_list) $(BDIR) $(ADIR) $(BDIR)/list $(BDIR)/packages; \
|
||||
|
|
|
@ -72,7 +72,10 @@ debian-cd (3.0.4) UNRELEASED; urgency=low
|
|||
if there is no Packages file for the local section. Create an empty Packages
|
||||
file if one is missing.
|
||||
|
||||
-- Frans Pop <fjp@debian.org> Sun, 06 Jan 2008 00:44:19 +0100
|
||||
[ Steve McIntyre ]
|
||||
* Significant cleanup of list2cds. Closes: #451237
|
||||
|
||||
-- Frans Pop <fjp@debian.org> Mon, 17 Dec 2007 21:54:11 +0100
|
||||
|
||||
debian-cd (3.0.3) unstable; urgency=low
|
||||
|
||||
|
|
103
tools/list2cds
103
tools/list2cds
|
@ -3,16 +3,15 @@
|
|||
# Copyright 1999 Raphaël Hertzog <hertzog@debian.org>
|
||||
# See the README file for the license
|
||||
#
|
||||
# This script takes 2 arguments on input :
|
||||
# This script takes 1 argument on input :
|
||||
# - a filename listing all the packages to include
|
||||
# - a size-limit for each CD
|
||||
#
|
||||
# and it sorts those packages such that dependencies are met in order
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my $list = shift;
|
||||
my $deflimit = $ENV{'SIZELIMIT'} || shift || 639631360;
|
||||
my $limit = $ENV{'SIZELIMIT1'} || $deflimit;
|
||||
|
||||
my $nonfree = $ENV{'NONFREE'} || 0;
|
||||
my $extranonfree = $ENV{'EXTRANONFREE'} || 0;
|
||||
|
@ -21,7 +20,6 @@ my $complete = $ENV{'COMPLETE'} || 0;
|
|||
my $exclude = "$list.exclude";
|
||||
my $norecommends = $ENV{'NORECOMMENDS'} || 0;
|
||||
my $nosuggests = $ENV{'NOSUGGESTS'} || 1;
|
||||
my $maxcds = $ENV{'MAXCDS'} || 0;
|
||||
|
||||
my $apt = "$ENV{'BASEDIR'}/tools/apt-selection";
|
||||
my $adir = "$ENV{'APTTMP'}/$ENV{'CODENAME'}-$ENV{'ARCH'}";
|
||||
|
@ -29,6 +27,8 @@ my $arch = "$ENV{'ARCH'}";
|
|||
my $dir = "$ENV{'TDIR'}/$ENV{'CODENAME'}";
|
||||
my $verbose = $ENV{'VERBOSE'} || 0;
|
||||
|
||||
my @output;
|
||||
|
||||
$| = 1; # Autoflush for debugging
|
||||
|
||||
open(LOG, ">$dir/log.list2cds.$arch")
|
||||
|
@ -119,7 +119,7 @@ foreach (keys %excluded) {
|
|||
close (STATS);
|
||||
|
||||
# Browse the list of packages to include
|
||||
my ($total_size, $cd_size, $size, $cd) = (0, 0, 0, 1);
|
||||
my ($output_size, $size) = (0, 0, 0);
|
||||
my %cds;
|
||||
|
||||
# Generate a dependency tree for each package
|
||||
|
@ -165,7 +165,7 @@ while (defined($_ = <STATUS>)) {
|
|||
add_package($p, ! $norecommends, ! $nosuggests);
|
||||
}
|
||||
close STATUS;
|
||||
msg(0, " S/R/I/B packages take $cd_size bytes\n");
|
||||
msg(0, " S/R/I/B packages take $output_size bytes\n");
|
||||
|
||||
# Now start to look for packages wanted by the user ...
|
||||
msg(0, " Adding the rest of the requested packages\n");
|
||||
|
@ -187,14 +187,14 @@ while (defined($_=<LIST>)) {
|
|||
# nevertheless ... this may be removed once the udebs have a
|
||||
# better depencency system
|
||||
if ($packages{$_}{"IsUdeb"}) {
|
||||
add_to_cd($cd, $packages{$_}{"Size"}, [$_]);
|
||||
add_to_output($packages{$_}{"Size"}, [$_]);
|
||||
} else {
|
||||
add_package ($_, ! $norecommends, ! $nosuggests);
|
||||
}
|
||||
}
|
||||
close LIST;
|
||||
|
||||
msg(0, " Now up to $cd_size bytes\n");
|
||||
msg(0, " Now up to $output_size bytes\n");
|
||||
# All requested packages have been included
|
||||
# But we'll continue to add if $complete was requested
|
||||
if ($complete) {
|
||||
|
@ -277,7 +277,6 @@ if ($extranonfree and (! $nonfree))
|
|||
}
|
||||
}
|
||||
|
||||
# msg(0, "CD $cd will only be filled with $cd_size bytes ...\n");
|
||||
}
|
||||
|
||||
# Remove old files
|
||||
|
@ -285,26 +284,17 @@ foreach (glob("$dir/*.packages*")) {
|
|||
unlink $_;
|
||||
}
|
||||
|
||||
# Now write the lists down
|
||||
my $numcds=0;
|
||||
foreach (sort { $a <=> $b } keys %cds) {
|
||||
if ($maxcds && $numcds+1 > $maxcds) {
|
||||
msg(0, "Stopping at CD $numcds\n");
|
||||
last;
|
||||
}
|
||||
$numcds++;
|
||||
|
||||
my $count = 0;
|
||||
open(CDLIST, "> $dir/packages.$arch")
|
||||
|| die "Can't write in $dir/$_.packages.$arch: $!\n";
|
||||
foreach (@{$cds{$_}}) {
|
||||
my $component = $packages{$_}{"Component"};
|
||||
print CDLIST "$arch:$component:$_\n";
|
||||
$count++;
|
||||
}
|
||||
close CDLIST;
|
||||
msg(0, "Done: processed/sorted $count packages, total size $cd_size bytes.\n");
|
||||
# Now write the list down
|
||||
my $count = 0;
|
||||
open(CDLIST, "> $dir/packages.$arch")
|
||||
|| die "Can't write in $dir/$_.packages.$arch: $!\n";
|
||||
foreach (@output) {
|
||||
my $component = $packages{$_}{"Component"};
|
||||
print CDLIST "$arch:$component:$_\n";
|
||||
$count++;
|
||||
}
|
||||
close CDLIST;
|
||||
msg(0, "Done: processed/sorted $count packages, total size $output_size bytes.\n");
|
||||
|
||||
close LOG;
|
||||
|
||||
|
@ -481,23 +471,7 @@ sub add_package {
|
|||
|
||||
# All packages are ok, now check for the size issue
|
||||
$size = get_size (\@dep);
|
||||
|
||||
# Creation of a new CD when needed
|
||||
if ($cd_size + $size > $limit) {
|
||||
my $try_size = $cd_size + $size;
|
||||
msg(0, "CD $cd filled with $cd_size bytes ... ",
|
||||
"(limit was $limit, would have taken $try_size)\n");
|
||||
$cd++;
|
||||
$cd_size = 0;
|
||||
# New limit
|
||||
$limit = $ENV{"SIZELIMIT$cd"} || $deflimit;
|
||||
msg(2, "Limit for CD $cd is $limit.\n");
|
||||
|
||||
# Unexclude packages
|
||||
unexclude ($cd);
|
||||
}
|
||||
|
||||
add_to_cd ($cd, $size, \@dep);
|
||||
add_to_output ($size, \@dep);
|
||||
}
|
||||
|
||||
sub accepted {
|
||||
|
@ -679,44 +653,19 @@ sub check_list {
|
|||
return ($fail ? $ok : 1);
|
||||
}
|
||||
|
||||
# Add packages to the current CD number $cd
|
||||
sub add_to_cd {
|
||||
my $cd = shift;
|
||||
# Add packages to the output list
|
||||
sub add_to_output {
|
||||
my $size = shift;
|
||||
my $ref = shift;
|
||||
|
||||
msg(2, " \$cd_size = $cd_size, \$size = $size\n");
|
||||
msg(2, " \$output_size = $output_size, \$size = $size\n");
|
||||
|
||||
$cd_size += $size;
|
||||
$total_size += $size;
|
||||
$output_size += $size;
|
||||
|
||||
foreach my $pkg (@{$ref}) {
|
||||
$included{$pkg} = $cd;
|
||||
$included{$pkg} = 1;
|
||||
}
|
||||
$cds{$cd} = [] if not ref $cds{$cd};
|
||||
msg(2, " Adding @{$ref} to CD $cd ...\n");
|
||||
push(@{$cds{$cd}}, @{$ref});
|
||||
}
|
||||
|
||||
# Unexclude packages before given CD is started
|
||||
sub unexclude {
|
||||
my $cd = shift;
|
||||
my $unexclude = $ENV{"UNEXCLUDE$cd"} || "$list.unexclude$cd";
|
||||
|
||||
if (-e $unexclude) {
|
||||
open (UNEXCL, "< $unexclude") || die "Can't open $unexclude : $!\n";
|
||||
while (defined($_=<UNEXCL>)) {
|
||||
chomp;
|
||||
if (not exists $packages{$_}) {
|
||||
msg(1, "Package '$_' is in unexcluded but " .
|
||||
"doesn't exist. Ignored.\n");
|
||||
next;
|
||||
}
|
||||
$excluded{$_} = 0;
|
||||
msg(1, "Unexcluding package '$_'\n");
|
||||
}
|
||||
close UNEXCL;
|
||||
}
|
||||
push(@output, @{$ref});
|
||||
}
|
||||
|
||||
sub yesno {
|
||||
|
|
Loading…
Reference in New Issue