diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2006-01-25 14:26:05 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2006-01-25 14:26:05 +0000 |
commit | 8c43c87b270294274d5af2675cefc5dbfc0a484d (patch) | |
tree | 667c240965a5a831ceab277e28f8f0b0790cfe6e | |
parent | e884114e68874533a3156add77ebb9fedae8ec8e (diff) | |
download | urpmi-8c43c87b270294274d5af2675cefc5dbfc0a484d.tar urpmi-8c43c87b270294274d5af2675cefc5dbfc0a484d.tar.gz urpmi-8c43c87b270294274d5af2675cefc5dbfc0a484d.tar.bz2 urpmi-8c43c87b270294274d5af2675cefc5dbfc0a484d.tar.xz urpmi-8c43c87b270294274d5af2675cefc5dbfc0a484d.zip |
Allow to install specfiles via urpmi (like source rpms)
-rw-r--r-- | urpm.pm | 20 | ||||
-rwxr-xr-x | urpmi | 4 |
2 files changed, 16 insertions, 8 deletions
@@ -2081,10 +2081,10 @@ sub register_rpms { #- depslist and provides environment. $start = @{$urpm->{depslist}}; foreach (@files) { - /\.rpm$/ or $error = 1, $urpm->{error}(N("invalid rpm file name [%s]", $_)), next; + /\.(?:rpm|spec)$/ or $error = 1, $urpm->{error}(N("invalid rpm file name [%s]", $_)), next; #- allow url to be given. - if (my ($basename) = m|^[^:]*:/.*/([^/]*\.rpm)$|) { + if (my ($basename) = m{^[^:]*:/.*/([^/]*\.(?:rpm|spec))\z}) { unlink "$urpm->{cachedir}/partial/$basename"; eval { $urpm->{log}(N("retrieving rpm file [%s] ...", $_)); @@ -2108,10 +2108,18 @@ sub register_rpms { -r $_ or $error = 1, $urpm->{error}(N("unable to access rpm file [%s]", $_)), next; } - ($id, undef) = $urpm->parse_rpm($_); - my $pkg = defined $id && $urpm->{depslist}[$id]; - $pkg or $urpm->{error}(N("unable to register rpm file")), next; - $urpm->{source}{$id} = $_; + if (/\.spec$/) { + my $pkg = URPM::spec2srcheader($_) + or $error = 1, $urpm->{error}(N("unable to parse spec file %s [%s]", $_, $!)), next; + $id = @{$urpm->{depslist}}; + $urpm->{depslist}[$id] = $pkg; + $urpm->{source}{$id} = $_; + } else { + ($id, undef) = $urpm->parse_rpm($_); + my $pkg = defined $id && $urpm->{depslist}[$id]; + $pkg or $error = 1, $urpm->{error}(N("unable to register rpm file")), next; + $urpm->{source}{$id} = $_; + } } $error and $urpm->{fatal}(2, N("error registering local packages")); defined $id && $start <= $id and @requested{($start .. $id)} = (1) x ($id-$start+1); @@ -174,8 +174,8 @@ urpm::args::parse_cmdline(urpm => $urpm); # Process the rest of the arguments while (defined($_ = shift @ARGV)) { - if (/\.rpm$/) { - if (/\.src\.rpm$/) { + if (/\.(?:rpm|spec)$/) { + if (/\.(?:src\.rpm|spec)$/) { push @src_files, $_; } else { push @files, untaint($_); |