Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
List installed packages that are masked [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Mon Nov 15, 2010 11:54 am    Post subject: List installed packages that are masked [solved] Reply with quote

Is there a way to automatically remove all currently installed packages that have become masked (e.g. because it is listed in package.mask, or because the ebuild is removed, etc)? I manage a bunch of servers so I'm looking for an easy way to remove packages that should no longer be on there.

I've tried to get a list of masked packages using
Code:
VERSIONS='{ismasked}<category>/<name>-<version>\n{}' FORMAT='<installedversions:VERSIONS>' eix -I --pure-packages

but it doesn't list anything, even though I definitely have some masked packages. Anybody know what I'm doing wrong?

Edit: Changed subject line from "Unmerge masked packages" to something more descriptive


Last edited by malern on Fri Nov 19, 2010 4:11 pm; edited 2 times in total
Back to top
View user's profile Send private message
idella4
Retired Dev
Retired Dev


Joined: 09 Jun 2006
Posts: 1600
Location: Australia, Perth

PostPosted: Mon Nov 15, 2010 12:15 pm    Post subject: Reply with quote

malern

As far as I know a package that's masked isn't blocked from being unmerged. Just emerge -C package. Have you tried yet??
_________________
idella4@aus
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Mon Nov 15, 2010 1:20 pm    Post subject: Reply with quote

idella4 wrote:
Just emerge -C package

Yes, I don't have a problem unmerging them manually like that. I guess my subject line is a bit misleading, what I'm really trying to do is get a list of all the masked packages, which I can then unmerge using "emerge -C" like you say. My problem is I don't know how to get the list of masked packages.
Back to top
View user's profile Send private message
idella4
Retired Dev
Retired Dev


Joined: 09 Jun 2006
Posts: 1600
Location: Australia, Perth

PostPosted: Mon Nov 15, 2010 2:01 pm    Post subject: Reply with quote

look at this post in this page of this section & look at th use of anlyse
_________________
idella4@aus
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Mon Nov 15, 2010 4:13 pm    Post subject: Reply with quote

idella4 wrote:
look at this post in this page of this section & look at th use of anlyse

Sorry, I'm not sure which post you are referring to, could you explain further? thanks
Back to top
View user's profile Send private message
idella4
Retired Dev
Retired Dev


Joined: 09 Jun 2006
Posts: 1600
Location: Australia, Perth

PostPosted: Mon Nov 15, 2010 4:23 pm    Post subject: Reply with quote

Hmmm, the link wasn't set right. This, just a little further down the page.

https://forums.gentoo.org/viewtopic-t-852544.html like this
_________________
idella4@aus
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Mon Nov 15, 2010 4:41 pm    Post subject: Reply with quote

idella4 was referring to the analyse module I coded in >=gentoolkit-0.30_rc10.

But it does not do what you want.

portage-2.2 has it as 2 of it's generated sets, unavailable and unavailable-binaries.

You will want to first do any up/downgrades before unmerging the remainder
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Tue Nov 16, 2010 11:03 am    Post subject: Reply with quote

dol-sen wrote:
portage-2.2 has it as 2 of it's generated sets, unavailable and unavailable-binaries.

Thanks, that's good to know. But portage-2.2 seems to be hard masked at the moment. My goal is to minimise the number of masked packages I have installed, so I'm slightly reluctant about installing it :)

If anyone has any ideas how I could do something similar with stable portage (or other portage utils) then I'd appreciate it.
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Tue Nov 16, 2010 3:49 pm    Post subject: Reply with quote

It would not take much coding in a small python script. Possibly I can get to it tonight after work. Perhaps I can add it to analyse.

If you do have >=gentoolkit-0.30_rc10 installed, you can run eclean -p distfiles. At the end of the output I have added a deprecated section that lists any deprecated pkg versions it found during the search. It will not contain any masked only ebuild versions though.

Doesn't eix have something along those lines as one of it's features though? I was just looking at man eix and it might be able to do it, but I don't really use it.
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Tue Nov 16, 2010 5:01 pm    Post subject: Reply with quote

dol-sen wrote:
Doesn't eix have something along those lines as one of it's features though?


Code:

eix-test-obsolete b


This lists "Installed packages with a version not in the database (or masked)". It is part of app-portage/eix.
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Wed Nov 17, 2010 10:45 am    Post subject: Reply with quote

dol-sen wrote:
It would not take much coding in a small python script. Possibly I can get to it tonight after work. Perhaps I can add it to analyse.

If you could add something like that I would definitely appreciate it.

dol-sen wrote:
Doesn't eix have something along those lines as one of it's features though? I was just looking at man eix and it might be able to do it, but I don't really use it.

eix has a --installed-masked switch, but it only shows packages that have been profile masked (it ignores the local config). The closest I've got with eix is
Code:
VERSIONS='{downgrade}<category>/<name>-<version>\n{}' FORMAT='<installedversions:VERSIONS>' eix -I --pure-packages

That lists all installed packages that are now masked, keyworded, missing, etc (which is what I want). The only problem is it doesn't work very well with slotted packages. It always lists every installed version, even if only one of them is masked.

Apheus wrote:
Code:

eix-test-obsolete b


This lists "Installed packages with a version not in the database (or masked)". It is part of app-portage/eix.

Thanks, I didn't know about that command. Unfortunately it doesn't seem to work in the way I'd expect. I'm not really sure how it's working, but it's not picking up my packages that are profile masked or locally masked.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Wed Nov 17, 2010 5:36 pm    Post subject: Reply with quote

The problem is that eix does essentially only access the packages in its database, not the packages in /var/db/pkg - the latter are only compared against the versions in the eix database. So what you can do is e.g. print all packages in the eix database which are installed but either masked or unstable:
Code:
VERSIONS='{installedversion}{!*print}{!isstable}{*print}{}{ismasked}{*print}{}{$print}%{NAMEVERSION}{}{}' FORMAT='<availableversions:VERSIONS>' eix -I --pure-packages
However, this way you will miss all versions which are not in the eix database and, moreover, all packages which are not in the eix database.
I guess, to get the latter you really have to check for every installed version whether it is in the eix database. Using a temporary file, you can e.g. use the following
Code:
eix-installed -a | sort >temp
cat temp | VERSIONS='{isstable}{!ismasked}%{NAMEVERSION}{}{}' FORMAT='<markedversions:VERSIONS>' eix --pipe --pure-packages | sort | comm -23 temp -

malern wrote:
Unfortunately it doesn't seem to work in the way I'd expect. I'm not really sure how it's working, but it's not picking up my packages that are profile masked or locally masked.

This is a bug. Currently, it prints only packages which are not stable and ignores the mask. It will be fixed in >=app-portage/eix-0.22.5.
However, this is not what you want anyway, since it only prints packages and not versions.
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Fri Nov 19, 2010 4:08 pm    Post subject: Reply with quote

Nice one! That does seem to do exactly what I want, thanks for that!
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Sat Nov 20, 2010 12:29 am    Post subject: Reply with quote

DOH!, and here I started coding an "unavailable" module for analyse :!:
:wink:

I'm gonna keep working on it anyway. It'll be using portage and outputting a lot more info about the deprecated pkgs and ebuilds.
Since most of equery has a usable api I'll have it do a reverse dependency lookup and report that as needed. For some a simple up/down grade may be all that is needed. First I'll get the analyse report working then I'll get the rebuild module working to up/downgrade, unmerge and rebuild as required.

so far I have the main code determining the unavailable cat/pkg-versions and working on the report.
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Mon Nov 29, 2010 1:06 pm    Post subject: Reply with quote

dol-sen wrote:
DOH!, and here I started coding an "unavailable" module for analyse :!:
:wink:

I'm gonna keep working on it anyway. It'll be using portage and outputting a lot more info about the deprecated pkgs and ebuilds.

Cool, that sounds very useful. I'd definitely use that as well.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2280
Location: Adendorf, Germany

PostPosted: Mon Nov 29, 2010 2:32 pm    Post subject: Reply with quote

malern wrote:
idella4 wrote:
Just emerge -C package

Yes, I don't have a problem unmerging them manually like that. I guess my subject line is a bit misleading, what I'm really trying to do is get a list of all the masked packages, which I can then unmerge using "emerge -C" like you say. My problem is I don't know how to get the list of masked packages.
Ermmm.. perhaps I misunderstood you, but how about "cat /etc/portage/package.unmask" ? Or maybe, if you want a list of keyworded packages as well, you could use "portpeek -uk". It will tell you what keyworded/masked packages you have there, and which are actually installed.
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Wed Jan 05, 2011 12:19 pm    Post subject: Reply with quote

Sorry, I somehow missed your post.
Yamakuzure wrote:
perhaps I misunderstood you, but how about "cat /etc/portage/package.unmask" ?

Do you mean package.mask? That could work, but I'd also need to combine it with my profiles package.mask as well, and then cross-reference it against my list of currently installed packages (I guess I'd need to write a program to do that which can understand the package.mask format). And yeah, I'd also like to know about keyworded packages, as well packages with missing ebuilds. The eix command that mv came up with seems to achieve this, so I'm using that now.

Basically I'm trying to do the same checks that emerge does before it installs something, but on the list of packages that are already installed. That way I can see which packages I should probably uninstall.

Yamakuzure wrote:
Or maybe, if you want a list of keyworded packages as well, you could use "portpeek -uk". It will tell you what keyworded/masked packages you have there, and which are actually installed.

I'd not heard of portpeek before, I'll definitely check that out, thanks.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2280
Location: Adendorf, Germany

PostPosted: Thu Jan 27, 2011 8:38 am    Post subject: Reply with quote

malern wrote:
Sorry, I somehow missed your post.
Yamakuzure wrote:
perhaps I misunderstood you, but how about "cat /etc/portage/package.unmask" ?

Do you mean package.mask?
No, I meant /etc/portage/package.unmask - the file you have to add entries to to be able to emerge a masked package.
malern wrote:
That could work, but I'd also need to combine it with my profiles package.mask as well, and then cross-reference it against my list of currently installed packages (I guess I'd need to write a program to do that which can understand the package.mask format). And yeah, I'd also like to know about keyworded packages
Those are in /etc/portage/package.keywords
malern wrote:
, as well packages with missing ebuilds.
Those can be found with eclean from app-portage/gentoolkit
malern wrote:
The eix command that mv came up with seems to achieve this, so I'm using that now.

Basically I'm trying to do the same checks that emerge does before it installs something, but on the list of packages that are already installed. That way I can see which packages I should probably uninstall.
What about emerge --ask --depclean ? It definetly comes up with a list of packages that are not needed, and bails out if your installed packages have some unresolved dependencies.

However, eix, portpeek and eclean are a good start, and I don't see why you shouldn't achive what you seek with those. ;)
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
malern
Apprentice
Apprentice


Joined: 19 Oct 2006
Posts: 170

PostPosted: Thu Jan 27, 2011 9:58 am    Post subject: Reply with quote

Yamakuzure wrote:
malern wrote:

Yamakuzure wrote:
perhaps I misunderstood you, but how about "cat /etc/portage/package.unmask" ?

Do you mean package.mask?
No, I meant /etc/portage/package.unmask - the file you have to add entries to to be able to emerge a masked package.
Oh, I see what you mean. My problem is I need to catch packages that have become masked/keyworded after I installed them. Those packages might not have a matching entry in package.unmask/package.keywords because they weren't masked/keyworded to start with.

Yamakuzure wrote:
malern wrote:
Basically I'm trying to do the same checks that emerge does before it installs something, but on the list of packages that are already installed. That way I can see which packages I should probably uninstall.
What about emerge --ask --depclean ? It definetly comes up with a list of packages that are not needed, and bails out if your installed packages have some unresolved dependencies.
depclean almost does what I want, but I need something that checks world packages as well (not just dependencies).

In pseudocode my requirements are
Code:

if (
   (masked || keyworded || missing ebuild || not in world/system set)
   &&
   installed
   &&
   has nothing depending on it
) {
  emerge -C
}

I guess I could remove all masked/keyworded/missing packages from my world file first and then run depclean, but I get a bit paranoid about editing my world file manually.

Yamakuzure wrote:
However, eix, portpeek and eclean are a good start, and I don't see why you shouldn't achive what you seek with those. ;)
Yeah, I'm happy with my solution now, but I definitely appreciate the advice. :)
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Tue Jun 02, 2015 7:33 am    Post subject: Reply with quote

Apheus wrote:
dol-sen wrote:
Doesn't eix have something along those lines as one of it's features though?


Code:

eix-test-obsolete b


This lists "Installed packages with a version not in the database (or masked)". It is part of app-portage/eix.

Any idea why it's listing a package from an overlay as not in the database (or masked)
Quote:
$ eix-test-obsolete

No non-matching entries in /etc/portage/package.keywords.
No non-matching entries in /etc/portage/package.accept_keywords.
No non-matching entries in /etc/portage/package.mask.
No non-matching entries in /etc/portage/package.unmask.
No non-matching or empty entries in /etc/portage/package.use.
No non-matching or empty entries in /etc/portage/package.env.
No non-matching or empty entries in /etc/portage/package.license.
No non-matching or empty entries in /etc/portage/package.accept_restrict.
No non-matching or empty entries in /etc/portage/package.cflags.
The names of all installed packages are in the database.

No redundant entries in /etc/portage/package.{,accept_}keywords
No uninstalled entries in /etc/portage/package.{,accept_}keywords
No redundant entries in /etc/portage/package.mask
No uninstalled entries in /etc/portage/package.mask
No redundant entries in /etc/portage/package.unmask
No uninstalled entries in /etc/portage/package.unmask
Skipping check: redundant entries in /etc/portage/package.use
Skipping check: uninstalled entries in /etc/portage/package.use
Skipping check: redundant entries in /etc/portage/package.env
Skipping check: uninstalled entries in /etc/portage/package.env
No redundant entries in /etc/portage/package.license
No uninstalled entries in /etc/portage/package.license
No redundant entries in /etc/portage/package.accept_restrict
No uninstalled entries in /etc/portage/package.accept_restrict
Skipping check: redundant entries in /etc/portage/package.cflags
Skipping check: uninstalled entries in /etc/portage/package.cflags

Installed packages with a version not in the database (or masked):
[I] net-print/brother-genml1-bin [1] (3.1.0-r1[?]@03/14/2015): Generic Brother rinter driver for DCP-7060D, DCP-7065DN, DCP-8080DN, DCP-L2520DW, DCP-L2540DW, L-2230, HL-2240, HL-2240D, HL-2270DW, HL-2280DW, HL-5370DW/HL-5370DWT, HL-5440D HL-5450DN, HL-5470DW, HL-6180DW, HL-L2320D, HL-L2360DW, HL-L2380DW, MFC-7360N,MFC-7460DN, MFC-7860DW, MFC-8480DN, MFC-8510DN, MFC-8710DW, MFC-8890DW, MFC-891DW, MFC-8950DW, MFC-L2700DW, MFC-L2720DW, MFC-L2740DW
[1] "brother-overlay" /usr/local/overlay/brother-overlay

This is after eix-update, the package is not masked and the overlay is known by
/usr/local/overlay/brother-overlay wrote:
[brother-overlay]
location = /usr/local/overlay/brother-overlay
sync-type = git
sync-uri = git://github.com/stefan-langenmaier/brother-overlay.git
auto-sync = yes
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Tue Jun 02, 2015 11:57 am    Post subject: Reply with quote

charles17 wrote:
[I] net-print/brother-genml1-bin [1] (3.1.0-r1[?]@03/14/2015)

The [?] indicates that eix is not able to determine the overlay you installed it from. Hence, this (unknown) overlay differs from [1] (which is known).
Perhaps the name of the overlay has changed? (The name is stored in /var/db/pkg/net-print/brother-genml1-bin/repository)
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Tue Jun 02, 2015 1:49 pm    Post subject: Reply with quote

mv wrote:
(The name is stored in /var/db/pkg/net-print/brother-genml1-bin/repository)
Good to know.
Unmerging and again emerging the package finally solved the confusion.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum