Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 534548 - Organization and improved handling of package.use as a directory
Summary: Organization and improved handling of package.use as a directory
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-04 01:03 UTC by Adam Feldman
Modified: 2022-10-20 02:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Feldman gentoo-dev 2015-01-04 01:03:49 UTC
When a user opts to make /etc/portage/package.use a directory, the idea is generally to reduce the complexity of a given file, and make the contents of a given file more uniform. By default, portage doesn't know what the user wants in each file, but we can employ a little structure to make things easier.
The proposal here is that when portage automatically writes to a file in the package.use directory, it follows a set of rules to choose which file to write to.

The primary rule that I am proposing at this point in time is that if the USE flag is a USE_EXPAND, that the particular entry be added to the associated file. Generally speaking this would be to write an entry using the $USE_EXPAND category to /etc/portage/package.use/$USE_EXPAND
e.g. cat-egory/pkgname abi_x86_32 would be written to /etc/portage/package.use/abi_x86
cat-egory/pkgname python_targets_python2_7 would be written to /etc/portage/package.use/python_targets.
cat-egory/pkgname linguas_en_GB would be written to /etc/portage/package.use/linguas

An additional rule/feature that would be nice to include with this functionality would be some variable to define the default file to write to.  The current behavior is handle only in alphabetical order.  The proposal for this rule would be to write to the default file when not fulfilling another rule, and this file is read last when portage reads the files in the package.use directory (to maintain the current behavior that the default file (alphabetically last) is read last.
Comment 1 Arfrever Frehtes Taifersar Arahesis 2015-01-04 16:35:13 UTC
Current behavior has a rationale:
`man emerge`:
"--autounmask-write [ y | n ]
  If --autounmask is enabled, changes are written to config files, respecting
  CONFIG_PROTECT and --ask. If the corresponding package.* is a file, the
  changes are appended to it, if it is a directory, changes are written to
  the lexicographically last file. This way it is always ensured that the
  new changes take precedence over existing changes."

I suggest that you manually edit /etc/portage/package.use in a way preferred by you.
Comment 2 Adam Feldman gentoo-dev 2015-01-04 18:21:34 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #1)
> Current behavior has a rationale:
> `man emerge`:
> "--autounmask-write [ y | n ]
>   If --autounmask is enabled, changes are written to config files, respecting
>   CONFIG_PROTECT and --ask. If the corresponding package.* is a file, the
>   changes are appended to it, if it is a directory, changes are written to
>   the lexicographically last file. This way it is always ensured that the
>   new changes take precedence over existing changes."
> 
> I suggest that you manually edit /etc/portage/package.use in a way preferred
> by you.

Right, so in this case (just considering the USE_EXPAND case), let's consider two classes of changes, USE_EXPAND related ones, and non-USE_EXPAND related ones:

USE_EXPAND:
These would be written to their USE_EXPAND file, so the concern of another file overriding it only happens if the user manually adds a USE_EXPAND entry to another file that is lexographically after the name of the USE_EXPAND

non-USE_EXPAND:
These would be written to the lexographically last file, ensuring the current behavior persists.

Now, let's look at the additional rule that I proposed (which isn't necessary, but makes the USE_EXPAND situation a little cleaner), this basically would do the following:
for writing, would be modified to:
if [ -z "${DEFAULT_PKG_USE_FILE}" ] ; then
   write to ${DEFAULT_PKG_USE_FILE}
else
   write to lexographically last file
fi
and parsing, would be modified to:
parse lexographically
if [ -z "${DEFAULT_PKG_USE_FILE}" ] ; then
   parse ${DEFAULT_PKG_USE_FILE}

fi
Comment 3 Adam Feldman gentoo-dev 2015-01-04 18:24:09 UTC
s/lexographically/lexicographically/g