open PIPE, "$_[0] |" or die "$_[0]: $!";
my @lines;
foreach (<PIPE>) {
- chomp;
- push @lines, $_;
+ chomp;
+ push @lines, $_;
}
close PIPE;
return @lines;
#print " buildrequires = ", join (",", @buildrequires), "\n";
$srpms{$name} = {
- name => $name,
- version => $version,
- release => $release,
- buildrequires => \@buildrequires,
- filename => $srpm
+ name => $name,
+ version => $version,
+ release => $release,
+ buildrequires => \@buildrequires,
+ filename => $srpm
}
}
my $item = shift;
foreach (@_) {
- return 1 if $item eq $_;
+ return 1 if $item eq $_;
}
0;
}
sub dependency_in
{
- my $dep = shift; # eg. dbus-devel
+ my $dep = shift; # eg. dbus-devel
while ($dep) {
- return $dep if is_member_of ($dep, @_);
- my $newdep = $dep;
- $newdep =~ s/-\w+$//; # eg. dbus-devel -> dbus
- last if $newdep eq $dep;
- $dep = $newdep;
+ return $dep if is_member_of ($dep, @_);
+ my $newdep = $dep;
+ $newdep =~ s/-\w+$//; # eg. dbus-devel -> dbus
+ last if $newdep eq $dep;
+ $dep = $newdep;
}
0;
}
foreach my $name (keys %srpms) {
my @buildrequires = @{$srpms{$name}->{buildrequires}};
@buildrequires =
- grep { $_ = dependency_in ($_, keys %srpms) } @buildrequires;
+ grep { $_ = dependency_in ($_, keys %srpms) } @buildrequires;
$srpms{$name}{buildrequires} = \@buildrequires;
}
my ($fh, $filename) = tempfile ();
foreach my $name (@names) {
- my @buildrequires = @{$srpms{$name}->{buildrequires}};
- foreach (@buildrequires) {
- print $fh "$_ $name\n"
- }
- # Add a self->self dependency. This ensures that any
- # packages which don't have or appear as a dependency of
- # any other package still get built.
- print $fh "$name $name\n"
+ my @buildrequires = @{$srpms{$name}->{buildrequires}};
+ foreach (@buildrequires) {
+ print $fh "$_ $name\n"
+ }
+ # Add a self->self dependency. This ensures that any
+ # packages which don't have or appear as a dependency of
+ # any other package still get built.
+ print $fh "$name $name\n"
}
close $fh;
print 'make chain-build CHAIN="';
foreach $name (@buildorder) {
- my @br = @{$srpms{$name}->{buildrequires}};
-
- # If a BR occurs within the current group, then start the next group.
- my $occurs = 0;
- foreach (@br) {
- if (exists $group{$_}) {
- $occurs = 1;
- last;
+ my @br = @{$srpms{$name}->{buildrequires}};
+
+ # If a BR occurs within the current group, then start the next group.
+ my $occurs = 0;
+ foreach (@br) {
+ if (exists $group{$_}) {
+ $occurs = 1;
+ last;
+ }
}
- }
- if ($occurs) {
- %group = ();
- print ": ";
- }
+ if ($occurs) {
+ %group = ();
+ print ": ";
+ }
- $group{$name} = 1;
- print "$name ";
+ $group{$name} = 1;
+ print "$name ";
}
print "\"\n";
if ($dryrun) {
foreach (@buildorder) {
- print "$_\n";
+ print "$_\n";
}
exit 0
local $_ = $_[0];
if (! -d $_) {
- mkdir ($_, 0755) or die "mkdir $_: $!"
+ mkdir ($_, 0755) or die "mkdir $_: $!"
}
}
my_mkdir "$localrepo/$distro/src";
my_mkdir "$localrepo/$distro/src/SRPMS";
system ("cd $localrepo/$distro/src && rm -rf repodata && createrepo -q .") == 0
- or die "createrepo failed: $?\n";
+ or die "createrepo failed: $?\n";
my_mkdir "$localrepo/$distro/$arch";
my_mkdir "$localrepo/$distro/$arch/RPMS";
my_mkdir "$localrepo/$distro/$arch/logs";
system ("cd $localrepo/$distro/$arch && rm -rf repodata && createrepo -q --exclude 'logs/*rpm' .") == 0
- or die "createrepo failed: $?\n";
+ or die "createrepo failed: $?\n";
}
if (! -d "$localrepo/scratch") {
mkdir "$localrepo/scratch"
- or die "mkdir $localrepo/scratch: $!\nIf you haven't set up a local repository yet, you must read the README file.\n";
+ or die "mkdir $localrepo/scratch: $!\nIf you haven't set up a local repository yet, you must read the README file.\n";
}
system "rm -rf $localrepo/scratch/*";
# around the caching bug in mock/yum.
foreach my $arch (@arches) {
foreach my $distro (@distros) {
- foreach my $name (@buildorder) {
- my $version = $srpms{$name}->{version};
- my $release = $srpms{$name}->{release};
- my $srpm_filename = $srpms{$name}->{filename};
-
- $release =~ s/\.fc?\d+$//; # "1.fc9" -> "1"
-
- # Does the built (binary) package exist already?
- my $pattern = "$localrepo/$distro/$arch/RPMS/$name-$version-$release.*.rpm";
- #print "pattern = $pattern\n";
- my @binaries = glob $pattern;
-
- if (@binaries == 0)
- {
- # Rebuild the package.
- print "*** building $name-$version-$release $arch $distro ***\n";
-
- createrepo ($arch, $distro);
-
- my $scratchdir = "$localrepo/scratch/$name-$distro-$arch";
- mkdir $scratchdir;
-
- if (system ("mock -r $distro-$arch$suffix --resultdir $scratchdir $srpm_filename") == 0) {
- # Build was a success so move the final RPMs into the
- # mock repo for next time.
- system ("mv $scratchdir/*.src.rpm $localrepo/$distro/src/SRPMS") == 0 or die "mv";
- system ("mv $scratchdir/*.rpm $localrepo/$distro/$arch/RPMS") == 0 or die "mv";
- my_mkdir "$localrepo/$distro/$arch/logs/$name-$version-$release";
- system ("mv $scratchdir/*.log $localrepo/$distro/$arch/logs/$name-$version-$release/") == 0 or die "mv";
- system "rm -rf $scratchdir";
-
- createrepo ($arch, $distro);
-
+ foreach my $name (@buildorder) {
+ my $version = $srpms{$name}->{version};
+ my $release = $srpms{$name}->{release};
+ my $srpm_filename = $srpms{$name}->{filename};
+
+ $release =~ s/\.fc?\d+$//; # "1.fc9" -> "1"
+
+ # Does the built (binary) package exist already?
+ my $pattern = "$localrepo/$distro/$arch/RPMS/$name-$version-$release.*.rpm";
+ #print "pattern = $pattern\n";
+ my @binaries = glob $pattern;
+
+ if (@binaries == 0)
+ {
+ # Rebuild the package.
+ print "*** building $name-$version-$release $arch $distro ***\n";
+
+ createrepo ($arch, $distro);
+
+ my $scratchdir = "$localrepo/scratch/$name-$distro-$arch";
+ mkdir $scratchdir;
+
+ if (system ("mock -r $distro-$arch$suffix --resultdir $scratchdir $srpm_filename") == 0) {
+ # Build was a success so move the final RPMs into the
+ # mock repo for next time.
+ system ("mv $scratchdir/*.src.rpm $localrepo/$distro/src/SRPMS") == 0 or die "mv";
+ system ("mv $scratchdir/*.rpm $localrepo/$distro/$arch/RPMS") == 0 or die "mv";
+ my_mkdir "$localrepo/$distro/$arch/logs/$name-$version-$release";
+ system ("mv $scratchdir/*.log $localrepo/$distro/$arch/logs/$name-$version-$release/") == 0 or die "mv";
+ system "rm -rf $scratchdir";
+
+ createrepo ($arch, $distro);
+
+ }
+ else {
+ push @errors, "$name-$distro-$arch$suffix";
+ print STDERR "Build failed, return code $?\nLeaving the logs in $scratchdir\n";
+ exit 1 unless $keepgoing;
+ }
+ }
+ else
+ {
+ print "skipping $name-$version-$release $arch $distro\n";
+ }
}
- else {
- push @errors, "$name-$distro-$arch$suffix";
- print STDERR "Build failed, return code $?\nLeaving the logs in $scratchdir\n";
- exit 1 unless $keepgoing;
- }
- }
- else
- {
- print "skipping $name-$version-$release $arch $distro\n";
- }
- }
}
}