aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@mandriva.com>2006-01-09 10:04:01 +0000
committerMichael Scherer <misc@mandriva.com>2006-01-09 10:04:01 +0000
commit1842e55df0bb3deedca8beef2f4c340a6e06017e (patch)
tree1c6abd66a51c3a4a93392e833632ce4989c43d11
parent2c01973e3d81c9925d6fdb4f0c7d040ff05b66ba (diff)
downloadbootsplash-1842e55df0bb3deedca8beef2f4c340a6e06017e.tar
bootsplash-1842e55df0bb3deedca8beef2f4c340a6e06017e.tar.gz
bootsplash-1842e55df0bb3deedca8beef2f4c340a6e06017e.tar.bz2
bootsplash-1842e55df0bb3deedca8beef2f4c340a6e06017e.tar.xz
bootsplash-1842e55df0bb3deedca8beef2f4c340a6e06017e.zip
- factorisation of packager email retrieval in a function called get_email
-rwxr-xr-xrpmbuildupdate22
1 files changed, 13 insertions, 9 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate
index 23d885d..7f30245 100755
--- a/rpmbuildupdate
+++ b/rpmbuildupdate
@@ -202,7 +202,17 @@ sub build_from_src {
my ($spec_path) = RPM4::installsrpm($pkgrpm);
build($spec_path, $name, $version, $release, $newversion);
}
-
+
+sub get_email() {
+ my $packager = RPM4::expand('%packager');
+ my @l = getpwuid($<);
+ chomp($packager);
+ # if macro is undefined
+ $packager =~ s/\%packager//g;
+ return ( $packager ? $packager : $l[6] . ($ENV{EMAIL} ? " <$ENV{EMAIL}>" : " <$l[0]\@mandriva.com>"));
+
+}
+
sub build {
$! = 5;
my ($spec_path, $pkg, $version, $release, $newversion) = @_;
@@ -252,7 +262,6 @@ sub build {
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
if ( /^(.*\s\%mkrel\s+)(\d+)(.*)$/ )
@@ -293,13 +302,8 @@ sub build {
if (/^\%changelog/) {
$message =~ s/\%\%VERSION/$newversion/;
- my @l = getpwuid($<);
- my $packager = RPM4::expand('%packager');
- chomp($packager);
- # if macro is undefined
- $packager =~ s/\%packager//g;
- my $epoch = ( $specvars{'epoch'} ? "$specvars{'epoch'}:" : "" );
- my $email = $packager ? $packager : $l[6] . ($ENV{EMAIL} ? " <$ENV{EMAIL}>" : " <$l[0]\@mandriva.com>");
+ my $epoch = ( $specvars{'epoch'} ? "$specvars{'epoch'}:" : "" );
+ my $email = get_email();
$spec .= "* " . `LC_TIME=C date '+%a %b %d %Y'|tr -d '\n'` . " $email $epoch$newversion-$newrelease\n";
$spec .= "$message\n\n";
}