Mageia Bugzilla – Attachment 9848 Details for
Bug 22258
Add new option to urpmq to only list newest version of each package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Patch to add --newest option to urpmq
0001-urpmq-add-option-to-only-show-newest-alternative-for.patch (text/plain), 1.55 KB, created by
Martin Whitaker
on 2017-12-23 23:13:41 CET
(
hide
)
Description:
Patch to add --newest option to urpmq
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2017-12-23 23:13:41 CET
Size:
1.55 KB
patch
obsolete
>From 4447049bdb2b2ffcf9be874eb95d99f21a0559ea Mon Sep 17 00:00:00 2001 >From: Martin Whitaker <mageia@martin-whitaker.me.uk> >Date: Sat, 23 Dec 2017 22:02:21 +0000 >Subject: [PATCH] urpmq: add option to only show newest alternative for each > package. > >When querying multiple packages, e.g. with the --source option, if >there is more than one version of the package available, all the >alternatives are returned (sepearted by '|'). This adds a '--newest' >option which causes only the latest version of the package to be >listed. > >diff --git a/urpm/args.pm b/urpm/args.pm >index 55e589ae..28429ad6 100644 >--- a/urpm/args.pm >+++ b/urpm/args.pm >@@ -281,6 +281,7 @@ my %options_spec = ( > 'dump-config' => \$options{dump_config}, > 'src|s' => \$options{src}, > sources => \$options{sources}, >+ newest => \$options{newest}, > force => \$options{force}, > 'parallel=s' => \$options{parallel}, > 'env=s' => \$options{env}, >diff --git a/urpmq b/urpmq >index 2ce524cf..09c0b810 100755 >--- a/urpmq >+++ b/urpmq >@@ -379,6 +379,18 @@ if ($options{list_aliases}) { > $state->{selected} = \%requested; > } > >+ if ($options{newest}) { >+ my $selected = $state->{selected}; >+ foreach (keys %$selected) { >+ my @ids = split('\|', $_); >+ next if @ids < 2; >+ delete $selected->{$_}; >+ my @pkgs = map { $urpm->{depslist}[$_] } @ids; >+ @pkgs = sort { $b->compare_pkg($a) } @pkgs; >+ $selected->{$pkgs[0]->id} = 1; >+ } >+ } >+ > my %need_xml_info; > $need_xml_info{info} = 1 if $options{info} || $options{sourcerpm}; > $need_xml_info{files} = 1 if $options{files}; >-- >2.13.6 >
From 4447049bdb2b2ffcf9be874eb95d99f21a0559ea Mon Sep 17 00:00:00 2001 From: Martin Whitaker <mageia@martin-whitaker.me.uk> Date: Sat, 23 Dec 2017 22:02:21 +0000 Subject: [PATCH] urpmq: add option to only show newest alternative for each package. When querying multiple packages, e.g. with the --source option, if there is more than one version of the package available, all the alternatives are returned (sepearted by '|'). This adds a '--newest' option which causes only the latest version of the package to be listed. diff --git a/urpm/args.pm b/urpm/args.pm index 55e589ae..28429ad6 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -281,6 +281,7 @@ my %options_spec = ( 'dump-config' => \$options{dump_config}, 'src|s' => \$options{src}, sources => \$options{sources}, + newest => \$options{newest}, force => \$options{force}, 'parallel=s' => \$options{parallel}, 'env=s' => \$options{env}, diff --git a/urpmq b/urpmq index 2ce524cf..09c0b810 100755 --- a/urpmq +++ b/urpmq @@ -379,6 +379,18 @@ if ($options{list_aliases}) { $state->{selected} = \%requested; } + if ($options{newest}) { + my $selected = $state->{selected}; + foreach (keys %$selected) { + my @ids = split('\|', $_); + next if @ids < 2; + delete $selected->{$_}; + my @pkgs = map { $urpm->{depslist}[$_] } @ids; + @pkgs = sort { $b->compare_pkg($a) } @pkgs; + $selected->{$pkgs[0]->id} = 1; + } + } + my %need_xml_info; $need_xml_info{info} = 1 if $options{info} || $options{sourcerpm}; $need_xml_info{files} = 1 if $options{files}; -- 2.13.6
View Attachment As Raw
Actions:
View
Attachments on
bug 22258
: 9848