Add support for creating firmware patterns at build time
Using the new generate_firmware_patterns script, generate a patterns file in /firmware/dep11/<package>.patterns as we add a firmware package onto media. Deal with size changes as these are added/removed, and add them to the md5sum.txt file on media too.
This commit is contained in:
parent
f7e973a181
commit
4d4399012d
|
@ -910,7 +910,7 @@ sub finish_disc {
|
||||||
print " Finishing off md5sum.txt\n";
|
print " Finishing off md5sum.txt\n";
|
||||||
# Just md5 the bits we won't have seen already
|
# Just md5 the bits we won't have seen already
|
||||||
open(MD5LIST, ">>md5sum.txt") or die "Failed to open md5sum.txt file: $!\n";
|
open(MD5LIST, ">>md5sum.txt") or die "Failed to open md5sum.txt file: $!\n";
|
||||||
find (\&md5_files_for_md5sum, ("./.disk", "./dists"));
|
find (\&md5_files_for_md5sum, ("./.disk", "./dists", "./firmware/dep11"));
|
||||||
close(MD5LIST);
|
close(MD5LIST);
|
||||||
|
|
||||||
# And sort; it should make things faster for people checking
|
# And sort; it should make things faster for people checking
|
||||||
|
@ -1064,8 +1064,8 @@ sub add_trans_desc_entry {
|
||||||
|
|
||||||
m/^Package: (\S+)/m and $p = $1;
|
m/^Package: (\S+)/m and $p = $1;
|
||||||
m/^Section: (\S+)/m and $section = $1;
|
m/^Section: (\S+)/m and $section = $1;
|
||||||
|
|
||||||
m/^Filename: (\S+)/mi and $file = $1;
|
m/^Filename: (\S+)/mi and $file = $1;
|
||||||
|
|
||||||
$idir = Packages_dir($dir, $file, $section, $in_backports) . "/i18n";
|
$idir = Packages_dir($dir, $file, $section, $in_backports) . "/i18n";
|
||||||
|
|
||||||
if (! -d $idir) {
|
if (! -d $idir) {
|
||||||
|
@ -1165,6 +1165,62 @@ sub add_md5_entry {
|
||||||
return $blocks_added;
|
return $blocks_added;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add sym-links and pattern files for firmware packages
|
||||||
|
sub add_firmware_stuff {
|
||||||
|
my $dir = shift;
|
||||||
|
my $arch = shift;
|
||||||
|
my $in_backports = shift;
|
||||||
|
local $_ = shift;
|
||||||
|
my ($p, $file, $section, $dist, $dep11_dir);
|
||||||
|
my $blocks_added = 0;
|
||||||
|
my @args = ("$basedir/tools/generate_firmware_patterns",
|
||||||
|
"--output-dir", "$dir/firmware/dep11");
|
||||||
|
|
||||||
|
m/^Package: (\S+)/m and $p = $1;
|
||||||
|
m/^Section: (\S+)/m and $section = $1;
|
||||||
|
m/^Filename: (\S+)/mi and $file = $1;
|
||||||
|
|
||||||
|
if ($file =~ /\/main\//) {
|
||||||
|
$dist = "main";
|
||||||
|
} elsif ($file =~ /\/contrib\//) {
|
||||||
|
$dist = "contrib";
|
||||||
|
} elsif ($file =~ /\/non-free\//) {
|
||||||
|
$dist = "non-free";
|
||||||
|
} else {
|
||||||
|
$dist = "local";
|
||||||
|
}
|
||||||
|
|
||||||
|
$dep11_dir = "$mirror/dists/$codename/$dist/dep11";
|
||||||
|
if ($in_backports) {
|
||||||
|
$dep11_dir = "$mirror/dists/$codename-backports/$dist/dep11";
|
||||||
|
}
|
||||||
|
|
||||||
|
msg_ap(0, "Symlink fw package $p into /firmware\n");
|
||||||
|
symlink("../$file", "$dir/firmware/" . basename($file));
|
||||||
|
msg_ap(0, "Symlink ../$file $dir/firmware/.\n");
|
||||||
|
if (! -d "$dir/firmware") {
|
||||||
|
mkdir "$dir/firmware" or die "mkdir $dir/firmware failed $!\n";
|
||||||
|
mkdir "$dir/firmware/dep11" or die "mkdir $dir/firmware/dep11 failed $!\n";
|
||||||
|
$blocks_added += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cope with maybe having the patterns file already
|
||||||
|
# (e.g. multi-arch), in which case we'll replace it here
|
||||||
|
if (-f "$dir/firmware/dep11/$p.patterns") {
|
||||||
|
$blocks_added -= get_file_blocks("$dir/firmware/dep11/$p.patterns");
|
||||||
|
}
|
||||||
|
|
||||||
|
msg_ap(0, "(Maybe) generate fw pattern file $dir/firmware/dep11/$p.patterns\n");
|
||||||
|
push(@args, "--package", "$p");
|
||||||
|
push(@args, "$dep11_dir/Components-$arch.yml.gz");
|
||||||
|
system(@args) == 0 or die "generate_firmware_patterns failed: $?";
|
||||||
|
if (-f "$dir/firmware/dep11/$p.patterns") {
|
||||||
|
$blocks_added += get_file_blocks("$dir/firmware/dep11/$p.patterns");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $blocks_added;
|
||||||
|
}
|
||||||
|
|
||||||
# Roll back the results of add_Packages_entry()
|
# Roll back the results of add_Packages_entry()
|
||||||
sub remove_Packages_entry {
|
sub remove_Packages_entry {
|
||||||
my $dir = shift;
|
my $dir = shift;
|
||||||
|
@ -1364,6 +1420,29 @@ sub remove_md5_entry {
|
||||||
return $blocks_removed;
|
return $blocks_removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub remove_firmware_stuff {
|
||||||
|
my $dir = shift;
|
||||||
|
my $arch = shift;
|
||||||
|
my $in_backports = shift;
|
||||||
|
my ($p, $file);
|
||||||
|
local $_ = shift;
|
||||||
|
my $blocks_removed = 0;
|
||||||
|
|
||||||
|
m/^Package: (\S+)/mi and $p = $1;
|
||||||
|
m/^Filename: (\S+)/mi and $file = $1;
|
||||||
|
|
||||||
|
msg_ap(0, "Remove symlink for fw package $p in /firmware\n");
|
||||||
|
unlink("$dir/firmware/" . basename($file));
|
||||||
|
|
||||||
|
if (-f "$dir/firmware/dep11/$p.patterns") {
|
||||||
|
$blocks_removed += get_file_blocks("$dir/firmware/dep11/$p.patterns");
|
||||||
|
msg_ap(0, "Remove $dir/firmware/dep11/$p.patterns\n");
|
||||||
|
unlink("$dir/firmware/dep11/$p.patterns");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $blocks_removed;
|
||||||
|
}
|
||||||
|
|
||||||
sub get_file_blocks {
|
sub get_file_blocks {
|
||||||
my $realfile = shift;
|
my $realfile = shift;
|
||||||
my $st;
|
my $st;
|
||||||
|
@ -1432,10 +1511,9 @@ sub add_packages {
|
||||||
if (!($arch eq "source")) {
|
if (!($arch eq "source")) {
|
||||||
$total_blocks -= remove_trans_desc_entry($dir, $arch, $in_backports, $package_info);
|
$total_blocks -= remove_trans_desc_entry($dir, $arch, $in_backports, $package_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($firmware_package{$pkgname}) {
|
if ($firmware_package{$pkgname}) {
|
||||||
msg_ap(0, "Remove symlink for fw package $pkgname in /firmware\n");
|
$total_blocks -= remove_firmware_stuff($dir, $arch, $in_backports, $package_info);
|
||||||
unlink("$dir/firmware/" . basename($file));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $file (@files) {
|
foreach my $file (@files) {
|
||||||
|
@ -1485,12 +1563,7 @@ sub add_packages {
|
||||||
$total_blocks += good_link ($realfile, "$dir/$file");
|
$total_blocks += good_link ($realfile, "$dir/$file");
|
||||||
msg_ap(0, " Linked $dir/$file\n");
|
msg_ap(0, " Linked $dir/$file\n");
|
||||||
if ($firmware_package{$pkgname}) {
|
if ($firmware_package{$pkgname}) {
|
||||||
msg_ap(0, "Symlink fw package $pkgname into /firmware\n");
|
$total_blocks += add_firmware_stuff($dir, $arch, $in_backports, $package_info);
|
||||||
if (! -d "$dir/firmware") {
|
|
||||||
mkdir "$dir/firmware" or die "symlink failed $!\n";
|
|
||||||
}
|
|
||||||
symlink("../$file", "$dir/firmware/" . basename($file));
|
|
||||||
msg_ap(0, "Symlink ../$file $dir/firmware/.\n");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg_ap(0, " $dir/$file already linked in\n");
|
msg_ap(0, " $dir/$file already linked in\n");
|
||||||
|
|
Loading…
Reference in New Issue