#!/usr/bin/perl
#
+use strict;
+use warnings;
+
BEGIN {
my ($wd) = $0 =~ m-(.*)/- ;
$wd ||= '.';
+ my $virtual_env = $ENV{VIRTUAL_ENV} || '';
unshift @INC, "$wd/build";
unshift @INC, "$wd";
- unshift @INC, "$ENV{'VIRTUAL_ENV'}/usr/lib/build"
+ unshift @INC, "$virtual_env/usr/lib/build"
}
-use strict;
use YAML qw(LoadFile);
-use warnings;
use threads;
use threads::shared;
use File::Find ();
if ( $exclude_from_file ne "" && -e $exclude_from_file ) {
debug("using $exclude_from_file for package exclusion");
- open FILE, "<", $exclude_from_file or die $!;
- @exclude = <FILE>;
+ open my $file, '<', $exclude_from_file or die $!;
+ @exclude = <$file>;
chomp(@exclude);
- close(FILE);
+ close($file);
}
}else{
$commit_id = $commit;
}
- open(GIT,"git --git-dir $base/.git rev-parse $commit_id|") || die "Failed: $!\n";
- while (my $current_rev = <GIT>) {
+ open(my $git, '-|', "git --git-dir $base/.git rev-parse $commit_id") || die "Failed: $!\n";
+ while (my $current_rev = <$git>) {
chomp($current_rev);
$cache_rev = $current_rev;
if ( my_system("grep -rq $current_rev $cache_path") == 0 ) {
- open(GREP,"grep -rl $current_rev $cache_path |") || die "Failed: $!\n";
- while ( <GREP> ) {
+ open(my $grep, '-|', "grep -rl $current_rev $cache_path") || die "Failed: $!\n";
+ while ( <$grep> ) {
chomp;
$old_base = $_;
}
- close(GREP);
+ close($grep);
$skip = 1;
}
my @lines = ();
+ my $rev;
if ( -e "$cache_path/$pkg_name-$pkg_version-$pkg_release" ) {
- open (REV, "< $cache_path/$pkg_name-$pkg_version-$pkg_release");
- @lines = <REV>;
+ open($rev, '<', "$cache_path/$pkg_name-$pkg_version-$pkg_release");
+ @lines = <$rev>;
} else {
- open (REV, "> $cache_path/$pkg_name-$pkg_version-$pkg_release");
+ open($rev, '>', "$cache_path/$pkg_name-$pkg_version-$pkg_release");
}
foreach my $old_rev(@lines) {
if ( $current_rev eq $old_rev ) {
$skip = 1;
}
}
- close (REV);
+ close($rev);
}
- close(GIT);
+ close($git);
} else {
debug("not a git repo: $base/.git!!");
}
}
# Set cache_rev as 'include-all' if --include-all specified
$cache_rev = "include-all" if ($includeall == 1);
- open (REV1, "+> $cache_path/$pkg_name-$pkg_version-$pkg_release");
- print REV1 $cache_rev . "\n";
- close (REV1);
+ open(my $rev1, "+>", "$cache_path/$pkg_name-$pkg_version-$pkg_release");
+ print $rev1 $cache_rev . "\n";
+ close($rev1);
push(@packs, "$pkg_path/$pkg_name-$pkg_version-$pkg_release/$spec_file");
} else {
unlink "$cache_path/$pkg_name-$pkg_version-$pkg_release";
my %packs_arch;
my %packs_done;
- open(F, '<', $rpmdeps) || die("$rpmdeps: $!\n");
+ open(my $fh, '<', $rpmdeps) || die("$rpmdeps: $!\n");
# WARNING: the following code assumes that the 'I' tag comes last
my ($pkgF, $pkgP, $pkgR);
- while(<F>) {
+ while(<$fh>) {
chomp;
if (/^F:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
$pkgF = $2;
%packs_done = %ids;
}
}
- close F;
+ close $fh;
for my $arch (@archs) {
$packs{$_} ||= "$_.$arch" for @{$packs_arch{$arch} || []};
return $x;
}
}
- return undef;
+ return;
}
sub update_pkgdeps
my %packs = parse_packs($config, @packs);
if ($binarylist ne "" && -e $binarylist ) {
- open FILE, "<", $binarylist or die $!;
- my @bins = <FILE>;
+ open my $file, "<", $binarylist or die $!;
+ my @bins = <$file>;
chomp(@bins);
- close(FILE);
+ close($file);
my @alldeps = ();
foreach my $b (@bins) {
next if $b eq "";
#print "\n";
foreach (@allbins) {
my $so = source_of($_, %packs);
- if ( defined($so)) {
+ if (defined($so)) {
push(@tobuild, $so);
}
}