summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-06-18 15:47:43 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-06-18 15:47:43 +0000
commit48d17aecfbe7938e796fec388f5d357da761cba2 (patch)
treea50884815778c8b25039dc503e2664d8dcf8211d
parentb2acbfd301f16263d7d7b2a68042b24ff0209596 (diff)
downloadurpmi-48d17aecfbe7938e796fec388f5d357da761cba2.tar
urpmi-48d17aecfbe7938e796fec388f5d357da761cba2.tar.gz
urpmi-48d17aecfbe7938e796fec388f5d357da761cba2.tar.bz2
urpmi-48d17aecfbe7938e796fec388f5d357da761cba2.tar.xz
urpmi-48d17aecfbe7938e796fec388f5d357da761cba2.zip
- urpmi.addmedia --distrib, urpmi/urpme/urpmf/urpmq --use-distrib
o media.cfg per media field hdlist=hdlist_xxx.cz is not used anymore, xxx/media_info/hdlist.cz is used instead. To get previous behaviour, use option --use-copied-hdlist or use_copied_hdlist=1 in media.cfg beware: this modifies the behaviour of urpmi, especially for multi CDs media which were the only one really using the hdlist-copied-in-media/media_info feature
-rw-r--r--NEWS4
-rw-r--r--t/superuser--addmedia.t36
-rw-r--r--urpm/args.pm1
-rw-r--r--urpm/media.pm23
4 files changed, 49 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 5db945cc..4cc0b2f1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+- urpmi.addmedia --distrib, urpmi/urpme/urpmf/urpmq --use-distrib
+ o media.cfg per media field hdlist=hdlist_xxx.cz is not used anymore,
+ xxx/media_info/hdlist.cz is used instead. To get previous behaviour, use
+ option --use-copied-hdlist or use_copied_hdlist=1 in media.cfg
- urpmi
o for long package names, ensure progression of installation (####...) is
still properly indented (#28639)
diff --git a/t/superuser--addmedia.t b/t/superuser--addmedia.t
index 661dce19..87941c35 100644
--- a/t/superuser--addmedia.t
+++ b/t/superuser--addmedia.t
@@ -42,17 +42,22 @@ try_medium({ synthesis => 1,
"with ../media_info/synthesis.hdlist_$name.cz",
"with ../media_info/synthesis.hdlist_$name2.cz");
-try_distrib({ hdlist => 1,
+try_distrib({ media_info_dir => 'media_info' }, '');
+try_distrib({ hdlist => 1, media_info_dir => 'media_info' },
+ '--probe-hdlist');
+try_distrib({ synthesis => 1, media_info_dir => 'media_info' },
+ '--probe-synthesis');
+try_distrib_removable({ hdlist => 1,
with_hdlist => "../..//media/media_info/hdlist_$name.cz",
with_hdlist2 => "../..//media/media_info/hdlist_$name2.cz",
with_hdlist3 => "../..//media/media_info/hdlist_$name3.cz" },
'');
-try_distrib({ hdlist => 1,
+try_distrib_removable({ hdlist => 1,
with_hdlist => "../..//media/media_info/hdlist_$name.cz",
with_hdlist2 => "../..//media/media_info/hdlist_$name2.cz",
with_hdlist3 => "../..//media/media_info/hdlist_$name3.cz" },
'--probe-hdlist');
-try_distrib({ synthesis => 1,
+try_distrib_removable({ synthesis => 1,
with_hdlist => "../..//media/media_info/synthesis.hdlist_$name.cz",
with_hdlist2 => "../..//media/media_info/synthesis.hdlist_$name2.cz",
with_hdlist3 => "../..//media/media_info/synthesis.hdlist_$name3.cz" },
@@ -71,13 +76,23 @@ sub try_medium {
sub try_distrib {
my ($want, $options) = @_;
+ my $want3 = { %$want, ignore => 1 };
+
+ try_distrib_($want, $want3, $options);
+
+ $want3->{virtual} = $want->{virtual} = 1;
+ try_distrib_($want, $want3, '--virtual ' . $options);
+}
+
+sub try_distrib_removable {
+ my ($want, $options) = @_;
my $want2 = { %$want, with_hdlist => $want->{with_hdlist2} || $want->{with_hdlist} };
my $want3 = { %$want, with_hdlist => $want->{with_hdlist3} || $want->{with_hdlist}, ignore => 1 };
- try_distrib_($want, $want2, $want3, $options);
+ try_distrib_removable_($want, $want2, $want3, $options);
$want3->{virtual} = $want2->{virtual} = $want->{virtual} = 1;
- try_distrib_($want, $want2, $want3, '--virtual ' . $options);
+ try_distrib_removable_($want, $want2, $want3, '--virtual ' . $options);
}
sub try_medium_ {
@@ -96,9 +111,18 @@ sub try_medium_ {
}
sub try_distrib_ {
- my ($want, $want2, $want3, $options) = @_;
+ my ($want, $want3, $options) = @_;
urpmi_addmedia("--distrib $name $::pwd $options");
+ check_conf($want, $want, $want3);
+ check_urpmi($name, $name2);
+ urpmi_removemedia('-a');
+}
+
+sub try_distrib_removable_ {
+ my ($want, $want2, $want3, $options) = @_;
+
+ urpmi_addmedia("--distrib $name $::pwd $options --use-copied-hdlist");
check_conf($want, $want2, $want3);
check_urpmi($name, $name2);
urpmi_removemedia('-a');
diff --git a/urpm/args.pm b/urpm/args.pm
index d6ae29f7..ecca014f 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -50,6 +50,7 @@ my %options_spec_all = (
$urpm->{debug} = $urpm->{debug_URPM} = sub { print STDERR "$_[0]\n" };
},
'urpmi-root=s' => sub { urpm::set_files($urpm, $_[1]) },
+ 'use-copied-hdlist' => sub { $urpm->{options}{use_copied_hdlist} = 1 },
);
my %options_spec = (
diff --git a/urpm/media.pm b/urpm/media.pm
index 601f1070..15614ea3 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -644,7 +644,7 @@ sub _compute_flags_for_instlist {
#- add a new medium, sync the config file accordingly.
#- returns the new medium's name. (might be different from the requested
#- name if index_name was specified)
-#- options: ignore, index_name, nolock, synthesis, update, virtual
+#- options: ignore, index_name, nolock, hdlist, synthesis, update, virtual, media_info_dir
sub add_medium {
my ($urpm, $name, $url, $with_hdlist, %options) = @_;
@@ -669,11 +669,11 @@ sub add_medium {
my $medium = { name => $name,
url => $url,
modified => !$options{ignore},
- downloader => $options{downloader},
- update => $options{update},
- ignore => $options{ignore},
- synthesis => $options{synthesis},
};
+ foreach (qw(downloader update ignore hdlist synthesis media_info_dir)) {
+ $medium->{$_} = $options{$_} if exists $options{$_};
+ }
+
if ($options{virtual}) {
file_from_file_url($url) or $urpm->{fatal}(1, N("virtual medium needs to be local"));
$medium->{virtual} = 1;
@@ -772,13 +772,18 @@ sub add_distrib_media {
my $is_update_media = $distribconf->getvalue($media, 'updates_for');
+ my $use_copied_hdlist = $urpm->{options}{use_copied_hdlist} || $distribconf->getvalue($media, 'use_copied_hdlist');
+ my $with_hdlist = $use_copied_hdlist && offset_pathname(
+ $url,
+ $distribconf->getpath($media, 'path'),
+ ) . '/' . $distribconf->getpath($media, $options{probe_with} eq 'synthesis' ? 'synthesis' : 'hdlist');
+
push @newnames, add_medium($urpm,
$name ? "$media_name ($name$medium_index)" : $media_name,
reduce_pathname($distribconf->getfullpath($media, 'path')),
- offset_pathname(
- $url,
- $distribconf->getpath($media, 'path'),
- ) . '/' . $distribconf->getpath($media, $options{probe_with} eq 'synthesis' ? 'synthesis' : 'hdlist'),
+ $with_hdlist,
+ !$use_copied_hdlist ? (media_info_dir => 'media_info') : (),
+ !$use_copied_hdlist && $options{probe_with} ? ($options{probe_with} => 1) : (),
index_name => $name ? undef : 0,
$add_by_default ? () : (ignore => 1),
%options,