Re: make pkg_info -Q work with other flags
On Wed, Aug 02, 2017 at 12:11:13PM -0600, Aaron Bieber wrote: > On Sat, Jul 29, 2017 at 10:40:37AM -0600, Aaron Bieber wrote: > > Hola, > > > > Currently "pkg_info -Q" doesn't respect other flags and the way > > pkg_info(1) reads, it implies that they will work with it. > > > > This diff makes pkg_info function as expected when other flags are > > passed when using -Q. > > Ping. Clue sticks? OKs? Makes sense to me, allows for example to do: $pkg_info -Q firefox -s Information for https://packages.rhaalovely.net/pub/OpenBSD/snapshots/packages/amd64/firefox-55.0rc1.tgz Size: 147593632 or $pkg_info -Q xfwm4 -f (which shows the packing-list for xfwm4 and xfwm4-themes) ok
Re: make pkg_info -Q work with other flags
On Sat, Jul 29, 2017 at 10:40:37AM -0600, Aaron Bieber wrote: > Hola, > > Currently "pkg_info -Q" doesn't respect other flags and the way > pkg_info(1) reads, it implies that they will work with it. > > This diff makes pkg_info function as expected when other flags are > passed when using -Q. Ping. Clue sticks? OKs? > > Cheers, > Aaron > > Index: OpenBSD/PkgInfo.pm > === > RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v > retrieving revision 1.44 > diff -u -p -r1.44 PkgInfo.pm > --- OpenBSD/PkgInfo.pm25 Jan 2017 14:10:46 - 1.44 > +++ OpenBSD/PkgInfo.pm29 Jul 2017 16:32:54 - > @@ -406,13 +406,18 @@ sub print_info > } > $state->say("#1", $compose); > } elsif ($state->opt('I')) { > - if ($state->opt('q')) { > - $state->say("#1", $pkg); > + if ($state->opt('Q')) { > + $state->say( > + is_installed($pkg) ? "#1 (installed)" : "#1", $pkg); > } else { > - my $l = 20 - length($pkg); > - $l = 1 if $l <= 0; > - $state->say("#1#2#3", $pkg, " "x$l, > - get_comment($handle->info)); > + if ($state->opt('q')) { > + $state->say("#1", $pkg); > + } else { > + my $l = 20 - length($pkg); > + $l = 1 if $l <= 0; > + $state->say("#1#2#3", $pkg, " "x$l, > + get_comment($handle->info)); > + } > } > } else { > if ($state->opt('c')) { > @@ -468,7 +473,7 @@ sub print_info > > OpenBSD::x509::print_certificate_info($plist); > } elsif ($sig->{key} eq 'signify' || > $sig->{key} eq 'signify2') { > - $state->say("reportedly signed by #1", > + $state->say("reportedly signed by #1", > $plist->get('signer')->name); > } > } else { > @@ -601,8 +606,10 @@ sub parse_and_run > my $r = $state->repo->match_locations($partial); > > for my $p (sort map {$_->name} @$r) { > - $state->say( > - is_installed($p) ? "#1 (installed)" : "#1", $p); > + $self->find_pkg($state, $p, > + sub { > + $self->print_info($state, @_); > + }); > } > > return 0; > > > -- > PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A 4AF0 1F81 112D 62A9 ADCE > -- PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A 4AF0 1F81 112D 62A9 ADCE
make pkg_info -Q work with other flags
Hola, Currently "pkg_info -Q" doesn't respect other flags and the way pkg_info(1) reads, it implies that they will work with it. This diff makes pkg_info function as expected when other flags are passed when using -Q. Cheers, Aaron Index: OpenBSD/PkgInfo.pm === RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v retrieving revision 1.44 diff -u -p -r1.44 PkgInfo.pm --- OpenBSD/PkgInfo.pm 25 Jan 2017 14:10:46 - 1.44 +++ OpenBSD/PkgInfo.pm 29 Jul 2017 16:32:54 - @@ -406,13 +406,18 @@ sub print_info } $state->say("#1", $compose); } elsif ($state->opt('I')) { - if ($state->opt('q')) { - $state->say("#1", $pkg); + if ($state->opt('Q')) { + $state->say( + is_installed($pkg) ? "#1 (installed)" : "#1", $pkg); } else { - my $l = 20 - length($pkg); - $l = 1 if $l <= 0; - $state->say("#1#2#3", $pkg, " "x$l, - get_comment($handle->info)); + if ($state->opt('q')) { + $state->say("#1", $pkg); + } else { + my $l = 20 - length($pkg); + $l = 1 if $l <= 0; + $state->say("#1#2#3", $pkg, " "x$l, + get_comment($handle->info)); + } } } else { if ($state->opt('c')) { @@ -468,7 +473,7 @@ sub print_info OpenBSD::x509::print_certificate_info($plist); } elsif ($sig->{key} eq 'signify' || $sig->{key} eq 'signify2') { - $state->say("reportedly signed by #1", + $state->say("reportedly signed by #1", $plist->get('signer')->name); } } else { @@ -601,8 +606,10 @@ sub parse_and_run my $r = $state->repo->match_locations($partial); for my $p (sort map {$_->name} @$r) { - $state->say( - is_installed($p) ? "#1 (installed)" : "#1", $p); + $self->find_pkg($state, $p, + sub { + $self->print_info($state, @_); + }); } return 0; -- PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A 4AF0 1F81 112D 62A9 ADCE