Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #178778

Re: prevent "dpkg -l" from showing nonexisting packages

From Cindy-Sue Causey <butterflybytes@gmail.com>
Newsgroups linux.debian.user
Subject Re: prevent "dpkg -l" from showing nonexisting packages
Date 2017-03-13 20:50 +0100
Message-ID <tkE8F-5gy-3@gated-at.bofh.it> (permalink)
References <tjR7X-4Eb-19@gated-at.bofh.it> <tjSGK-5RQ-1@gated-at.bofh.it> <tkpMm-3kA-3@gated-at.bofh.it> <tkzC3-1Yl-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 3/13/17, Vincent Lefevre <vincent@vinc17.net> wrote:
> On 2017-03-13 00:23:54 -0400, kamaraju kusumanchi wrote:
>> Let me rephrase my question. If "dpkg -l" cannot do it, is there some
>> other command that will only show packages from the current
>> repositories?
>
> Perhaps apt-show-versions, which can check whether a package
> is in a repository. You will need options and/or grep.
>
> For instance, on one of my machines, I get in the output:
>
> unison2.40.102:amd64 2.40.102-3 installed: No available version in archive
>
> i.e. apt-show-versions detects that this package is installed,
> but no longer in any declared repository.


Ooohhh, NICE find! I never would have thought about it because I've
never seen apt-show-versions produce that output.

I started to write: Is there a way to perform maybe a "reverse" grep
sent to a file that was an "apt-show-versions -u" (or any other) query
with everything EXCEPT those packages that return "No available
version in archive"?

And then I went to "man grep" = THERE IS A WAY!!!!

At least it worked on my end.

I don't have anything that's not from that one-liner repository I use
(in /etc/apt/sources.list) so I tried:

apt-show-versions | grep -v "uptodate" -i

That "-v" is interchangeable with "--invert-match". Both allow you to:
"Invert the sense of matching, to select non-matching lines"

Better yet, I just did:

apt-show-versions | grep -v "uptodate" -i > notUpToDate20170313

THAT... returned ONLY the lines that did NOT contain "uptodate" out of
the tons of packages I have installed AND then sent that query to a
file that is easier FOR ME to read and manipulate (versus seeing it on
the terminal display).

I A-SUME but cannot test drive that the following MIGHT be usable for
someone somewhere... some day:

apt-show-versions | grep -v "No available version in archive" -i >
thePackagesIwanted

OR, depending on your need, maybe something like:

apt-show-versions -u | grep -v "No available version in archive" -i >
thePackagesIwanted

Yes, no, maybe so?

For those who have not seen the ">" yet, that was a tremendous tip I
learned on the fly years ago. It outputs what you're doing to a file.

There's a no-brainer "caveat" to using that. You must have rights to
access the directory that you're issuing that command from, else it
WILL fail. E.g. I can't issue that command while my terminal is
showing that I'm sitting in the /etc directory. It DOES work if I
change the file path to "~/notUpToDate20170313", e.g.:

elf@northpole:/etc$ apt-show-versions | grep -v "uptodate" -i >
~/notUpToDate20170313

I say again....... Oooohhhh :)

Cindy :)

-- 
Cindy-Sue Causey
Talking Rock, Pickens County, Georgia, USA

* runs with duct tape *

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

prevent "dpkg -l" from showing nonexisting packages kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2017-03-11 16:30 +0100
  Re: prevent "dpkg -l" from showing nonexisting packages Brian <ad44@cityscape.co.uk> - 2017-03-11 18:10 +0100
    Re: prevent "dpkg -l" from showing nonexisting packages kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2017-03-13 05:30 +0100
      Re: prevent "dpkg -l" from showing nonexisting packages Vincent Lefevre <vincent@vinc17.net> - 2017-03-13 16:00 +0100
        Re: prevent "dpkg -l" from showing nonexisting packages Cindy-Sue Causey <butterflybytes@gmail.com> - 2017-03-13 20:50 +0100

csiph-web