Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[NOTABUG] bzip2 and fakeroot
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
Slippery Jim
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 281

PostPosted: Fri Aug 16, 2024 5:04 am    Post subject: [NOTABUG] bzip2 and fakeroot Reply with quote

How do I fix the ebuild for app-arch/bzip2-1.0.8-r5, so it respects FEATURES=fakeroot when building a binary package?

Here's what my xpak looks like:

Code:


james@Two-Spear ~/software/gentoo-target $ tar tvf binpkgs/app-arch/bzip2/bzip2-1.0.8-r5-1.xpak
drwxr-xr-x root/root         0 2024-08-16 11:57 ./
drwxr-xr-x root/root         0 2024-08-16 11:57 ./bin/
-rwxr-xr-x james/james   38928 2024-08-16 11:57 ./bin/bzip2-reference
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/share/
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/share/doc/
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/
-rw-r--r-- root/root       754 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/README.XML.STUFF.bz2
-rw-r--r-- root/root      1298 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/README.COMPILATION.PROBLEMS.bz2
-rw-r--r-- root/root      3344 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/README.bz2
-rw-r--r-- root/root      5332 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/CHANGES.bz2
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/html/
-rw-r--r-- root/root    126958 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/html/manual.html
-rw-r--r-- root/root    183803 2024-08-16 11:57 ./usr/share/doc/bzip2-1.0.8-r5/manual.pdf
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/share/man/
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/share/man/man1/
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/share/man/man1/bzcmp.1.bz2 -> bzdiff.1.bz2
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/share/man/man1/bzless.1.bz2 -> bzmore.1.bz2
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/share/man/man1/bzip2recover.1.bz2 -> bzip2-reference.1.bz2
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/share/man/man1/bzegrep.1.bz2 -> bzgrep.1.bz2
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/share/man/man1/bzfgrep.1.bz2 -> bzgrep.1.bz2
-rw-r--r-- root/root      6166 2024-08-16 11:57 ./usr/share/man/man1/bzip2-reference.1.bz2
-rw-r--r-- root/root       522 2024-08-16 11:57 ./usr/share/man/man1/bzdiff.1.bz2
-rw-r--r-- root/root       709 2024-08-16 11:57 ./usr/share/man/man1/bzgrep.1.bz2
-rw-r--r-- root/root      1918 2024-08-16 11:57 ./usr/share/man/man1/bzmore.1.bz2
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/include/
-rw-r--r-- root/root      6286 2024-08-16 11:57 ./usr/include/bzlib.h
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/bin/
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/bin/bzfgrep -> bzgrep
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/bin/bzegrep -> bzgrep
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/bin/bzless -> bzmore
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/bin/bzcmp -> bzdiff
-rwxr-xr-x james/james    1259 2024-08-16 11:57 ./usr/bin/bzmore
-rwxr-xr-x james/james    2054 2024-08-16 11:57 ./usr/bin/bzgrep
-rwxr-xr-x james/james    2140 2024-08-16 11:57 ./usr/bin/bzdiff
-rwxr-xr-x james/james   14272 2024-08-16 11:57 ./usr/bin/bzip2recover
drwxr-xr-x root/root         0 2024-08-16 11:57 ./usr/lib64/
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/lib64/libbz2.so.1.0 -> libbz2.so.1.0.8
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/lib64/libbz2.so.1 -> libbz2.so.1.0.8
lrwxrwxrwx root/root         0 2024-08-16 11:57 ./usr/lib64/libbz2.so -> libbz2.so.1.0.8
-rwxr-xr-x root/root     78728 2024-08-16 11:57 ./usr/lib64/libbz2.so.1.0.8

bzip2: (stdin): trailing garbage after EOF ignored


Notice how those five binaries didn't get chowned to root:root like everything else did?

fakeroot is working correctly for almost every other package on my system. The only two that do this are bzip2 and systemd-utils.

It's a minor thing, but is annoying AF to see those five files not owned by root when doing a listing.

bzip2-9999 seems to do the right thing, but I'm out of my depth trying to backport its ebuild.

EDIT: As remarked below, it's a "me" problem, and not an ebuild problem; title edited to reflect.


Last edited by Slippery Jim on Fri Aug 16, 2024 12:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
Slippery Jim
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 281

PostPosted: Fri Aug 16, 2024 11:47 am    Post subject: Reply with quote

Additional information and observation:

This is the command I'm using:

Code:
james@Two-Spear ~/software/gentoo-target $ PKGDIR=`pwd -P`"binpkgs" emerge --root=root --sysroot=root --config-root=root -vB app-arch/bzip2


Upon further experimentation, it turns out that I only have the problem when my target directory root is owned by user james. I tried a bunch of other users, like root, portage, bin, guest, but the only one that exhibited the behavior was james, which is who I'm logged in as when running this.

I did get some permissions errors from emerge when I set it to james:root though:

Code:

!!! Directory initialization failed: '/mnt/software/gentoo-target/root/var/lib/portage'
!!! chown('/mnt/software/gentoo-target/root/var/lib/portage', -1, 0)
!!! Directory initialization failed: '/mnt/software/gentoo-target/root/var/cache/edb'
!!! chown('/mnt/software/gentoo-target/root/var/cache/edb', -1, 0)
[Errno 1] Operation not permitted: '/mnt/software/gentoo-target/root/var/lib/gentoo/news/.news-local.unread.portage_lockfile': chown('/mnt/software/gentoo-target/root/var/lib/gentoo/news/.news-local.unread.portage_lockfile', -1, 0)
Cannot chown a lockfile: '/mnt/software/gentoo-target/root/var/lib/gentoo/news/.news-local.unread.portage_lockfile'
Group IDs of current user: 10 18 19 27 78 250 272 1000
[Errno 1] Operation not permitted: '/mnt/software/gentoo-target/root/var/lib/gentoo/news/.news-gentoo.unread.portage_lockfile': chown('/mnt/software/gentoo-target/root/var/lib/gentoo/news/.news-gentoo.unread.portage_lockfile', -1, 0)
Cannot chown a lockfile: '/mnt/software/gentoo-target/root/var/lib/gentoo/news/.news-gentoo.unread.portage_lockfile'
Group IDs of current user: 10 18 19 27 78 250 272 1000

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

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

[ebuild  N     ] app-arch/bzip2-1.0.8-r5:0/1::gentoo to /mnt/software/gentoo-target/root/ USE="-static -static-libs -verify-sig" ABI_X86="(64) -32 (-x32)" 0 KiB

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

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/portage/util/__init__.py", line 1228, in apply_permissions
    os.chown(filename, uid, gid)
PermissionError: [Errno 1] Operation not permitted: '/mnt/software/gentoo-target/root/var/cache/edb/mtimedb'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/emerge", line 57, in main
    retval = emerge_main()
             ^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/_emerge/main.py", line 1309, in emerge_main
    return run_action(emerge_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/_emerge/actions.py", line 4041, in run_action
    retval = action_build(emerge_config, spinner=spinner)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/_emerge/actions.py", line 688, in action_build
    retval = mergetask.merge()
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/_emerge/Scheduler.py", line 1105, in merge
    self._save_resume_list()
  File "/usr/lib/python3.12/site-packages/_emerge/Scheduler.py", line 2133, in _save_resume_list
    mtimedb.commit()
  File "/usr/lib/python3.12/site-packages/portage/util/mtimedb.py", line 127, in commit
    self.__write_to_disk(d)
  File "/usr/lib/python3.12/site-packages/portage/util/mtimedb.py", line 148, in __write_to_disk
    apply_secpass_permissions(
  File "/usr/lib/python3.12/site-packages/portage/util/__init__.py", line 1418, in apply_secpass_permissions
    apply_permissions(
  File "/usr/lib/python3.12/site-packages/portage/util/__init__.py", line 1235, in apply_permissions
    raise OperationNotPermitted(func_call)
portage.exception.OperationNotPermitted: chown('/mnt/software/gentoo-target/root/var/cache/edb/mtimedb', 1000, 0)



(Note: /home/james/software is a symlink to /mnt/software because I ran out of space and was too lazy to grow the home partition)
Back to top
View user's profile Send private message
Slippery Jim
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 281

PostPosted: Fri Aug 16, 2024 12:56 pm    Post subject: Reply with quote

Update 2: Another way I can make it work is to keep the owner:group of the target root as james:james and change the permissions on it to 777. It then works as expected with only the directory permission (and not its contents) changed.

There seems to be other differences between changing the owner and changing the permissions as well:

1) if I chown root:root root ; chmod 755 root, then obviously it's not writable by portage or james, but the package ownerships are correct.
2) if I chown james:james root ; chmod 755 root, then I get the package bug, but I also get all portage's housekeeping files in root/var and root/tmp (even though I'm using -B):

Code:

root/tmp:
total 0

root/var:
total 12
drwxr-xr-x 3 james james 4096 Aug 16 21:24 cache
drwxr-xr-x 4 james james 4096 Aug 16 21:24 lib
drwxrwxrwt 2 james james 4096 Aug 16 21:24 tmp

root/var/cache:
total 4
drwxr-xr-x 2 james james 4096 Aug 16 21:24 edb

root/var/cache/edb:
total 12
-rw-r--r-- 1 james james  85 Aug 16 21:24 mtimedb
-rw-r--r-- 1 james james  49 Aug 16 21:24 vdb_metadata_delta.json
-rw-r--r-- 1 james james 115 Aug 16 21:24 vdb_metadata.pickle

root/var/lib:
total 8
drwxr-xr-x 3 james james 4096 Aug 16 21:24 gentoo
drwxr-sr-x 2 james james 4096 Aug 16 21:24 portage

root/var/lib/gentoo:
total 4
drwxrwxr-x 2 james james 4096 Aug 16 21:24 news

root/var/lib/gentoo/news:
total 8
-rw-rw-r-- 1 james james 166 Aug 16 21:24 news-gentoo.skip
-rw-rw-r-- 1 james james 166 Aug 16 21:24 news-gentoo.unread

root/var/lib/portage:
total 4
-rw-rw---- 1 james james 56 Aug 16 21:24 repo_revisions

root/var/tmp:
total 0



3) weirdly, if I chown james:james root ; chmod 777 root, then I get some of the housekeeping stuff, but I lose the news-gentoo.* and vdb_metadata* files:

Code:

root/tmp:
total 0

root/var:
total 12
drwxr-xr-x 3 james james 4096 Aug 16 21:17 cache
drwxr-xr-x 4 james james 4096 Aug 16 21:17 lib
drwxrwxrwt 2 james james 4096 Aug 16 21:17 tmp

root/var/cache:
total 4
drwxr-xr-x 2 james portage 4096 Aug 16 21:17 edb

root/var/cache/edb:
total 4
-rw-r--r-- 1 james portage 85 Aug 16 21:17 mtimedb

root/var/lib:
total 8
drwxr-xr-x 3 james james   4096 Aug 16 21:17 gentoo
drwxr-sr-x 2 james portage 4096 Aug 16 21:17 portage

root/var/lib/gentoo:
total 4
drwxr-xr-x 2 james james 4096 Aug 16 21:17 news

root/var/lib/gentoo/news:
total 0

root/var/lib/portage:
total 4
-rw-rw---- 1 james portage 56 Aug 16 21:17 repo_revisions

root/var/tmp:
total 0


So, I guess its not a problem with the ebuild, so I'll mark it NOTABUG, but I really wish I knew what portage is trying to do here.

Further insights are welcome, of course.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20476

PostPosted: Fri Aug 16, 2024 10:47 pm    Post subject: Reply with quote

I don't see a related open bug report, so it's probably worth opening one.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Slippery Jim
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 281

PostPosted: Fri Aug 16, 2024 11:19 pm    Post subject: Reply with quote

pjp wrote:
I don't see a related open bug report, so it's probably worth opening one.


If it's not exclusively self-inflicted, then I will, but I want to understand the problem and offer a patch with the report. This situation is a bit of a corner-case, so I'm wary of assuming I'm not doing something wrong.

Why is this ebuild so special? Why is it only those five files in /bin and /usr/bin? How and/or why do target-root permissions interact with portage in general? Stuff like that is relevant to me.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20476

PostPosted: Fri Aug 16, 2024 11:48 pm    Post subject: Reply with quote

I wouldn't guess that it's an ebuild problem but rather something handling the fakeroot portion.

The eclass subdirectory doesn't have much:
Code:
$ grep -ri fakeroot eclass/
eclass/tests/rebar_fix_include_path.sh:EPREFIX="${tmpdir}/fakeroot"
eclass/tests/rebar_remove_deps.sh:EPREFIX="${tmpdir}/fakeroot"
eclass/tests/rebar_set_vsn.sh:EPREFIX="${tmpdir}/fakeroot"
So I'm guessing if there's a bug, it's deeper in portage code.
Code:
grep -lri fakeroot /usr/lib/python3.12/site-packages/ |wc -l
39
So unless you're somehow using the feature incorrectly, it seems like a more notable problem.

What are you doing that produces the error. I'm wondering how complicated it is to try and repeat the problem. In the event of a bug report, I'm guessing they'd too would ask that question.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Slippery Jim
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 281

PostPosted: Sat Aug 17, 2024 4:21 am    Post subject: Reply with quote

pjp wrote:

What are you doing that produces the error. I'm wondering how complicated it is to try and repeat the problem. In the event of a bug report, I'm guessing they'd too would ask that question.


To reproduce the problem, I use two scripts and two directory trees:
Code:
setup.source
mkpkg.sh
config/
package.use/


I also have a local repository with fixups for any ebuilds which fail this and other related scripts, but it's not relevant to bzip2.

Here are my scripts:

This one is sourced by the second one (I have other scripts that use it too):
Code:

#!/bin/sh
# setup.source

# Don't use $PWD. emerge can fail with symlinks in the --root=<path> option.
# Use an absolute real path, a relative path, or `pwd -P`.
MYROOT=root

MYCONFIG=config
MYPKGUSEDIR=package.use

# get the canonical package atom of the last argument (@sets pass through unchanged):
for lastarg in $@; do :; done
MYATOM=`echo ${lastarg} | sed -e '/^@/!d'`
[ ! ${MYATOM} ] &&
    MYATOM=`emerge -q1p ${lastarg} | grep -o -e '[[:alnum:]-]*/[.[:alnum:]_-]*'`

# strip the version part, from back to front.
# see https://projects.gentoo.org/pms/8/pms.html#x1-250003.2
MYPATH=`echo $MYATOM | sed -E -e '
    s/\-r[0-9]+$//
    :x
    s/_alpha[0-9]*$//
    s/_beta[0-9]*$//
    s/_pre[0-9]*$//
    s/_rc[0-9]*$//
    s/_p[0-9]*$//
    tx
    s/\-[0-9]+(\.[0-9]+)*[a-z]{0,1}$//
'`

#### DEBUG
#echo MYROOT = $MYROOT
#echo MYCONFIG = $MYCONFIG
#echo MYPKGUSEDIR = $MYPKGUSEDIR
#echo MYATOM = $MYATOM
#echo MYPATH = $MYPATH
#exit 0
#### DEBUG

# the dot copies the _contents_ of $MYCONFIG into $MYROOT, instead of making a _subdirectory_ named $MYCONFIG, if $MYROOT already exists.
cp -R $MYCONFIG/. $MYROOT/

# copy any existing package.use file for the target package into the root:
cp -R "$MYPKGUSEDIR/" "$MYROOT/etc/portage/"
#[ -d "$MYPKGUSEDIR/$MYPATH" ] && {
#    mkdir -p "$MYROOT/etc/portage/package.use/$MYPATH/"
#    cp "$MYPKGUSEDIR/$MYPATH"/* "$MYROOT/etc/portage/package.use/$MYPATH/"
#}


This one builds the target(s) into the root, and saves the autounmask output for posterity:
Code:

#!/bin/bash
# mkpkg.sh
# ~~~~~~~~~~~
# Create a skeleton root and emerge the given pkg into it from the running environment.
# No chroot, no root required, as long as all the bdeps are installed into the build environment.
#
# The script creates $MYROOT and $MYPKGDIR if they do not exist, and configures portage from $MYCONFIG.
# Note: $MYPKGDIR must be an absolute path, otherwise emerge tries to write something in the build
# environment, which fails with a read-only error if not run as root. Also, if it is run as root, it
# sometimes fails with errors about invalid binpkg.
#
# Usage: ./mkpkg.sh [options] pkg
#   emerges pkg with the given additional options
#
# Options are useful if you want to override some default programs. For example:
#
#   ./mkpkg.sh eudev vim @system
#
# will install @system with eudev instead of udev, and vim instead of nano.
#
# Note: passing -p breaks the autounmask generation.

#!!!!!
# whatever we pass to --root MUST be a real path (no symlinks!!!). I had weird failures because I specified MYROOT=$PWD/root, which expanded to /home/james/software/gentoo-target/root, but software was a symlink to /mnt/software, which was a partition mount:

# * Package 'sys-libs/libcap-2.69' has internal collisions between non-
# * identical files (located in separate directories in the installation
# * image (${D}) corresponding to merged directories in the target
# * filesystem (${ROOT})):
# *
# *      /home/james/software/gentoo-target/root/tcap
# *              /home/james/software/gentoo-target/root/sbin/getcap
# *              /home/james/software/gentoo-target/root/sbin/setcap
# *                      Differences: size, content
# *
# * Package 'sys-libs/libcap-2.69' NOT merged due to internal collisions
# * between non-identical files. If necessary, refer to your elog messages
# * for the whole content of the above message.
# *
# * The following package has failed to build, install, or execute postinst:
# *
# *  (sys-libs/libcap-2.69-3:0/0::gentoo, binary scheduled for merge to '/home/james/software/gentoo-target/root/'), Log file:
# *   '/var/tmp/log/sys-libs:libcap-2.69:20230829-002548.log'
# *
#!!!!!

######################################################################
. ./setup.source
######################################################################

# automatically abort on command error:
set -e

# put these in $ROOT/etc/portage/package.use with the corresponding package.use files:
MYAUTOUNMASKDIR=autounmask/package.use

# Must use an absolute path or emerge falls back to /, I think.
# Permission errors with a relative path.
MYPKGDIR=`pwd -P`/binpkgs

# packagename-version, without the category:
MYPV=`echo $MYATOM | sed -E -e 's,.+/,,'`

#### DEBUG
#echo MYAUTOUNMASKDIR = $MYAUTOUNMASKDIR
#echo MYPKGDIR = $MYPKGDIR
#echo MYPV = $MYPV
#exit 0
#### DEBUG

# first, generate any necessary package.use entries
#
# Prefer "--autounmask-continue --autounmask-only" to "--autounmask-write"
#
# "--autounmask-write" writes to a temporary file, which I then have to merge into the
# lexigraphically last file.
#
# "--autounmask-continue" writes directly to the lexigraphically last file in "etc/package.use".
# We create a file called "zzzz-autounmask" there for it to write to.
touch $MYROOT/etc/portage/package.use/zzzz-autounmask
emerge --root=$MYROOT --sysroot=$MYROOT --config-root=$MYROOT --autounmask-continue --autounmask-only -q ${@}

# save the autounmask generated file to a derivative of the target package name
# (-s means exists and has non-zero size)
[ -s $MYROOT/etc/portage/package.use/zzzz-autounmask ] && {
    mkdir -p "$MYROOT/etc/portage/package.use/$MYPATH/"
    mkdir -p "$MYAUTOUNMASKDIR/$MYPATH/"
    mv "$MYROOT/etc/portage/package.use/zzzz-autounmask" "$MYROOT/etc/portage/package.use/$MYPATH/$MYPV-autounmask"
    cp "$MYROOT/etc/portage/package.use/$MYPATH/$MYPV-autounmask" "$MYAUTOUNMASKDIR/$MYPATH/"
}

# next, make a binary package, preferably using only prebuilt binary DEPEND and RDEPEND packages
#   Regular users can do this if FEATURES=fakeroot is enabled.
#   Otherwise, file ownership will be an issue.
PKGDIR=$MYPKGDIR emerge --keep-going --root=$MYROOT --sysroot=$MYROOT --config-root=$MYROOT -vkb ${@}

exit 0


The directory config/ which gets copied verbatim to be used as the target root has the following contents:

Code:

Contents of config/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
config/:
total 12
drwxr-xr-x 3 james james 4096 Aug 28  2023 .
drwxr-xr-x 6 james james 4096 Aug 17 12:30 ..
drwxr-xr-x 3 james james 4096 Aug 28  2023 etc

config/etc:
total 12
drwxr-xr-x 3 james james 4096 Aug 28  2023 .
drwxr-xr-x 3 james james 4096 Aug 28  2023 ..
drwxr-xr-x 6 james james 4096 Aug 17 11:57 portage

config/etc/portage:
total 36
drwxr-xr-x 6 james james 4096 Aug 17 11:57 .
drwxr-xr-x 3 james james 4096 Aug 28  2023 ..
-rw-r--r-- 1 james james  381 Aug 17 11:57 make.conf
lrwxr-xr-x 1 james james   64 Aug 12 00:44 make.profile -> /var/db/repos/gentoo/profiles/default/linux/amd64/23.0/split-usr
-rw-r--r-- 1 james james   16 Sep 24  2023 package.license
drwxr-xr-x 2 james james 4096 Aug 17 12:17 package.mask
drwxr-xr-x 2 james james 4096 Aug 12 15:06 package.use
drwxr-xr-x 2 james james 4096 Aug 12 14:24 repos.conf
drwxr-xr-x 2 james james 4096 Aug 17 12:34 sets

config/etc/portage/package.mask:
total 12
drwxr-xr-x 2 james james 4096 Aug 17 12:17 .
drwxr-xr-x 6 james james 4096 Aug 17 11:57 ..
-rw-r--r-- 1 james james  220 Aug 17 12:17 package.mask

config/etc/portage/package.use:
total 12
drwxr-xr-x 2 james james 4096 Aug 12 15:06 .
drwxr-xr-x 6 james james 4096 Aug 17 11:57 ..
-rw-r--r-- 1 james james  319 Feb  6  2023 app-alternatives

config/etc/portage/repos.conf:
total 12
drwxr-xr-x 2 james james 4096 Aug 12 14:24 .
drwxr-xr-x 6 james james 4096 Aug 17 11:57 ..
-rw-r--r-- 1 james james   66 Aug 12 14:24 eselect-repo.conf

config/etc/portage/sets:
total 20
drwxr-xr-x 2 james james 4096 Aug 17 12:34 .
drwxr-xr-x 6 james james 4096 Aug 17 11:57 ..
-rw-r--r-- 1 james james   55 Aug 16 08:31 system_james
-rw-r--r-- 1 james james  209 Aug 16 08:19 world_nox
-rw-r--r-- 1 james james  127 Aug 17 12:34 world_x
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/make.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CFLAGS="-O2 -pipe -march=native"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j16 -l14.4"
CHOST="x86_64-pc-linux-gnu"
EMERGE_DEFAULT_OPTS="-j16 -l14.4"
FEATURES="binpkg-multi-instance fakeroot userpriv usersandbox usersync"
USE="-* split-usr threads"
CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3"
PORTAGE_LOGDIR=/var/tmp/log
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/package.license
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
media-gfx/xv xv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/package.mask/package.mask
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# later versions need tons of bogus deps
>=x11-misc/xsnow-2

# later versions strip motif support from gvim.
# vim and gvim versions must match, due to vim-core
>app-editors/gvim-9.0.0099-r1
>app-editors/vim-9.0.0099-r1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/package.use/app-alternatives
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# radio choices
#--------------------------------------------------------
app-alternatives/awk gawk
app-alternatives/bc gnu
app-alternatives/bzip2 reference
app-alternatives/cpio gnu
app-alternatives/gzip reference
app-alternatives/lex flex
app-alternatives/sh bash
app-alternatives/tar gnu
app-alternatives/yacc bison
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/repos.conf/eselect-repo.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# created by eselect-repo

[local]
location = /var/db/repos/local
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/sets/world_nox
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
app-editors/vim
app-portage/gentoolkit
media-fonts/terminus-font
media-sound/alsa-utils
media-video/mplayer
sys-apps/fakeroot
sys-boot/grub
sys-kernel/gentoo-sources
sys-kernel/linux-firmware
www-client/links
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/sets/world_x
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
app-editors/gvim
media-gfx/xv
x11-apps/xclock
x11-apps/xdm
x11-misc/xlockmore
x11-base/xorg-server
x11-terms/xterm
x11-wm/fvwm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of config/etc/portage/sets/system_james
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual/udev
app-editors/vim
sys-apps/fakeroot
@system
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


The directory package.use/ gets overlaid onto root/etc/portage/ by setup.source:

Code:

Contents of package.use/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
package.use/:
total 36
drwxr-xr-x 9 james james 4096 Aug 17 12:26 .
drwxr-xr-x 4 james james 4096 Aug 17 12:49 ..
drwxr-xr-x 3 james james 4096 Aug 15 03:05 app-editors
drwxr-xr-x 3 james james 4096 Aug 14 19:22 app-portage
drwxr-xr-x 3 james james 4096 Aug 15 09:11 dev-python
drwxr-xr-x 4 james james 4096 Aug 14 20:51 sys-apps
drwxr-xr-x 4 james james 4096 Aug 15 02:51 x11-base
drwxr-xr-x 3 james james 4096 Aug 17 12:27 x11-misc
drwxr-xr-x 3 james james 4096 Aug 15 02:55 x11-wm

package.use/app-editors:
total 12
drwxr-xr-x 3 james james 4096 Aug 15 03:05 .
drwxr-xr-x 9 james james 4096 Aug 17 12:26 ..
drwxr-xr-x 2 james james 4096 Aug 15 03:08 gvim

package.use/app-editors/gvim:
total 12
drwxr-xr-x 2 james james 4096 Aug 15 03:08 .
drwxr-xr-x 3 james james 4096 Aug 15 03:05 ..
-rw-r--r-- 1 james james  336 Aug 15 03:07 gvim

package.use/app-portage:
total 12
drwxr-xr-x 3 james james 4096 Aug 14 19:22 .
drwxr-xr-x 9 james james 4096 Aug 17 12:26 ..
drwxr-xr-x 2 james james 4096 Aug 14 20:51 gentoolkit

package.use/app-portage/gentoolkit:
total 12
drwxr-xr-x 2 james james 4096 Aug 14 20:51 .
drwxr-xr-x 3 james james 4096 Aug 14 19:22 ..
-rw-r--r-- 1 james james  262 Aug 14 19:21 gentoolkit-0.6.5

package.use/dev-python:
total 12
drwxr-xr-x 3 james james 4096 Aug 15 09:11 .
drwxr-xr-x 9 james james 4096 Aug 17 12:26 ..
drwxr-xr-x 2 james james 4096 Aug 15 09:12 pyxdg

package.use/dev-python/pyxdg:
total 12
drwxr-xr-x 2 james james 4096 Aug 15 09:12 .
drwxr-xr-x 3 james james 4096 Aug 15 09:11 ..
-rw-r--r-- 1 james james  251 Aug 15 09:12 pyxdg-0.28-r1

package.use/sys-apps:
total 16
drwxr-xr-x 4 james james 4096 Aug 14 20:51 .
drwxr-xr-x 9 james james 4096 Aug 17 12:26 ..
drwxr-xr-x 2 james james 4096 Aug 12 14:48 portage
drwxr-xr-x 2 james james 4096 Aug 13 10:56 systemd-utils

package.use/sys-apps/portage:
total 12
drwxr-xr-x 2 james james 4096 Aug 12 14:48 .
drwxr-xr-x 4 james james 4096 Aug 14 20:51 ..
-rw-r--r-- 1 james james  255 Aug 12 14:46 portage-3.0.65-r1

package.use/sys-apps/systemd-utils:
total 16
drwxr-xr-x 2 james james 4096 Aug 13 10:56 .
drwxr-xr-x 4 james james 4096 Aug 14 20:51 ..
-rw-r--r-- 1 james james  270 Aug 13 10:56 systemd-utils-254.13
-rw-r--r-- 1 james james  542 Aug 13 10:51 systemd-utils-standalone

package.use/x11-base:
total 16
drwxr-xr-x 4 james james 4096 Aug 15 02:51 .
drwxr-xr-x 9 james james 4096 Aug 17 12:26 ..
drwxr-xr-x 2 james james 4096 Aug 15 02:53 xcb-proto
drwxr-xr-x 2 james james 4096 Aug 15 02:51 xorg-server

package.use/x11-base/xcb-proto:
total 12
drwxr-xr-x 2 james james 4096 Aug 15 02:53 .
drwxr-xr-x 4 james james 4096 Aug 15 02:51 ..
-rw-r--r-- 1 james james  274 Aug 15 02:53 xcb-proto-1.17.0

package.use/x11-base/xorg-server:
total 12
drwxr-xr-x 2 james james 4096 Aug 15 02:51 .
drwxr-xr-x 4 james james 4096 Aug 15 02:51 ..
-rw-r--r-- 1 james james  280 Aug 15 02:51 xorg-server-21.1.13-r1

package.use/x11-misc:
total 12
drwxr-xr-x 3 james james 4096 Aug 17 12:27 .
drwxr-xr-x 9 james james 4096 Aug 17 12:26 ..
drwxr-xr-x 2 james james 4096 Aug 17 12:33 xlockmore

package.use/x11-misc/xlockmore:
total 12
drwxr-xr-x 2 james james 4096 Aug 17 12:33 .
drwxr-xr-x 3 james james 4096 Aug 17 12:27 ..
-rw-r--r-- 1 james james  252 Aug 17 12:33 xlockmore-5.71

package.use/x11-wm:
total 12
drwxr-xr-x 3 james james 4096 Aug 15 02:55 .
drwxr-xr-x 9 james james 4096 Aug 17 12:26 ..
drwxr-xr-x 2 james james 4096 Aug 15 02:57 fvwm

package.use/x11-wm/fvwm:
total 12
drwxr-xr-x 2 james james 4096 Aug 15 02:57 .
drwxr-xr-x 3 james james 4096 Aug 15 02:55 ..
-rw-r--r-- 1 james james  372 Aug 15 02:57 fvwm-2.7.0-r1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/app-portage/gentoolkit/gentoolkit-0.6.5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# gentoolkit
###########################################################
# required:
# ---------------------------------------------------------
=app-portage/gentoolkit-0.6.5 python_targets_python3_12
###########################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/app-editors/gvim/gvim
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# gvim
###########################################################
# optional:
# ---------------------------------------------------------
# athena widgets dropped recently :(
# motif widgets dropped later; using local ebuild >:(
#app-editors/gvim gtk
app-editors/gvim motif
###########################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/x11-base/xcb-proto/xcb-proto-1.17.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# xcb-proto
###########################################################
# required:
# ---------------------------------------------------------
# radio choices
=x11-base/xcb-proto-1.17.0 python_targets_python3_12
###########################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/x11-base/xorg-server/xorg-server-21.1.13-r1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# xorg-server
###########################################################
# required:
# --------------------------------------------------------
# any-of ( xephyr xnest xorg xvfb )
=x11-base/xorg-server-21.1.13-r1 xorg
###########################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/sys-apps/portage/portage-3.0.65-r1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# portage
###########################################################
#required:
#--------------------------------------------------------
=sys-apps/portage-3.0.65-r1 python_targets_python3_12
############################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/sys-apps/systemd-utils/systemd-utils-standalone
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# systemd-utils
###########################################################
#required:
#--------------------------------------------------------

# any-of ( kernel-install tmpfiles sysusers udev )
# the correct flags are pulled in by depending ebuilds,
# In particular:
#   openrc requires USE=tmpfiles
#   udev requires USE=udev
#
# Installing it alone requires me to pick at least one.
# Philosophically, this bugs me; why do I need any of them?
sys-apps/systemd-utils tmpfiles
############################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/sys-apps/systemd-utils/systemd-utils-254.13
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# systemd-utils
###########################################################
#required:
#--------------------------------------------------------
=sys-apps/systemd-utils-254.13 python_single_target_python3_12
############################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/x11-wm/fvwm/fvwm-2.7.0-r1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# fvwm
###########################################################
# optional:
# ---------------------------------------------------------
# nice font rendering:
#x11-wm/fvwm truetype

# required:
# ---------------------------------------------------------
=x11-wm/fvwm-2.7.0-r4 python_single_target_python3_12
###########################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/x11-misc/xlockmore/xlockmore-5.71
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# xlockmore
###########################################################
# required:
# ---------------------------------------------------------
# radio choices
=x11-misc/xlockmore-5.71 crypt
###########################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

contents of package.use/dev-python/pyxdg/pyxdg-0.28-r1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# pyxdg
###########################################################
#required:
#--------------------------------------------------------
=dev-python/pyxdg-0.28-r1 python_targets_python3_12
############################################################

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Back to top
View user's profile Send private message
Slippery Jim
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 281

PostPosted: Sat Aug 17, 2024 5:32 pm    Post subject: Reply with quote

Also, AFAICT: when the target root/ is world writable, emerge demands superuser access for any command that doesn't specify -B or -p. In particular, my script will fail the mode 777 test I manually ran above. No idea why world writable status is special.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20476

PostPosted: Mon Aug 19, 2024 3:11 am    Post subject: Reply with quote

Wow. That's rather involved. I thought this was something portage handled with little fuss. 777 permissions seems very wrong, and I don't see any Gentoo documentation on using fakeroot.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Slippery Jim
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 281

PostPosted: Thu Aug 22, 2024 1:28 am    Post subject: Reply with quote

pjp wrote:
Wow. That's rather involved. I thought this was something portage handled with little fuss. 777 permissions seems very wrong, and I don't see any Gentoo documentation on using fakeroot.


Most of the scripting is just to set up a clean minimal target root before building whatever package you want. I just got tired of always retyping all that stuff. The real meat of it is the emerge call in post #2 above, where we set all the directory values.

The 777 thing was completely an accidental discovery; I was trying to get fakeroot to set root UID and GID on all the files, and I thought 777 would at least let it do whatever it needed to. I didn't think emerge itself would choke on it.
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