Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Oneshot (best practices?)
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
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 664
Location: Tokyo, Japan

PostPosted: Sun Apr 15, 2018 4:09 pm    Post subject: Oneshot (best practices?) Reply with quote

I am not clear if I should be using --oneshot as the defacto way I should be emerging packages.

If I understand correctly emerging without it will add that package to my world file. With it, will keep it out of my world file. Apparently, my world file may be "polluted" because I wasn't doing this.

So is there a simple rule? When do I use --oneshot and when do I want to avoid it? What kind of package exactly do I want to populate my world file?

Thanks as usual everyone.

Quote:
--oneshot, -1
Emerge as normal, but do not add the packages to the world file for later updating.
WARNING: This option should only be used for packages that are reachable from the @world package set (those that would not be removed by --depclean), since dependencies of unreachable packages are allowed to be broken when satisfying dependencies of other packages. Broken dependencies of this sort will invalidate assumptions that make it possible for --deep to be disabled by default.
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 19033
Location: here

PostPosted: Sun Apr 15, 2018 4:24 pm    Post subject: Reply with quote

See this example
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10004
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Apr 15, 2018 4:24 pm    Post subject: Reply with quote

Yes, there's are a few simple rules:
  1. If you're re-emerging, always use --oneshot.
  2. If you're emerging something that you don't want to keep, you can use --oneshot to make it eligible for --depclean in the future. That means if you forget to unmerge something you were just checking out, Portage will clean up the mess.
  3. If you're emerging something that you definitely want to keep, don't use --oneshot.
Also, as a corollary to #2 above, if you later decide that you want to keep the package, re-emerge it with --noreplace, which will avoid the actual build but otherwise add it to the @world set so that it will be protected from --depclean. --noreplace is really quick for already installed packages.

Edit: Corrected a bad typo.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.


Last edited by John R. Graham on Sun Apr 15, 2018 4:50 pm; edited 2 times in total
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 664
Location: Tokyo, Japan

PostPosted: Sun Apr 15, 2018 4:43 pm    Post subject: Reply with quote

John R. Graham wrote:
Yes, there's are a few simple rules:
  1. If you're re-emerging, always use --oneshot.
  2. If you're emerging something that you don't want to keep, you can use --oneshot to make it eligible for --depclean in the future. That means if you forget to unmerge something you were just checking out, Portage will clean up the mess.
  3. If you're emerging something that you definitely want to keep, don't use --depclean.
- John


Thank you, everyone. I think I understand.

So basically if I don't want something removed from my system by --depclean or otherwise, I should allow it to be added to my world file?

I'm a little foggy on this bit...
Quote:
If you're emerging something that you definitely want to keep, don't use --depclean.


I've been using
Code:
emerge --depclean (Package name)
when I want to remove a package. Is this incorrect?
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10004
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Apr 15, 2018 4:49 pm    Post subject: Reply with quote

Budoka wrote:
So basically if I don't want something removed from my system by --depclean or otherwise, I should allow it to be added to my world file?
Correct.

Budoka wrote:
I'm a little foggy on this bit...
Quote:
If you're emerging something that you definitely want to keep, don't use --depclean.
I apologize; that was a bad typo on my part. See corrected version above.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 664
Location: Tokyo, Japan

PostPosted: Sun Apr 15, 2018 5:36 pm    Post subject: Reply with quote

John R. Graham wrote:
Budoka wrote:
So basically if I don't want something removed from my system by --depclean or otherwise, I should allow it to be added to my world file?
Correct.

Budoka wrote:
I'm a little foggy on this bit...
Quote:
If you're emerging something that you definitely want to keep, don't use --depclean.
I apologize; that was a bad typo on my part. See corrected version above.

- John


Got it! Thanks!

Next step is to clean up my world now. lol
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10004
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Apr 15, 2018 5:42 pm    Post subject: Reply with quote

Right! That's a part of regular Gentoo hygiene, like brushing & flossing regularly. You can look at it directly, you know: just edit /var/lib/portage/world.

There's a nuance that I should probably explain. For abstruse historical reasons, the contents of the /var/lib/portage/world file actually describes the members of the @selected set. The @world set actually consists of the union of (i.e., all members of) the @profile, @system, and @selected sets. This is why "emerge -u @world" will update your whole system. Thus you can individually update:
  • @selected: Just the packages you've explicitly installed (and their dependencies).
  • @system: Just the underlying basic Gentoo system packages (and their dependencies).
  • @world: All of the above.
- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Sun Apr 15, 2018 6:54 pm    Post subject: Reply with quote

The @world set only include explicitly installed packages. The set that includes all packages is @installed.

Some emerge invocations allow to reach packages included in the @installed set but those packages are not included in the @world set.

Code:
emerge -upD @world
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10004
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Apr 15, 2018 9:02 pm    Post subject: Reply with quote

Mr. T., this is almost wholly incorrect. The @world set has never been defined that way, even back before sets were formalized in Portage. See my explanation above. However, there are some confusing historical artifacts, namely that the world file, which does contain explicitly emerged packages, is not what defines the members of the @world set.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Mon Apr 16, 2018 5:53 am    Post subject: Reply with quote

John R. Graham, I should have been more explicit! Foremost, this is @selected-packages that matches packages specified in /var/lib/portage/world [man emerge].
Finally, several indications confirm that @world does not include dependencies.

  1. "A set is a convenient shorthand for a large group of packages."
  2. emerge doesn't indicate dependencies of installed packages.
  3. The @installed set includes all installed packages unlike the @world set.
  4. emerge "displays" a computed tree: a set of packages and their dependencies.
Back to top
View user's profile Send private message
i4dnf
Apprentice
Apprentice


Joined: 18 Sep 2005
Posts: 256
Location: Bucharest, Romania

PostPosted: Mon Apr 16, 2018 10:00 am    Post subject: Reply with quote

man emerge wrote:

set

A set is a convenient shorthand for a large group of packages. Six sets are currently always available: selected-packages, selected-sets, selected, system, profile, and world. selected-packages contains the user-selected "world" packages that are listed in /var/lib/portage/world, while selected-sets contains the nested sets that may be listed in /var/lib/portage/world_sets. system and profile both refer to sets of packages deemed necessary for your system to run properly (the differences between these two sets are documented in portage(5)). selected encompasses both the selected-packages and selected-sets sets, while world encompasses the selected, system and profile sets. (See FILES below for more information.) Other sets can exist depending on the current configuration. The default set configuration is located in the /usr/share/portage/config/sets directory. User sets may be created by placing files in the /etc/portage/sets/ directory (see portage(5)). Note that a set is generally used in conjunction with --update. When used as arguments to emerge sets have to be prefixed with @ to be recognized. Use the --list-sets action to display a list of available package sets.


/usr/share/portage/config/sets/portage.conf wrote:
Code:


# Not much that could be changed for world, so better leave it alone
[world]
class = portage.sets.base.DummyPackageSet
packages = @profile @selected @system

[profile]
class = portage.sets.ProfilePackageSet.ProfilePackageSet

[selected]
class = portage.sets.files.WorldSelectedSet

[selected-packages]
class = portage.sets.files.WorldSelectedPackagesSet

[selected-sets]
class = portage.sets.files.WorldSelectedSetsSet

# Same as for world, though later portage versions might use a different class
[system]
class = portage.sets.profiles.PackagesSystemSet






While @installed is special :

/usr/share/portage/config/sets/portage.conf wrote:

Code:

# A superset of the classic <parameter>world</parameter> target, a set created
# by this class contains SLOT atoms to match all installed packages. Note that
# use of this set makes it impossible for emerge to solve blockers by automatic
# uninstallation of blocked packages.
[installed]
class = portage.sets.dbapi.EverythingSet


_________________
"The only difference between me and a madman is that I am not MAD" (SALVATOR DALI)
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 6733

PostPosted: Mon Apr 16, 2018 12:11 pm    Post subject: Reply with quote

Budoka wrote:
So basically if I don't want something removed from my system by --depclean or otherwise, I should allow it to be added to my world file?

Keep in mind : this is only true strictly to the package you have add to world
if you put gentoo-sources in world, gentoo-sources will be protected ; but this should be read as "only latest gentoo-sources" or "only one version because as long as one version remains, gentoo-sources remains"

That's the classic misunderstanding from users that get their kernel source removed.
If you install and use "gentoo-sources-1", but protect "gentoo-sources", then as soon as a "gentoo-sources-2" appears:
1/ it is an update, so it will be install
2/ gentoo-sources-2 is also "gentoo-sources", and portage will protect gentoo-sources "latest" version, and latest one is now -2
3/ because gentoo-sources-1 is not protect, and "seems" unused (even user use them, portage or any packages install is not using them): removed.

how could you protect gentoo-sources-1?
* by adding gentoo-sources-1 in world instead of gentoo-sources
how could you still get gentoo-sources latest version?
* by adding gentoo-sources in world

Adding gentoo-sources-1 in world protect gentoo-sources-1, but only allow upgrade to gentoo-sources-1*
Adding gentoo-sources in world protect gentoo-sources, but allow upgrade to any gentoo-sources (which mean always latest available)
And because both are protect, portage will continue to install latest gentoo-sources, while gentoo-sources-1 will never get removed until you decide to remove it from world or remove the package yourself.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10004
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Apr 16, 2018 12:21 pm    Post subject: Reply with quote

Mr. T. wrote:
John R. Graham, I should have been more explicit! Foremost, this is @selected-packages that matches packages specified in /var/lib/portage/world [man emerge].
Finally, several indications confirm that @world does not include dependencies.

  1. "A set is a convenient shorthand for a large group of packages."
  2. emerge doesn't indicate dependencies of installed packages.
  3. The @installed set includes all installed packages unlike the @world set.
  4. emerge "displays" a computed tree: a set of packages and their dependencies.
Mr. T,

It's good that youre reading and trying to learn but I'm not sure what we're arguing about. I didn't say that the @world set contained dependencies. What I said was that updating @world (emerge --update) would also update the dependencies of @world. But since this is all sort of drive by / off topic for this thread, let's leave it at that, okay?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Mon Apr 16, 2018 12:50 pm    Post subject: Reply with quote

John R. Graham, I do not wish to debate. Nonetheless, I clarify my explanation with accuracy. In my mind, --oneshot and sets are related.
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