Skip to content

Commit

Permalink
Merge pull request #14705 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] postprocess dpkg-scanpackages output
  • Loading branch information
mlschroe committed Jul 25, 2023
2 parents ad913c6 + ba6b106 commit fc2e67e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/backend/bs_publish
Original file line number Diff line number Diff line change
Expand Up @@ -955,13 +955,30 @@ sub compress_and_rename {
}
}

sub fixup_scanpackages_output {
my ($file) = @_;
return unless -s $file;
my $f;
open ($f, '<', $file) || die("$file: $!\n");
my $f2;
open ($f2, '>', "$file.tmp") || die("$file.tmp: $!\n");
while (<$f>) {
s/^Filename: \.\//Filename: /;
print $f2 $_ or die("$file.tmp: $!\n");
}
close($f);
close($f2) || die("$file.tmp: $!\n");
rename("$file.tmp", $file) || die("rename $file.tmp $file: $!\n");
}

sub createrepo_debian {
my ($extrep, $projid, $repoid, $data, $options) = @_;

print " running dpkg-scanpackages\n";
if (qsystem('chdir', $extrep, 'stdout', 'Packages.new', 'dpkg-scanpackages', '-m', '.', '/dev/null')) {
die(" dpkg-scanpackages failed: $?\n");
}
fixup_scanpackages_output("$extrep/Packages.new");
compress_and_rename("$extrep/Packages.new", "$extrep/Packages");

print " running dpkg-scansources\n";
Expand All @@ -976,6 +993,7 @@ sub createrepo_debian {
if (qsystem('chdir', $udebs, 'stdout', 'Packages.new', 'dpkg-scanpackages', '-t', 'udeb', '-m', '..', '/dev/null')) {
die(" dpkg-scanpackages for udebs failed: $?\n");
}
fixup_scanpackages_output("$udebs/Packages.new");
compress_and_rename("$udebs/Packages.new", "$udebs/Packages");

if ( -e "$udebs/Packages") {
Expand Down

0 comments on commit fc2e67e

Please sign in to comment.