Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Masking a package based on a condition
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
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 109

PostPosted: Thu Feb 20, 2025 10:40 am    Post subject: [solved] Masking a package based on a condition Reply with quote

Hi!

I have been wondering for a while: Is it possible to mask a package based on a condition (e.g. based on the version of another package)?

Use case:
It regularly happens during my system updates that portage schedules packages for merging which then result in a slot conflict, because another package depends on the current (lower) version of the package that is scheduled to be merged.

Example:
When I ran
Code:
sudo emerge -uDUva --keep-going --with-bdeps=y @world

today, I observed the following slot conflict:

Code:
WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict:

sci-mathematics/pari:0

  (sci-mathematics/pari-2.17.1:0/9::gentoo, ebuild scheduled for merge) USE="X data doc gmp threads -examples -fltk -test" ABI_X86="(64)" conflicts with
    sci-mathematics/pari:0/8=[threads] required by (sci-mathematics/giac-1.9.0.995-r2:0/0::gentoo, installed) USE="ecm glpk gui -ao -doc -examples -gc -test" ABI_X86="(64)" L10N="en -el -es -pt"
                        ^^^^^         
    <sci-mathematics/pari-2.16.0 required by (sci-mathematics/sagemath-standard-10.5:0/0::sage-on-gentoo, installed) USE="X jmol latex -debug -doc -test" ABI_X86="(64)" PYTHON_TARGETS="python3_10 python3_11 python3_12"
    ^                     ^^^^^^
    sci-mathematics/pari:0/8= required by (sci-mathematics/lcalc-2.0.5-r2:0/1::gentoo, installed) USE="double pari -double-double -quad-double" ABI_X86="(64)"
                        ^^^^^
    sci-mathematics/pari:0/8= required by (sci-mathematics/eclib-20250122:0/14::gentoo, installed) USE="flint -boost -minimal -test" ABI_X86="(64)"


Current solution:
Currently I either
  • mask a problematic package completely via package.mask and check from time to time whether I can remove the mask or
  • run the update command with the --exclude flag for some time, e.g. sudo emerge -uDUva --keep-going --with-bdeps=y @world --exclude=pari


Ideal solution:
Ideally I would discover that portage already has some mechanism for this (quite common) use case, e.g. by adding a line like
Code:
=sci-mathematics/pari-2.17.1 IF INSTALLED =sci-mathematics/sagemath-standard-10.5

to some file.

My question:
Is it possible to mask a package based on the latest available/installed/etc version of another package?


Last edited by oneone on Fri Feb 21, 2025 10:15 am; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54890
Location: 56N 3W

PostPosted: Thu Feb 20, 2025 11:05 am    Post subject: Reply with quote

oneone,

Code:
WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict:


It's a warning, not an error. Portage is informing you that there is a higher version of sci-mathematics/pari available but you can't have it yet because tho older version is
Code:
required by (sci-mathematics/giac
There is no action required on you part. Portage will do the right thing.

Why would you want to mask it?
It may be that if you were to change a USE flag on giac the 'problem' would go away.
Only the system designer (that's you) can decide that.

The message is for your information only. It may encourage the upstream developers to fix giac too.

As far as I know, conditional masking is not possible.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23123

PostPosted: Thu Feb 20, 2025 2:39 pm    Post subject: Reply with quote

In this case, the problem is caused by a package from the external repository ::sage-on-gentoo. It provided a package which is declared not to allow recent versions of pari. Can you upgrade or remove sagemath-standard? Is the maintainer of ::sage-on-gentoo aware that this requirement is a problem?
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2745

PostPosted: Thu Feb 20, 2025 3:27 pm    Post subject: Reply with quote

This is not a problem, you don't need to mask anything, as others have already pointed out.

You can inform the overlay maintainer about the situation by filing an issue in their github repo, but again, this is not an issue. It's just a warning and it'll be okay until the older version is provided by the overlay and it doesn't block other packages from the main tree or other overlays.

In any case, it's better to inform the maintainer about the situation.

EDIT:

However after trying to install giac I get:

Code:
The following USE changes are necessary to proceed:
 (see "package.use" in the portage(5) man page for more details)
# required by sci-mathematics/giac-1.9.0.995-r2::gentoo
# required by giac (argument)
>=sci-mathematics/pari-2.17.1 threads


And when I apply that in package.use I don't have any such warning. Are you ignoring that message? If not, please give us wgetpaste of your full emerge command with -a replaced with -p switch.

EDIT2: after adjusting a lot of use flags and keywords and deselecting packages I want to keep after this experiment, I get to:

Code:
WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict:

sci-mathematics/pari:0

  (sci-mathematics/pari-2.17.1:0/9::gentoo, ebuild scheduled for merge) USE="X doc gmp threads -data -examples -fltk -test" ABI_X86="(64)" conflicts with
    <sci-mathematics/pari-2.16.0 required by (sci-mathematics/sagemath-standard-10.5:0/0::sage-on-gentoo, ebuild scheduled for merge) USE="X doc jmol -debug -latex -test" ABI_X86="(64)" PYTHON_TARGETS="python3_12 -python3_10 -python3_11"
    ^                     ^^^^^^


Which leads me to believe you might have world pollution.

p.s. those are the adjustments I made, in case you find them useful: https://bpa.st/YVPA

Best Regards,
Georgi
Back to top
View user's profile Send private message
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 109

PostPosted: Thu Feb 20, 2025 9:07 pm    Post subject: Reply with quote

Thank you for all your answers.

First of all, my question is not about this specific slot conflict. It happens every now and then with sagemath, but I'm sure the maintainer of the overlay is aware of those issues most of the time and I don't think that the conflicts themselves are a problem. It's mainly a cosmetic issue that I don't want to see these warnings all the time, because sometimes there are a lot of them.

NeddySeagoon, yes, I get the reasoning that the warnings might inform and motivate the maintainers to resolve the issue. Sometimes they just keep staying for months and it would be nice to switch them off on an individual basis so that I would notice when new ones appear. (Also, btw, I think it is not giac requiring the older version, but sagemath-standard, but that's just a side note) :)

Hu, yes, the maintainer is aware of this specific problem, but I certainly want to keep sagemath-standard. :)

logrusx, thank you for going through all that effort. As mentioned, this specific case is not really the issue, but here are a few remarks anyway:
I suppose you do not have sagemath-standard installed, do you? sagemath-standard depends on pari with the "threads" use flag enabled, so I had that enabled all along and would not have gotten that warning from your first edit. The warning from your second edit is exactly the one that I get. Do you mean by world pollution that I have packages in my world file that are not really installed? Why does this message make you think that?

Best wishes,
oneone
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54890
Location: 56N 3W

PostPosted: Thu Feb 20, 2025 9:31 pm    Post subject: Reply with quote

oneone,

'world pollution' is having packages listed in your world set that have been installed as dependencies of other things.
It happens when you forget to use --oneshot when you are trying to fix something.
World pollution is not an immediate problem. That comes later.

As the package is listed in world, portage will not --depclean it. Rather the package and it's dependencies are retained.
It gets brought to your attention when the ebuild is removed from the repo and portage can no longer resolve it's dependencies.

There is a script on the wiki to check your world file. It can only advise of things that can be --deselected. You may have your own reasons to keep things that are not required for your portage controlled packages.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 109

PostPosted: Thu Feb 20, 2025 9:34 pm    Post subject: Reply with quote

Thank you, NeddySeagoon. I will check my world set for such packages :)
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2745

PostPosted: Fri Feb 21, 2025 7:37 am    Post subject: Reply with quote

oneone wrote:
It's mainly a cosmetic issue that I don't want to see these warnings all the time, because sometimes there are a lot of them.


You better be aware of them. Once you learn to identify the reasons it happens very quickly and you don't feel overburdened with it, in the same time you're always aware of the potential issues.

oneone wrote:
logrusx, thank you for going through all that effort. As mentioned, this specific case is not really the issue, but here are a few remarks anyway:
I suppose you do not have sagemath-standard installed, do you?


I don't have anything of that installed, I just run emerge to see where it'll get to. I have to reinstall my own stuff If I had to install that. However I remember that particular package needed to be added in package.accept_keywords which means it would have been installed.

oneone wrote:
sagemath-standard depends on pari with the "threads" use flag enabled, so I had that enabled all along and would not have gotten that warning from your first edit.


Then you shouldn't have any warning whatsoever, that's why I suspected world pollution, which is explained by Neddy and answers your next question:

oneone wrote:
The warning from your second edit is exactly the one that I get. Do you mean by world pollution that I have packages in my world file that are not really installed? Why does this message make you think that?

Best wishes,
oneone


oneone wrote:
Thank you, NeddySeagoon. I will check my world set for such packages :)


NeddySeagoon wrote:

It gets brought to your attention when the ebuild is removed from the repo and portage can no longer resolve it's dependencies.


Not only that. Having something in world that is just a dependency and should not be there makes portage hold onto it. That means it complicates dependency graph resolution unnecessarily. Situations like the above arise, but not only. Sometimes a dependency gets drop in favor of another. And sometimes those hard or soft block each other which leads to a situation that's not resolvable for portage. And maybe other complications but I can't think of any right now.

I have this script I have tested on my own, it's taken from the forum but I have long lost the thread I took it from:

Code:
# cat cleanup_world.sh
for i in `cat /var/lib/portage/world`
do
  if emerge -p --depclean $i | grep "These are the packages that would be unmerged:">null
  then echo $i >>/var/lib/portage/world-new
  else echo "removing:" $i
  fi
done
mv /var/lib/portage/world /var/lib/portage/world-previous
mv /var/lib/portage/world-new /var/lib/portage/world


It'll backup your old world file as world-previous. After you run it, run emerge -ca to make sure something you don't want cleaned up will not be. If you notice something like that, you emerge --noreplace it.

EDIT: I found a bunch of threads mentioning world cleanup. If you want to read them, run the following search query.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9628
Location: beyond the rim

PostPosted: Fri Feb 21, 2025 9:43 am    Post subject: Re: Masking a package based on a condition Reply with quote

oneone wrote:

My question:
Is it possible to mask a package based on the latest available/installed/etc version of another package?

No.

That would cause an absolute mess in the grand scheme of things.
Back to top
View user's profile Send private message
oneone
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2017
Posts: 109

PostPosted: Fri Feb 21, 2025 10:15 am    Post subject: Reply with quote

logrusx wrote:
Quote:
I have this script I have tested on my own, it's taken from the forum but I have long lost the thread I took it from:


Thanks for sharing the script. I did, however, already find the following script (on this website: https://qubitsandbytes.co.uk/finding-unused-packages-in-gentoo/):

Code:
#!/bin/bash

world_file="/var/lib/portage/world"
deselect="~/deselect"


while read package ; do
    printf "${package}: "
            emerge_check=$(emerge -p --quiet --depclean $package 2>&1)
            if [[ -n ${emerge_check} ]]; then
                printf "Needs to stay in @world\n"
            else
                printf "Can be deselected\n"
                printf "${package}\n" >> ${deselect}
            fi

done < ${world_file}


Indeed, I had a lot of dependencies in my world file and I decided to remove most of them. It was good that I did it manually though, because some of the packages that were suggested for removal were definitely ones that I would want to keep.

E.g. I have app-editors/vim and app-vim/pathogen installed. Because pathogen depends on vim, vim was suggested for removal, but I would want to keep vim, even after unmerging pathogen.

logrusx wrote:
Quote:
Then you shouldn't have any warning whatsoever, that's why I suspected world pollution, ...


The collision still exists and I don't think it has to do with the pollution of my world file. Looking at the ebuild of sagemath-standard I can see that it depends on a lower version of pari than the most recent available one. That is the issue as I understand it.

But, as mentioned - this is not actually my question.

Your comments were very helpful though and I have learned something :)

Genone wrote:
Quote:
No.

That would cause an absolute mess in the grand scheme of things.


Ok, I can believe that it would probably complicate dependency resolution a lot. I was just wondering, whether it is something that one should/would/can do or not.


Thank you for everybody's answers. I think my question is sufficiently answered now. I will mark the thread as [solved] now :)

[Administrator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]
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