Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to exclude packages from binary built based on suffix?
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
nagmat84
Apprentice
Apprentice


Joined: 27 Mar 2007
Posts: 293

PostPosted: Wed Dec 25, 2024 10:58 am    Post subject: How to exclude packages from binary built based on suffix? Reply with quote

I would like to avoid building binary packages for packages which end with "-meta" and "-bin" on my build server. To this end, I followed the guide Gentoo Wiki: Vinary Package Guide - Excluding creation of Some Packages. My current "EMERGE_DEFAULT_OPTS=" contains
Code:
--buildpkg-exclude \"acct-*/* sys-firmware/* sys-kernel/*firmware* sys-kernel/*-sources net-wireless/wireless-regdb* virtual/* */*-bin */*-meta\"
. Today I noticed that "*/*-bin" and "*/*-meta" are not specific enough, because they also match packages which contain the letters somewhere in the middle of the package name.

What pattern matching syntax does "--buildpkg-exclude" support? A tried to put a "$" into the string to indicate the end of the package name, but that turned out to be invalid (as expected).

The packages which are accidentally matched and excluded from binary package creation are (among others):
Code:
dev-texlive/texlive-metapost    # unintentionally matches */*-meta
dev-libs/xapian-bindings        # unintentionally matches */*-bin
Back to top
View user's profile Send private message
ajgringo619
n00b
n00b


Joined: 01 Nov 2022
Posts: 36

PostPosted: Thu Dec 26, 2024 3:01 am    Post subject: Reply with quote

I went through this when first deciding to use binary packages. Since I've got around 10 VMs now, I've found that excluding pre-built binaries just doesn't give me much of a benefit. In fact, it may actually help with some larger packages (like browsers, kernels, or Rust). With the binaries stored on an NFS server, as opposed to the internet, I find that these packages install much faster. And since disk space is so cheap, that's not much of a factor anymore, either.

Can you describe your current environment in more detail?
Back to top
View user's profile Send private message
nagmat84
Apprentice
Apprentice


Joined: 27 Mar 2007
Posts: 293

PostPosted: Thu Dec 26, 2024 11:09 am    Post subject: Reply with quote

Quote:
Can you describe your current environment in more detail?
My apologies, but I am not going down that path, because I have seen too many discussions being derailed; suddenly the discussion is not about the original question anymore, but about something entirely off-topic. The original question is clear and precise and can be answered without those information. If you are interested in my setup, write me a personal message, but we should keep this discussion focused.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22877

PostPosted: Thu Dec 26, 2024 12:41 pm    Post subject: Reply with quote

From a few minutes looking at the Portage source, I think the string you give is handled by portage.dep.Atom with allow_wildcard=True. This uses _get_atom_wildcard_re to decompose your input into pieces. Perhaps reviewing this regular expression will help with your question.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3781
Location: Rasi, Finland

PostPosted: Thu Dec 26, 2024 12:47 pm    Post subject: Reply with quote

After quickly glancing trough some manpages about ATOMs, I think you may have encountered a bug.
Because I don't see why would */*-bin match anything other than package names ending with -bin.

But after running quick tests on one of my boxes, I did not encounter this problem.
qlist -Iv sys-apps/portage && emerge --version:
sys-apps/portage-3.0.66.1-r1
Portage 3.0.66.1 (python 3.12.8-final-0, default/linux/amd64/23.0, gcc-14, glibc-2.40-r5, 6.1.110-M710q-0.1 x86_64)


Can you reproduce the behavior with, for example:
Code:
emerge -v1 --buildpkg --buildpkg-exclude '*/*-function' sys-apps/gentoo-functions
... this should produce a pkg because of excluding */*-function, without the last 's', doesn't match. And changing the pattern to */*-functions does not produce a pkg.
That on my system at least with the version of Portage listed above.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Banana
Moderator
Moderator


Joined: 21 May 2004
Posts: 1803
Location: Germany

PostPosted: Thu Dec 26, 2024 9:49 pm    Post subject: Reply with quote

@nagmat84

Can you please show us the output of emerge --info?

Maybe your syntax, which you have posted in the first post, is kind of wrong

There is a difference between yours:
Code:
--buildpkg-exclude \"acct-*/* sys-firmware/* sys-kernel/*firmware* sys-kernel/*-sources net-wireless/wireless-regdb* virtual/* */*-bin */*-meta\"

and the one from Zucca
Code:
--buildpkg-exclude '*/*-function' sys-apps/gentoo-functions


Note the use of ' and \"
_________________
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3781
Location: Rasi, Finland

PostPosted: Fri Dec 27, 2024 12:29 am    Post subject: Reply with quote

I believe OP escaped double quotes because those parts were copied from EMERGE_DEFAULT_OPTS from make.conf.
And if the whole value of EMERGE_DEFAULT_OPTS is enclosed by double quotes, then the inner double quotes need to be escaped.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Banana
Moderator
Moderator


Joined: 21 May 2004
Posts: 1803
Location: Germany

PostPosted: Fri Dec 27, 2024 10:17 am    Post subject: Reply with quote

Zucca wrote:
I believe OP escaped double quotes because those parts were copied from EMERGE_DEFAULT_OPTS from make.conf.
And if the whole value of EMERGE_DEFAULT_OPTS is enclosed by double quotes, then the inner double quotes need to be escaped.

No worries, I do know that. But maybe something else is wrong :)
_________________
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3781
Location: Rasi, Finland

PostPosted: Fri Dec 27, 2024 12:38 pm    Post subject: Reply with quote

Yes.
That being said, I'd first change all the escaped double quotes to single quotes... just in case.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
nagmat84
Apprentice
Apprentice


Joined: 27 Mar 2007
Posts: 293

PostPosted: Fri Dec 27, 2024 8:06 pm    Post subject: Reply with quote

I assume we can consider this solved and a "false alarm". I do not know what I changed this time. Maybe it was an encoding error in my make.conf or something similar. After I edited make.conf, cut the entire line and pasted it into the file again, it magically worked.

Quote:
Can you reproduce the behavior with, for example:
Code:
emerge -v1 --buildpkg --buildpkg-exclude '*/*-function' sys-apps/gentoo-functions
... this should produce a pkg because of excluding */*-function, without the last 's', doesn't match. And changing the pattern to */*-functions does not produce a pkg.
I tried this and it worked as it should. That led me to re-write my make.conf and now it works.

Quote:
I believe OP escaped double quotes because those parts were copied from EMERGE_DEFAULT_OPTS from make.conf. And if the whole value of EMERGE_DEFAULT_OPTS is enclosed by double quotes, then the inner double quotes need to be escaped.
Exaxtly. I copied the relevant part from my make.conf. The complete line is
Code:
EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --buildpkg-exclude \"acct-*/* sys-firmware/* sys-kernel/*firmware* sys-kernel/*-sources virtual/* */*-bin */*-meta\""
. That's why the quotation marks were escaped in the initial post.
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