From a8eb19c4f2c943ae497a6a100f70d9aba3543710 Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Tue, 5 Dec 2006 16:37:37 +0000 Subject: Replaced cryptic regexps for descriptive functions (misc) --- iurt2 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/iurt2 b/iurt2 index 9e170a7..02b0222 100755 --- a/iurt2 +++ b/iurt2 @@ -44,6 +44,8 @@ use Iurt::Mail qw(sendmail); use Iurt::Util qw(plog_init plog); use File::NCopy qw(copy); use File::Path qw(mkpath); +use File::Spec::Functions qw(rel2abs); +use File::Basename qw(fileparse); # I did not manage to make locks work over the network #use File::lockf; use Mkcd::Commandline qw(parseCommandLine usage); @@ -186,14 +188,8 @@ $run{todo} = []; die "FATAL $program_name: $_ not a file or cannot be read\n"; } - if (m,^(/.*/)([^/]*\.src\.rpm)$,) { - ($path, $srpm) = ($1, $2); - } elsif (m,([^/]*\.src\.rpm)$,) { - ($path, $srpm) = (`pwd`, $1); - chomp($path); - } else { - die "FATAL $program_name: $_ doesn't look like a SRPM\n"; - } + ($srpm, $path) = fileparse(rel2abs($_)); + ($srpm =~ /\.src\.rpm$/) || die "FATAL: $_ doesn't look like an SRPM"; if (check_arch($_, $run{my_arch})) { plog('DEBUG', "force build for $2 (from $1)"); -- cgit v1.2.1