Merge branch 'system' into 'master'

make_disc_trees: don't use system() for trivial things

See merge request images-team/debian-cd!2
This commit is contained in:
Steve McIntyre 2019-01-23 23:04:57 +00:00
commit a7328f65da
1 changed files with 7 additions and 5 deletions

View File

@ -9,6 +9,7 @@ use Digest::MD5;
use Digest::SHA; use Digest::SHA;
use File::stat; use File::stat;
use File::Find; use File::Find;
use File::Path qw(make_path remove_tree);
use File::Basename; use File::Basename;
use Compress::Zlib; use Compress::Zlib;
@ -585,7 +586,7 @@ sub check_base_installable {
print LOG "Debootstrap reported error: $error_string\n"; print LOG "Debootstrap reported error: $error_string\n";
die "Debootstrap reported error: $error_string\n"; die "Debootstrap reported error: $error_string\n";
} }
system("rm -rf $tdir/debootstrap_tmp"); remove_tree("$tdir/debootstrap_tmp");
return $ok; return $ok;
} }
@ -865,7 +866,8 @@ sub finish_disc {
$ok += $archok; $ok += $archok;
} }
if ($ok == 0) { if ($ok == 0) {
system("touch $cddir/.disk/base_installable"); open(my $fh, ">>", "$cddir/.disk/base_installable");
close($fh);
print " Found all files needed for debootstrap for all binary arches\n"; print " Found all files needed for debootstrap for all binary arches\n";
} else { } else {
print " $ok files missing for debootstrap, not creating base_installable\n"; print " $ok files missing for debootstrap, not creating base_installable\n";
@ -910,7 +912,7 @@ sub finish_disc {
# And sort; it should make things faster for people checking # And sort; it should make things faster for people checking
# the md5sums, as ISO9660 dirs are sorted alphabetically # the md5sums, as ISO9660 dirs are sorted alphabetically
system("LANG=C sort -uk2 md5sum.txt | grep -v \./md5sum.txt > md5sum.txt.tmp"); system("LANG=C sort -uk2 md5sum.txt | grep -v \./md5sum.txt > md5sum.txt.tmp");
system("mv -f md5sum.txt.tmp md5sum.txt"); rename("md5sum.txt.tmp", "md5sum.txt");
chdir $bdir; chdir $bdir;
if (defined($ENV{'DISC_END_HOOK'})) { if (defined($ENV{'DISC_END_HOOK'})) {
@ -1011,7 +1013,7 @@ sub add_Packages_entry {
msg_ap(0, " Adding $p to $pkgfile(.gz)\n"); msg_ap(0, " Adding $p to $pkgfile(.gz)\n");
if (! -d $pdir) { if (! -d $pdir) {
system("mkdir -p $pdir"); make_path($pdir);
$blocks_added++; $blocks_added++;
} }
@ -1063,7 +1065,7 @@ sub add_trans_desc_entry {
$idir = Packages_dir($dir, $file, $section, $in_backports) . "/i18n"; $idir = Packages_dir($dir, $file, $section, $in_backports) . "/i18n";
if (! -d $idir) { if (! -d $idir) {
system("mkdir -p $idir"); make_path($idir);
$blocks_added++; $blocks_added++;
} }