aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@mandriva.com>2005-10-10 21:00:28 +0000
committerMichael Scherer <misc@mandriva.com>2005-10-10 21:00:28 +0000
commitcd0fafa5c54e93a38a3346a2985a452412c1182f (patch)
tree366d1f1d741c1e4bd99f334ea3fcf629d2c35155
parenta37351e2a51de722fc6e9711684df7bc46d30a38 (diff)
downloadbootsplash-cd0fafa5c54e93a38a3346a2985a452412c1182f.tar
bootsplash-cd0fafa5c54e93a38a3346a2985a452412c1182f.tar.gz
bootsplash-cd0fafa5c54e93a38a3346a2985a452412c1182f.tar.bz2
bootsplash-cd0fafa5c54e93a38a3346a2985a452412c1182f.tar.xz
bootsplash-cd0fafa5c54e93a38a3346a2985a452412c1182f.zip
- add return code
- revert previous removal ( i didn't test the good version )
-rwxr-xr-xrpmbuildupdate26
1 files changed, 22 insertions, 4 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate
index 33bf6eb..f1ea95a 100755
--- a/rpmbuildupdate
+++ b/rpmbuildupdate
@@ -18,9 +18,18 @@
# add debian url ( like gnome or rh ) => cannot be done i think
# use more Hdlist ( see Hdlist->build() )
+# list of the return code :
+# 255 => usage
+# 6 => cannot open the spec file
+# 5 => random problem
+# 4 => a external command failed
+# 2 => invalid url
+# 1 => only src is build
+# 0 => no error
+
use strict;
use AppConfig;
-
+use MDK::Common::File qw(basename);
use File::Copy;
use Cwd;
use File::Spec;
@@ -33,6 +42,8 @@ my ($log, $top, $rpm);
sub system_die {
my ($command, $message) = @_;
$message ||= "$command failed";
+ # in case we die
+ $! = 4;
# do not forget , return value of 1 means failure in unix
system($command) and die $message;
}
@@ -197,6 +208,7 @@ sub build_from_src {
}
sub build {
+ $! = 5;
my ($spec_path, $pkg, $version, $release, $newversion) = @_;
my ($message, $spec, @url, %specvars);
my ($newrelease, $release_prefix) = ($1,$2) if $release =~ /^(.*\d+)(\D*)$/g;
@@ -224,6 +236,7 @@ sub build {
my $SPECFILE;
if (!open($SPECFILE, $spec_path)) {
print STDERR "Unable to open spec file $spec_path.\n";
+ $! = 6;
return;
}
@@ -405,7 +418,8 @@ sub build {
unless ($found) {
print "Unable to download file: URL is not valid ! :-(\n\n";
- return;
+ $! = 2;
+ return;
}
@@ -421,7 +435,10 @@ sub build {
if (system("$rpm -ba $config{rpmoption} $spec_path $log")) {
print "Binary build fails: building source only\n";
system("$rpm -bs $config{rpmoption} --nodeps $spec_path $log");
- }
+ $! = 1;
+ } else {
+ $! = 0;
+ }
}
if ($config{execafterbuild})
{
@@ -580,7 +597,7 @@ Usage: rpmbuildupdate [options] [pkg] [newversion]
--execute <command>: execute an arbitrary perl command for each line of the spec file
--execafterbuild <command>: execute a shell command after the build, with the source and binary rpm as argument
EOF
- exit 0;
+ exit 255;
}
sub parse_rpmmon {
@@ -627,3 +644,4 @@ sub main {
}
main;
+exit $!;