From c66026239d9b1dc8c53236b2f6b7d983dda8ca05 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 17 Feb 2005 15:01:39 +0000 Subject: Remove obsoleted and broken --distrib-XXX command-line option --- man/C/urpmi.addmedia.8 | 10 ----- urpm/args.pm | 9 +---- urpmi.addmedia | 104 ++++--------------------------------------------- 3 files changed, 10 insertions(+), 113 deletions(-) diff --git a/man/C/urpmi.addmedia.8 b/man/C/urpmi.addmedia.8 index abc62592..46b1d372 100644 --- a/man/C/urpmi.addmedia.8 +++ b/man/C/urpmi.addmedia.8 @@ -100,20 +100,10 @@ of the distribution. <\fIname\fP> is combined with medium names found to create newer medium names in the urpmi database. The \fBwith ...\fP option, if provided, is ignored, as hdlists found on the installation medium are used instead automatically. -.IP "\fB\--distrib-XXX\fP" -Automatically create a medium for part "XXX" of a distribution. "XXX" may be -typically "main", "contrib", "main_updates" or anything else that has been -configured in that distribution. .IP "\fB\--from\fP \fIurl\fP" Use specified URL for list of mirrors. The default from Mandrakesoft is \fIhttp://www.linux-mandrake.com/mirrorsfull.list\fP. .IP "\fB\--version\fP \fIversion\fP" -Use specified version when using \fB--distrib-XXX\fP, the default is to use the -version of the package \fBmandrakelinux-release\fP currently installed. -.IP "\fB\--arch\fP \fIarch\fP" -Use specified architecture when using \fB--distrib-XXX\fP, the default is to -use the architecture of the package \fBmandrakelinux-release\fP currently -installed. .IP "\fB\--virtual\fP" Create a virtual medium, this only works for file:// and removable:// protocol and no files will be created in /var/lib/urpmi. The medium is always up-to-date diff --git a/urpm/args.pm b/urpm/args.pm index 24993f56..bc90e660 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -260,7 +260,7 @@ my %options_spec = ( 'probe-synthesis' => sub { $options{probe_with} = 'synthesis' }, 'probe-hdlist' => sub { $options{probe_with} = 'hdlist' }, 'no-probe' => sub { $options{probe_with} = undef }, - distrib => sub { $options{distrib} = undef }, + distrib => sub { $options{distrib} = 1 }, 'from=s' => \$options{mirrors_url}, 'version=s' => \$options{version}, 'arch=s' => \$options{arch}, @@ -268,12 +268,7 @@ my %options_spec = ( 'q|quiet' => sub { --$options{verbose} }, 'v|verbose' => sub { ++$options{verbose} }, '<>' => sub { - if ($_[0] =~ /^--distrib-(.*)$/) { - $options{distrib} = $1; - } - else { - push @::cmdline, $_[0]; - } + push @::cmdline, $_[0]; }, }, diff --git a/urpmi.addmedia b/urpmi.addmedia index cea7170f..7f33cdb8 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -59,9 +59,6 @@ and [options] are from hdlist file. ") . N(" --distrib - automatically create all media from an installation medium. -") . N(" --distrib-XXX - automatically create a medium for XXX part of a - distribution, XXX may be main, contrib, updates or - anything else that has been configured ;-) ") . N(" --from - use specified url for list of mirrors, the default is %s ", $mirrors) . N(" --version - use specified distribution version, the default is taken @@ -103,14 +100,14 @@ sub main { my $urpm = new urpm; urpm::args::parse_cmdline(urpm => $urpm); #- the default is to probe a synthesis file, except for --distrib - $options{probe_with} = 'synthesis' unless exists($options{distrib}) || exists($options{probe_with}); + $options{probe_with} = 'synthesis' unless $options{distrib} || exists($options{probe_with}); our ($name, $url, $with, $relative_hdlist) = our @cmdline; #- remove verbose if not asked. $options{verbose} > 0 or $urpm->{log} = sub {}; - $options{distrib} or $url or ($url, $name) = ($name, ''); - my ($type) = $url =~ m,^(([^:]*):/)?/, or $options{distrib} or usage; + $url or ($url, $name) = ($name, ''); + my ($type) = $url =~ m,^(([^:]*):/)?/, or usage; if ($< != 0) { $urpm->{fatal}(1, N("Only superuser is allowed to add media")); @@ -122,96 +119,11 @@ sub main { $urpm->read_config; exists $options{limit_rate} or $options{limit_rate} = $urpm->{options}{'limit-rate'}; - if (exists $options{distrib}) { - if (defined $options{distrib}) { - $name or usage; - #- extended distribution support, code is directly inlined here. - #- -h always set, updates should allow setting update flag. - $options{distrib} eq 'updates' and $options{update} = 1; - #- official site by default. - #- get default value unless already provided. - unless ($options{version} && $options{arch}) { - my $db = URPM::DB::open; - $options{arch} or $db->traverse_tag( - 'name', - [ qw(basesystem) ], - sub { my ($pkg) = @_; $options{arch} = $pkg->arch }, - ); - $options{version} or $db->traverse_tag( - 'name', - [ qw(mandrakelinux-release) ], - sub { - my ($pkg) = @_; - $pkg->release =~ /^0\./ and $options{version} = 'cooker'; - $options{version} ||= $pkg->version; - }, - ); - $urpm->{log}(N("found version %s and arch %s ...", $options{version}, $options{arch})); - } - #- sanity checks... - $options{distrib} eq 'updates' && $options{version} eq 'cooker' and - die N("cannot add updates of a cooker distribution\n"); - #- get mirrors list file in urpmi cache. - my ($basename) = $options{from} =~ m|^.*/([^/]+)/*$|; - unlink "$urpm->{cachedir}/partial/$basename"; - eval { - $urpm->{log}(N("retrieving mirrors at %s ...", $options{from})); - $urpm->{sync}( - { - dir => "$urpm->{cachedir}/partial", - quiet => 1, - proxy => urpm::download::get_proxy(), - }, - $options{from}, - ); - $urpm->{log}(N("...retrieving done")); - }; - $@ and $urpm->{log}(N("...retrieving failed: %s", $@)); - #- examine its contents and create all requested media, url is now a simple regex. - my $heading = quotemeta($options{distrib}); - my $qarch = quotemeta($options{arch}); - my $old_mirror_structure = $options{version} =~ /^(?:[2-9]|10\.0$)/; - open my $fh, "$urpm->{cachedir}/partial/$basename" or die $!; - while (<$fh>) { - chomp; s/#.*$//; s/^\s*//; s/\s*$//; - my ($v, $a, $l, $burl, $relative_hdlist); - if (($v, $a, $l, $burl, $relative_hdlist) = /^$heading:([^:]*):([^:]*):([^:]*):(\S*)(?:\s+with\s+(.*))?$/) { - $v eq '*' || $v eq $options{version} or next; - $a eq '*' || $a eq $options{arch} or next; - } elsif (($a, $burl) = /^$heading([^:]*):(\S*)$/) { - $a eq $options{arch} or next; - if ($old_mirror_structure) { - #- pre-10.1 architecture. - $options{distrib} eq 'updates' and $burl = "$burl/$options{version}/RPMS"; - $options{distrib} eq 'contrib' and $burl .= "2"; - } else { - $options{distrib} eq 'updates' and $burl = "$burl/$options{version}/media/updates"; - $options{distrib} eq 'contrib' and $burl = "$burl/$options{version}/media/contrib"; - } - } elsif (($a, $burl) = /^cooker([^:]*):(\S*)$/) { - $options{version} eq 'cooker' && $options{distrib} eq 'contrib' or next; - $a eq $options{arch} or next; - if ($old_mirror_structure) { - $burl .= "2"; - } else { - $burl =~ s/main$/contrib/; - } - } else { - # it could a blank line (from a commentary) or source description. - next; - } - #- sort according to url or location if possible. - !$url || $l && $l =~ /$url/i || $burl =~ /$url/i or next; - $urpm->add_medium($name, $burl, $relative_hdlist, - virtual => $options{virtual}, update => $options{update}, index_name => 0); - } - close $fh; - } else { - $with || $relative_hdlist - and usage N("no need to give with --distrib"); - - $urpm->add_distrib_media($name, $url, virtual => $options{virtual}, update => $options{update}, probe_with => $options{probe_with}); - } + if ($options{distrib}) { + $with || $relative_hdlist + and usage N("no need to give with --distrib"); + + $urpm->add_distrib_media($name, $url, virtual => $options{virtual}, update => $options{update}, probe_with => $options{probe_with}); $urpm->update_media(%options, callback => \&urpm::download::sync_logger); if (my @unsynced_media = grep { $_->{modified} } @{$urpm->{media}}) { -- cgit v1.2.1