diff options
author | Michael Scherer <misc@mandriva.com> | 2005-04-01 17:13:45 +0000 |
---|---|---|
committer | Michael Scherer <misc@mandriva.com> | 2005-04-01 17:13:45 +0000 |
commit | 08c7daf822090eff49698d2e97930aacf4aadae9 (patch) | |
tree | a930424a5c42fbb2bfebfd98de65a9a652826ed8 | |
parent | c99be8a19c4ad1ce8c46de299552d0604d9c19f6 (diff) | |
download | bootsplash-08c7daf822090eff49698d2e97930aacf4aadae9.tar bootsplash-08c7daf822090eff49698d2e97930aacf4aadae9.tar.gz bootsplash-08c7daf822090eff49698d2e97930aacf4aadae9.tar.bz2 bootsplash-08c7daf822090eff49698d2e97930aacf4aadae9.tar.xz bootsplash-08c7daf822090eff49698d2e97930aacf4aadae9.zip |
- use perl-hdlist
- fix for %( macro
- do not mess with Tab
- add a cvs id
-rwxr-xr-x | rpmbuildupdate | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index 1cae173..4a15c8e 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -15,7 +15,7 @@ # TODO # do not hardcode sudo urpmi command ( to use --deps on cluster ) # rework configuration option -# add debian url ( like gnome or rh ) +# add debian url ( like gnome or rh ) => cannot be done i think # use more Hdlist ( see Hdlist->build() ) use strict; @@ -115,7 +115,7 @@ sub fetch_http { sub fill_global_variable { my ($pkgrpm) = @_; - $top = $config{top} || `rpm --eval '%_topdir'`; + $top = $config{top} || Hdlist::expand('%_topdir'); chomp($top); if ($config{log}) { my $basename = basename($pkgrpm); @@ -126,14 +126,17 @@ sub fill_global_variable { } else { $log = ""; } + #TODO replace with perl-hdlist + Hdlist::add_macro("_topdir $top"); $rpm = qq(rpm --define "_topdir $top"); - $config{sourcedir} = `$rpm --eval %_sourcedir`; + $config{sourcedir} = Hdlist::expand('%_sourcedir'); chomp( $config{sourcedir}); #"$top/SOURCES"; } sub build_from_spec { my ($spec_path, $newversion) = @_; + #TODO replace with perl-hdlist binding my $rpm_tag = (split(/\n/,`rpm -q $config{rpmoption} --queryformat '%{NAME} %{VERSION} %{RELEASE}\n' --specfile $spec_path`))[0]; my ($pkg, $version, $release) = split(/ /, $rpm_tag); fill_global_variable($pkg); @@ -189,10 +192,8 @@ sub build_from_src { system_die("sudo /usr/sbin/urpmi --auto --force $pkgrpm $log"); } - system_die("$rpm -ivh $pkgrpm $log"); - my $spec_path=`$rpm --eval %_specdir`; - chomp($spec_path); - $spec_path="$spec_path/$name.spec"; + # TODO log, check return + my ($spec_path) = Hdlist::installsrpm($pkgrpm); build($spec_path, $name, $version, $release, $newversion); } @@ -200,6 +201,7 @@ sub build { my ($spec_path, $pkg, $version, $release, $newversion) = @_; my ($message, $spec, @url, %specvars); my ($newrelease, $release_prefix) = ($1,$2) if $release =~ /^(.*\d+)(\D*)$/g; + my $hdlist_spec = Hdlist::specnew($spec_path) or die "Unable to parse spec $spec_path\n"; if ($newversion) { print "===> Building $pkg $newversion\n"; @@ -231,10 +233,10 @@ sub build { while (<$SPECFILE>) { # Doing a s/// version - s/\%define\s+version\s+$version/\%define version $newversion/; - s/\%define\s+release\s+$release/\%define release $newrelease/; - s/Version:\s+$version/Version: $newversion/i; - s/Release:\s+$release/Release: $newrelease/i; + s/(\%define\s+version\s+)$version/$1$newversion/; + s/(\%define\s+release\s+)$release/$1$newrelease/; + s/Version:(\s+)$version/Version:$1$newversion/i; + s/Release:(\s+)$release/Release:$1$newrelease/i; # TODO factorisation # case of %define release %mkrel 2 @@ -273,7 +275,7 @@ sub build { if (/^\%changelog/) { $message =~ s/\%\%VERSION/$newversion/; my @l = getpwuid($<); - my $packager = `rpm --eval '\%packager'`; + my $packager = Hdlist::expand('%packager'); chomp($packager); # if macro is undefined $packager =~ s/\%packager//g; @@ -310,7 +312,7 @@ sub build { { # to test download => 'http://savannah.gnu.org/download//$1/$2', regexp => 'https?://savannah.gnu.org/projects/([^/]*)/(.*)' - }, + } ); # http://jabberstudio.org/files/ejogger/ @@ -329,7 +331,7 @@ sub build { foreach (@url) { # Replace variable from spec (%blabla) - while (/\%/) { + while (/\%[^(]?/) { s/\%\{?(\w+)\}?/$specvars{$1}/g; s/\%\{name\}/$pkg/g; s/\%\{version\}/$newversion/g; @@ -418,19 +420,14 @@ sub build { } if ($config{execafterbuild}) { - if (my $hdlist_spec = Hdlist::specnew($spec_path)) - { - my @rpms_upload; - push(@rpms_upload, $hdlist_spec->srcrpm); - foreach ($hdlist_spec->binrpm()) - { - -f $_ or next; - push(@rpms_upload, $_); - } - system("$config{execafterbuild} @rpms_upload"); - } else { - print "Unable to parse spec to detect builded rpms\n"; - } + my @rpms_upload; + push(@rpms_upload, $hdlist_spec->srcrpm); + foreach ($hdlist_spec->binrpm()) + { + -f $_ or next; + push(@rpms_upload, $_); + } + system("$config{execafterbuild} @rpms_upload"); } } @@ -555,6 +552,7 @@ sub parse_argv { sub usage { print <<EOF; rpmbuildupdate v0.5 helps you build up to date RPMs. +cvs version : \$Id$ By Julien Danjou, Michael Scherer, Guillaume Rousse |