summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-01-25 14:26:05 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-01-25 14:26:05 +0000
commit8c43c87b270294274d5af2675cefc5dbfc0a484d (patch)
tree667c240965a5a831ceab277e28f8f0b0790cfe6e /urpm.pm
parente884114e68874533a3156add77ebb9fedae8ec8e (diff)
downloadurpmi-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)
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm20
1 files changed, 14 insertions, 6 deletions
diff --git a/urpm.pm b/urpm.pm
index 3c1d53af..46fda003 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -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);