View previous topic :: View next topic |
Author |
Message |
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Wed Apr 10, 2024 6:18 pm Post subject: Easy filter-lto per package cancellation? |
|
|
Looking for a easy way to workaround filter-lto.
The weakest way I see it is to:
Duplicate original ebuild in local repository.
Optionally revbump final build.
Optionally unkeyword revbumped ebuild.
Edit filter-lto directive.
Emerge new ebuild.
If possible if would be easier to only:
Duplicate original ebuild in [a dedicated] local repository.
Emerge new ebuild.
IIUC, that would require the containing local to be set in a way that would keep all the selected profile mechanisms but filter-lto one,
I went through the gentoo profile support, without working it out.
Any practical [generic] example for such a portage [alike] feature overload?
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22619
|
Posted: Wed Apr 10, 2024 7:08 pm Post subject: |
|
|
Add an on-sync hook to patch flag-o-matic.eclass with the following: Code: | --- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -273,6 +273,10 @@
# Remove flags that enable LTO and those that depend on it
filter-lto() {
[[ $# -ne 0 ]] && die "filter-lto takes no arguments"
+ if [[ -n "${I_KNOW_I_WANT_TO_USE_LTO}" ]]; then
+ ewarn "$P called filter-lto; ignoring. DO NOT FILE BUGS ABOUT THIS PACKAGE."
+ return
+ fi
filter-flags '-flto*' -fwhole-program-vtables '-fsanitize=cfi*'
}
| Then set the corresponding environment variable using package.env. |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Wed Apr 10, 2024 7:19 pm Post subject: |
|
|
Wow, impressively quick response.
Currently stuck with a heavily swapping emerge...
Can't wait to test this
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Wed Apr 10, 2024 10:19 pm Post subject: |
|
|
Hu wrote: | Add an on-sync hook to patch... |
Isn't postsync hook' (Wiki) more accurate, or is it?
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22619
|
Posted: Thu Apr 11, 2024 12:24 am Post subject: |
|
|
Yes, that is a way you could arrange for the patch to be applied at the proper time. |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Sat May 04, 2024 7:16 pm Post subject: |
|
|
Using patched portage tree via rsync on local net fails on verification.
Needs to be fixed...
Working on it...
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Mon Jul 22, 2024 8:16 am Post subject: |
|
|
Code: | acer ~ # cat /etc/portage/postsync.d/filter-lto-no
#!/bin/bash
echo -e "
\033[1;33m*\033[0m Executing $PWD/$(basename $0)
to allow filter-lto portage directive cancellation
by defining I_KNOW_I_WANT_TO_USE_LTO environment variable,
e.g with global scope in /etc/portage/make.conf
or per package scope in /etc/portage/package.env by
referencing /etc/portage/env/filter-lto-no.conf \033[1;33m*\033[0m"
if patch --dry-run -d /var/db/repos/gentoo -p1</usr/local/share/portage/postsync.d/filtered-lto-no.patch;then
#backup is flag-o-matic.eclass.orig
if patch -b -d /var/db/repos/gentoo -p1</usr/local/share/portage/postsync.d/filtered-lto-no.patch;then
echo -e " \033[1;32m*\033[0m succeeded. \033[1;32m*\033[0m "
exit
else
echo -e " \033[1;31m*\033[0m failed to apply patch
/usr/local/share/portage/postsync.d/filtered-lto-no.patch,
cancelling ... \033[1;31m*\033[0m"
fi
else
echo -e " \033[1;31m*\033[0m failed to test patch
/usr/local/share/portage/postsync.d/filtered-lto-no.patch,
cancelling ... \033[1;31m*\033[0m"
fi
if [ ! -d /var/db/repos/gentoo ];then
echo -e " \033[1;31m*\033[0m /var/db/repos/gentoo
directory not found \033[1;31m*\033[0m"
fi
if [ ! -f /usr/local/share/portage/postsync.d/filtered-lto-no.patch ];then
echo -e " \033[1;31m*\033[0m /usr/local/share/portage/postsync.d/filtered-lto-no.patch
file not found \033[1;31m*\033[0m"
fi
acer ~ # cat /usr/local/share/portage/postsync.d/filtered-lto-no.patch
--- a/eclass/flag-o-matic.eclass 2024-04-11 03:53:30.623900746 +0300
+++ b/eclass/flag-o-matic.eclass 2024-04-11 03:55:48.820569057 +0300
@@ -270,6 +270,10 @@
# Remove flags that enable LTO and those that depend on it
filter-lto() {
[[ $# -ne 0 ]] && die "filter-lto takes no arguments"
+ if [[ ${#I_KNOW_I_WANT_TO_USE_LTO} -ne 0 ]]; then
+ ewarn "$P called filter-lto; ignoring. DO NOT FILE BUGS ABOUT THIS PACKAGE."
+ return
+ fi
filter-flags '-flto*' -fwhole-program-vtables '-fsanitize=cfi*'
}
|
The above patch is slighly better as it allows cancellation of a defaulted I_KNOW_I_WANT_TO_USE_LTO variable in /etc/portage/make.conf.
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3687 Location: Rasi, Finland
|
Posted: Mon Jul 22, 2024 10:10 am Post subject: |
|
|
Side notice:Doesn't e-commands work in the scope/environment where scripts under /etc/portage/postsync.d are sourced, or why are you using escape sequences? _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Mon Jul 22, 2024 10:16 am Post subject: |
|
|
@Zucca,
Escape sequences here 4 little nicer ouputs...
No idea about e-commands...
Anyone with better insight?
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3687 Location: Rasi, Finland
|
Posted: Mon Jul 22, 2024 10:41 am Post subject: |
|
|
CaptainBlood wrote: | No idea about e-commands... |
snip of man 5 ebuild: | Output:
einfo "disposable message"
Same as elog, but should be used when the message isn’t im‐
portant to the user (like progress or status messages dur‐
ing the build process).
elog "informative message"
If you need to display a message that you wish the user to
read and take notice of, then use elog. It works just like
echo(1), but adds a little more to the output so as to
catch the user’s eye. The message will also be logged by
portage for later review.
ewarn "warning message"
Same as einfo, but should be used when showing a warning to
the user.
eqawarn "QA warning message"
Same as einfo, but should be used when showing a QA warning
to the user.
eerror "error message"
Same as einfo, but should be used when showing an error to
the user.
ebegin "helpful message"
Like einfo, we output a helpful message and then hint that
the following operation may take some time to complete.
Once the task is finished, you need to call eend.
eend <status> ["error message"]
Followup the ebegin message with an appropriate "OK" or
"!!" (for errors) marker. If status is non-zero, then the
additional error message is displayed. | Again... Not sure if these work in the scope you are writing the script for, but worth of a try? _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Mon Jul 22, 2024 10:51 am Post subject: |
|
|
To clarify new patch, testing length of I_KNOW_I_WANT_TO_USE_LTO variable allows to differentiate the 2 following cases:
1) variable is unset or equal to ""
2) variable is set to any non null string
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Mon Jul 22, 2024 11:02 am Post subject: |
|
|
TODO:
../eclass/flag-o-matic.eclass location && file availability aren't tested.
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3687 Location: Rasi, Finland
|
Posted: Mon Jul 22, 2024 12:00 pm Post subject: |
|
|
I'd maybe use Code: | if [[ ! -z "${I_KNOW_I_WANT_TO_USE_LTO}" ]] | ! -z meaning "NOT zero length".
Although just Code: | [[ "${I_KNOW_I_WANT_TO_USE_LTO}" ]] | or Code: | [[ -n "${I_KNOW_I_WANT_TO_USE_LTO}" ]] | ... should lead to the same result in bash at least.
Note that empty values containing white space will still return true. Something like yesno() -function from /lib/gentoo/functions.sh could strengthen check. this code is in POSIX sh: | #
# this function was lifted from OpenRC. It returns 0 if the argument or
# the value of the argument is "yes", "true", "on", or "1" or 1
# otherwise.
#
yesno()
{
[ -z "$1" ] && return 1
case "$1" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
esac
local value=
eval value=\$${1}
case "$value" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
*) vewarn "\$$1 is not set properly"; return 1;;
esac
} |
Side railing a bit:
Long time ago I read somewhere that ! -z and -n were not exactly the same in some circumstances. That's why I've kept using ! -z. However snip of man bash: | -z string
True if the length of string is zero.
string
-n string
True if the length of string is non-zero. | ... states that those two are exact opposites of each other. The same statement can be read from man test too. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3848
|
Posted: Tue Jul 23, 2024 7:13 pm Post subject: |
|
|
Total rubbish on my side...
Original patch is fine, my test case was rotten to the bone. Once again...
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
|