Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Some way to protect packages from --depclean?
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
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 444
Location: Hong Kong

PostPosted: Mon Jun 24, 2024 9:02 am    Post subject: Some way to protect packages from --depclean? Reply with quote

[Administrator note: this post, and the first 8 responses, were originally attached to the 12 year old topic Some way to protect packages from --depclean?. However, this post has a different question. The old thread correctly noted that packages in @world are protected. That solution is not acceptable here because OP intends to keep packages that no longer exist in the tree. -Hu]

Sorry to bring up this old thread. I have the same question with the OP. How to protect packages from --depclean?

I used to have old gentoo-sources listed in the world sets: (6.6.30 is current. 6.6.13 is old.)

Code:
# cat /etc/portage/sets/gentoo-sources
sys-kernel/gentoo-sources
sys-kernel/gentoo-sources:6.6.13
sys-kernel/gentoo-sources:6.6.30


But recently I removed the /var/cache/binpkgs/* (while upgrade to profile 23.0) and some old gentoo-sources is not available in gentoo repos anymore. Having old versions in world sets gives me error while emerge.

Code:
# emerge -pv @world

These are the packages that would be merged, in order:

Calculating dependencies                ... done!
Dependency resolution took 1.04 s (backtrack: 0/20).


emerge: there are no ebuilds to satisfy "sys-kernel/gentoo-sources:6.6.13".
(dependency required by "@gentoo-sources" [set])
(dependency required by "@selected" [set])
(dependency required by "@world" [argument])


So I have to remove the old versions in the world sets files:

Code:
# cat /etc/portage/sets/gentoo-sources
sys-kernel/gentoo-sources
sys-kernel/gentoo-sources:6.6.30


The problem is, while depclean, the old version will be removed, which it is not desired at the moment as I am still using the old version.

Code:
# emerge -pv --depclean
...
 sys-kernel/gentoo-sources
    selected: 6.6.13
   protected: none
     omitted: 6.6.30
...
>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.


I understand I can use the exclude option to avoid removing an old package:

Code:
# emerge -pv --depclean --exclude sys-kernel/gentoo-sources
...
( sys-kernel/gentoo-sources not in the list )
...
>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.


But I notice that in the output of depclean, there is a field "protected:". How to mark a package or a version as "protected:" so it will not by removed while depclean?
_________________
- midnite.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4894
Location: Bavaria

PostPosted: Mon Jun 24, 2024 11:17 am    Post subject: Reply with quote

midnite wrote:
But I notice that in the output of depclean, there is a field "protected:". How to mark a package or a version as "protected:" so it will not by removed while depclean?

You "mark" it with the inclusion in your world-file or your set ;-)

I would suggest to put it again into your /etc/portage/sets/gentoo-sources (or /var/lib/portage/world) and dont care about the message 'there are no ebuilds to satisfy "sys-kernel/gentoo-sources:6.6.13"' ... it is only a message.
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2245

PostPosted: Mon Jun 24, 2024 11:38 am    Post subject: Reply with quote

midnite wrote:


But recently I removed the /var/cache/binpkgs/* (while upgrade to profile 23.0) and some old gentoo-sources is not available in gentoo repos anymore. Having old versions in world sets gives me error while emerge.

Code:
# emerge -pv @world

These are the packages that would be merged, in order:

Calculating dependencies                ... done!
Dependency resolution took 1.04 s (backtrack: 0/20).


emerge: there are no ebuilds to satisfy "sys-kernel/gentoo-sources:6.6.13".
(dependency required by "@gentoo-sources" [set])
(dependency required by "@selected" [set])
(dependency required by "@world" [argument])


So I have to remove the old versions in the world sets files:

Code:
# cat /etc/portage/sets/gentoo-sources
sys-kernel/gentoo-sources
sys-kernel/gentoo-sources:6.6.30




No, you don't have to and that's what created the problem first place - you did something completely unnecessary. As pietinger said, put them back from where you removed them.

Best Regards,
Georgi
Back to top
View user's profile Send private message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 444
Location: Hong Kong

PostPosted: Mon Jun 24, 2024 11:47 am    Post subject: Reply with quote

Thank you pietinger.

pietinger wrote:
You "mark" it with the inclusion in your world-file or your set ;-)


May I ask how to "mark it with the inclusion" ? I tried adding the line <=sys-kernel/gentoo-sources:6.6.30. It does not protect gentoo-sources:6.6.13. It will be removed by depclean as the same as before.

pietinger wrote:

Dont care about the message 'there are no ebuilds to satisfy "sys-kernel/gentoo-sources:6.6.13"' ... it is only a message.


Sadly, when I run emerge -av @world, if gentoo-sources:6.6.13 is in the world set file, emerge quits and does not let me to proceed.
_________________
- midnite.
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2245

PostPosted: Mon Jun 24, 2024 11:51 am    Post subject: Reply with quote

midnite wrote:
Thank you pietinger.

pietinger wrote:
You "mark" it with the inclusion in your world-file or your set ;-)


May I ask how to "mark it with the inclusion" ? I tried adding the line <=sys-kernel/gentoo-sources:6.6.30. It does not protect gentoo-sources:6.6.13. It will be removed by depclean as the same as before.


That's not the correct line. Just put "sys-kernel/gentoo-sources:6.6.30" in world or in a set you've selected

midnite wrote:
pietinger wrote:

Dont care about the message 'there are no ebuilds to satisfy "sys-kernel/gentoo-sources:6.6.13"' ... it is only a message.


Sadly, when I run emerge -av @world, if gentoo-sources:6.6.13 is in the world set file, emerge quits and does not let me to proceed.


If you do it as I told you above, that should not happen. If it does, open a new thread and use

Code:
wgetpaste -ic 'the command you're running'


So that we can get as much information as possible at once and not go through the back and fourth of "provide this, provide that".

And please don't necrobump a 15 y.o. thread. Things in Gentoo change fast as well as the issue usually is not the issue you think it is.

Best Regards,
Georgi
Back to top
View user's profile Send private message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 444
Location: Hong Kong

PostPosted: Mon Jun 24, 2024 12:25 pm    Post subject: Reply with quote

Thank you Georgi.

Case 1. If there is only sys-kernel/gentoo-sources:6.6.30 in the world set file, depclean will remove sys-kernel/gentoo-sources:6.6.13.

Case 2. If there are both sys-kernel/gentoo-sources:6.6.13 and sys-kernel/gentoo-sources:6.6.30 in the world set file, emerge -av @world will not let me to proceed. (More details below.)

I guess you may add an unavailable package, e.g. sys-kernel/gentoo-sources:0.0.00, into the world file to reproduce my issue.

To my understanding, this occurs to me because I have removed the binary packages in /var/cache/binpkgs/*. For other users, emerge will find a previously installed package, (in this case, sys-kernel/gentoo-sources:6.6.13), in the local binary package files. Thus leaving a package, that is unavailable in online Gentoo repos, in the world files will not make emerge -av @world complains about it is not found.

To illustrate "emerge does not let me to proceed. It is not only a message", I have added a package that is not installed into the world set file, which is dev-util/checkbashisms.

Code:
# cat /etc/portage/sets/gentoo-sources
sys-kernel/gentoo-sources
sys-kernel/gentoo-sources:6.6.13
sys-kernel/gentoo-sources:6.6.30
dev-util/checkbashisms


dev-util/checkbashisms was not installed:

Code:
# emerge -pv dev-util/checkbashisms

These are the packages that would be merged, in order:

Calculating dependencies                 ... done!
Dependency resolution took 1.02 s (backtrack: 0/20).

[ebuild  N     ] dev-util/checkbashisms-2.23.5::gentoo  969 KiB

Total: 1 package (1 new), Size of downloads: 969 KiB


emerge does not let me to proceed. It complains about cannot find gentoo-sources:6.6.13.

Code:
# emerge -av @world

These are the packages that would be merged, in order:

Calculating dependencies                ... done!
Dependency resolution took 1.04 s (backtrack: 0/20).


emerge: there are no ebuilds to satisfy "sys-kernel/gentoo-sources:6.6.13".
(dependency required by "@gentoo-sources" [set])
(dependency required by "@selected" [set])
(dependency required by "@world" [argument])
#


If it is only a message, even though sys-kernel/gentoo-sources:6.6.13 is not found, emerge should let me proceed to install dev-util/checkbashisms.

Thank you for suggestion. If the output if too long for a post, I will use wgetpaste.
_________________
- midnite.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22450

PostPosted: Mon Jun 24, 2024 12:39 pm    Post subject: Reply with quote

emerge -av @world tells Portage to try to install every package listed in @world. Every package thus selected must be installable. The old gentoo-sources ebuild no longer exists, so it is not installable. Listing a package in @world that is not presently installed is weird, but legal. Trying to install a package that cannot be installed is not legal.
Back to top
View user's profile Send private message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 444
Location: Hong Kong

PostPosted: Mon Jun 24, 2024 1:40 pm    Post subject: Reply with quote

Thank you Hu.

Hu wrote:
Listing a package in @world that is not presently installed is weird, but legal. Trying to install a package that cannot be installed is not legal.


I manually add dev-util/checkbashisms into world set file for the purpose to illustrate the situation: Having sys-kernel/gentoo-sources:6.6.13 in world set file will not let emerge @world to proceed.

(If I did not manually add a not presently installed package, and all my packages are up to date, emerge @world will not proceed anyway. I could not illustrate the differences.)




Back to the original question. In the output of depclean, there is a field named "protected". How to mark a package or a version such that it appears in the "protected" field?

Code:
# emerge -pv --depclean
...
 sys-kernel/gentoo-sources
    selected: 6.6.13
   protected: none
     omitted: 6.6.30
...
>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.


I came across this thread because it mentioned about the keyword "protect". But it is not concerning about this "protected" field. It is still about the same issue.
_________________
- midnite.
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2245

PostPosted: Mon Jun 24, 2024 2:01 pm    Post subject: Reply with quote

Let me clarify what are the implications of what Hu said are.

Running emerge -av @world is not an update but rather rebuild command. It tells portage everything in world should be rebuilt including the non-existent package. Instead you should run update command by adding -u. And to be more precise, if you want full world update it whould be emerge -avuDU @world or emerge -avuDN @world, the latter should be used if you build binary packages and the former is recommended if you don't as it will not cause unnecessary rebuilds.

Best Regards,
Georgi
Back to top
View user's profile Send private message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 444
Location: Hong Kong

PostPosted: Mon Jun 24, 2024 3:57 pm    Post subject: Reply with quote

Thank you Georgi, and all of you who helped me.

I understand now. It was my careless mistake.

The correct solution is, keeping the old versions (i.e. sys-kernel/gentoo-sources:6.6.13 , etc) in the world set files, even if it is no longer available. This avoids depclean removing them. And update entire system by emerge -avuND @world. With the options --update or --newuse or --changed-use, the unavailable packages will not stop emerge to proceed.

I used to update the system by emerge -avuND @world. I was just lazy and careless, which caused this confusion. Thank you again to everyone.

- - - -

On the other hand, as mentioned in the message from depclean, there is a field called "protected", and it says "'Protected' and 'omitted' packages will not be removed." What does that protected field mean? How to use it? I cannot find any documentation about this.
_________________
- midnite.
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2245

PostPosted: Mon Jun 24, 2024 5:13 pm    Post subject: Reply with quote

midnite wrote:

On the other hand, as mentioned in the message from depclean, there is a field called "protected", and it says "'Protected' and 'omitted' packages will not be removed." What does that protected field mean? How to use it? I cannot find any documentation about this.


It'll show only when there are multiple slots of some package installed. The one protected is required by something, either being a dependency of something, in world or in a user set. If there are multiple versions to be depcelaned and/or multiple versions protected, you'll get multiple entries in the output.

EDIT: actually I'm not sure which is protected and which - omitted. I guess the --exclude option is in play here too but since I don't have anything to clean, I don't see how I can run experiments and the man page or emerge doesn't describe --depclean's output.

Best Regards,
Georgi
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