Remove the checked-in firmware task altogether, as it's not

useful. Generate it when needed using the new script
tools/generate_firmware_task.
This commit is contained in:
Steve McIntyre 2011-06-10 16:21:32 +00:00
parent 3ea05ce326
commit d872cea0c1
3 changed files with 117 additions and 2 deletions

View File

@ -141,6 +141,9 @@ ifneq ($(ARCHES),source)
$(BASEDIR)/tools/update_tasks; \
$(BASEDIR)/tools/generate_di_list; \
$(BASEDIR)/tools/generate_di+k_list
ifeq($(FORCE_FIRMWARE),1)
# Generate firmware task file using the contents of the archive
$(Q)$(BASEDIR)/tools/generate_firmware_task $(ARCHES) $(TASKDIR)/firmware
endif
$(BDIR)/DATE:
$(Q)date '+%Y%m%d' > $(BDIR)/DATE

5
debian/changelog vendored
View File

@ -27,12 +27,13 @@ debian-cd (3.1.6) UNRELEASED; urgency=low
+ Switch from awk to perl makes things much faster too!
+ Make arch handling more generic - instead of having to list all
arches, allow a wildcard and then check for lack of Packages.gz files
* Move the "firmware" task into per-release task dirs like it should
have been to start with.
* tools/make-firmware-image: Rather than use the firmware task which
gets out of date, look for firmware/microcode files directly in the
Packages file. Check for things installing in /lib/firmware, and add
those packages.
* Remove the checked-in firmware task altogether, as it's not
useful. Generate it when needed using the new script
tools/generate_firmware_task.
[ Aurelien Jarno ]
* Add support for hurd-i386. Closes: #619211

111
tools/generate_firmware_task Executable file
View File

@ -0,0 +1,111 @@
#!/usr/bin/perl -w
#
# generate_firmware_task
#
# Work out which firmware packages we need
# Several steps:
#
# 1. Look for packages which contain "firmware" or "microcode" in their package names
# 2. Check each of those packages to see if they contain files in /lib/firmware
# 3. For those that do, output the package name into the firmware task
#
# Copyright Steve McIntyre <93sam@debian.org> 2011
#
# GPL 2
#
use strict;
my ($mirror, $codename, $archlist, $outfile);
my $date;
my $pkgfiles = "";
my ($pkg, $filename);
my %seen;
$codename = $ENV{'CODENAME'};
$mirror = $ENV{'MIRROR'};
$archlist = shift;
$outfile = shift;
if (!defined($codename) || !defined($mirror) ||
!defined($archlist) || !defined($outfile)) {
die "Error in arguments\n";
}
foreach my $arch (split(' ', $archlist)) {
$pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.gz";
}
open (OUT, "> $outfile") or die "Can't open outfile for writing: $!\n";
$date = `date -u`;
chomp $date;
print OUT "/*\n";
print OUT " * 'firmware' task file; generated automatically by generate_firmware_task\n";
print OUT " * for \"$archlist\" on $date\n";
print OUT " * Do not edit - changes will not be preserved\n";
print OUT " */\n";
print "$0: Checking for firmware packages:\n";
open (INPKG, "zcat $pkgfiles |") or die "Can't read input package files: $!\n";
$/ = ''; # Browse by paragraph
sub contains_firmware($$) {
my $count = 0;
open (PKGLISTING, "dpkg --contents $mirror/$filename | grep ' ./lib/firmware/' |") or
die "Can't check package file $filename: $!\n";
while ($_ = <PKGLISTING>) {
$count++;
}
if ($count) {
return 1;
} else {
return 0;
}
}
while (defined($_ = <INPKG>)) {
m/^Package: (\S+)/m and $pkg = $1;
m/^Filename: (\S+)/m and $filename = $1;
if (! ($pkg =~ /(microcode|firmware)/)) {
next;
}
if (!exists $seen{$filename}) {
$seen{$filename} = 1;
if (contains_firmware($mirror, $filename)) {
print " $pkg ($filename)\n";
print OUT "$pkg\n";
}
}
}
close INPKG;
close OUT;
# }
#
# m/Package:
# if (! ($match =~ /^Package: (.*microcode|firmware.*$))/)) {
# print OFILE $match;
# $gz->gzwrite($match) or die "Failed to write $pkgfile.gz: $gzerrno\n";
# }
#}
#
#for PKG in `zcat ${PKG_FILES} | \
# perl -e
# grep-dctrl -Pe '.*(firmware|microcode).*' -s Package -n | sort -u `; do
# FILES=`zcat ${PKG_FILES} | grep-dctrl -PX $PKG -s Filename -n | sort -u`
# for FILE in $FILES; do
# # Don't use "grep -q" here, it causes errors from tar
# if (dpkg --contents ${MIRROR}/${FILE} | grep " ./lib/firmware/" >/dev/null) ; then
# echo "$PKG" >> $OUTFILE
# echo " $PKG ($FILE) contains firmware"
# else
# echo " $PKG ($FILE) does not contain firmware"
# fi
# done
#done