diff options
author | Michael Scherer <misc@mandriva.com> | 2005-02-07 15:26:52 +0000 |
---|---|---|
committer | Michael Scherer <misc@mandriva.com> | 2005-02-07 15:26:52 +0000 |
commit | 7f164ec85f13801fd62f261085e3bae20be63dde (patch) | |
tree | fbb92f3a7c348da9c13835efe487b4ec771679e5 | |
parent | 50d181e8a5293be4891c43b251716496c885f392 (diff) | |
download | bootsplash-7f164ec85f13801fd62f261085e3bae20be63dde.tar bootsplash-7f164ec85f13801fd62f261085e3bae20be63dde.tar.gz bootsplash-7f164ec85f13801fd62f261085e3bae20be63dde.tar.bz2 bootsplash-7f164ec85f13801fd62f261085e3bae20be63dde.tar.xz bootsplash-7f164ec85f13801fd62f261085e3bae20be63dde.zip |
- do not hardcode path ( buchan idea )
-rwxr-xr-x | rpmbuildupdate | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index d160d48..d310a7e 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -124,6 +124,8 @@ sub fill_global_variable { $log = ""; } $rpm = qq(rpm --define "_topdir $top"); + $config{sourcedir} = `$rpm --eval %_sourcedir`; + chomp( $config{sourcedir}); #"$top/SOURCES"; } @@ -133,7 +135,8 @@ sub build_from_spec { my ($pkg, $version, $release) = split(/ /, $rpm_tag); fill_global_variable($pkg); $spec_path = File::Spec->rel2abs($spec_path); - chdir("$top/SOURCES") or die "Unable to chdir to $top/SOURCES"; + + chdir($config{sourcedir}) or die "Unable to chdir to $config{sourcedir}"; build($spec_path,$pkg,$version,$release,$newversion); } @@ -167,8 +170,8 @@ sub build_from_src { fill_global_variable($pkgrpm); my $found = 0; my ($name, $version, $release); - - chdir("$top/SOURCES") or die "Unable to chdir to $top/SOURCES"; + + chdir($config{sourcedir}) or die "Unable to chdir to $config{sourcedir}"; my $pkgrpm_basename = basename($pkgrpm); if ($pkgrpm_basename =~ /^(.*)-([^-]+)-([^-]+)\.\w+\.rpm/) { @@ -184,8 +187,9 @@ sub build_from_src { } system_die("$rpm -ivh $pkgrpm $log"); - - my $spec_path="../SPECS/$name.spec"; + my $spec_path=`$rpm --eval %_specdir`; + chomp($spec_path); + $spec_path="$spec_path/$name.spec"; build($spec_path, $name, $version, $release, $newversion); } @@ -315,8 +319,7 @@ sub build { } my $basename = basename($_); - - rm_rf("${top}/SOURCES/$basename") if $config{nobuild}; + rm_rf("$config{sourcedir}/$basename") if $config{nobuild}; # GNOME: add the major version to the URL automatically # for example: ftp://ftp://ftp.gnome.org/pub/GNOME/sources/ORbit2/ORbit2-2.10.0.tar.bz2 @@ -343,12 +346,11 @@ sub build { closedir(MP); print "Trying from fedora($basename): $config{fedora}/$pkgrpmrh\n"; - system_die("cd ${top}/SOURCES; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $basename", "Rpm extraction failed"); - - if (! -f "${top}/SOURCES/$basename") { + system_die("cd $config{sourcedir}; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $basename", "Rpm extraction failed"); + if (! -f "$config{sourcedir}/$basename") { (my $bname = $basename) =~ s/bz2/gz/; print "Trying from fedora($bname): $config{fedora}/$pkgrpmrh\n"; - system("cd ${top}/SOURCES; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $bname; bzme $bname", "rpm recompression failed"); + system("cd $config{sourcedir}; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $bname; bzme $bname", "rpm recompression failed"); } } # download from sourceforge mirrors @@ -367,12 +369,11 @@ sub build { } } # download specified url - if (! -f "${top}/SOURCES/$basename") { + if (! -f "$config{sourcedir}/$basename") { fetch($_); } - $found++ if -e $basename; - chmod(0644, "${top}/SOURCES/$basename"); + chmod(0644, "$config{sourcedir}/$basename"); } # some specs have no source ( php ) |