#!/usr/bin/perl die "usage: create base_dir rpm_list\n" unless $#ARGV == 1; # How to reach Netwinder.org's FTP area: $base_dir = shift; die "invalid base_dir specified\n" unless (-d $base_dir); # The list of RPMS to install: $rpm_list = shift; die "invalid rpm_list specified\n" unless (-f $rpm_list); open LIST, "<$rpm_list"; while ($line = ) { chomp $line; # Skip comments next if ($line =~ /^\s*#/); # Do magic path expansion $line = `./magic $line`; chomp $line; # Strip out options like --nodeps and --force $rpm = $line; $rpm =~ s/\.rpm.*/\.rpm/; # Find SRPM for this RPM $srpm = `rpm -q --qf '%{SOURCERPM}' -p $base_dir/$rpm`; $rpm =~ m#[^/]+$#; $srpm = "$`$srpm"; $srpm =~ s/RPMS/SRPMS/; print "Building $srpm\n"; die "Missing RPM: $rpm\n" unless (-f "$base_dir/$rpm"); die "Missing SRPM: $srpm\n" unless (-f "$base_dir/$srpm"); $rc = system ("rpm --rebuild --root=$build_dir -i $base_dir/$srpm"); } close LIST;