View previous topic :: View next topic |
Author |
Message |
hedmo Veteran
Joined: 29 Aug 2009 Posts: 1305 Location: sweden
|
Posted: Mon Nov 23, 2020 5:19 am Post subject: info when a build fails in the ebuild.(solved) |
|
|
hi
i like to get some help with ebuilds . if a package fails to compile , i like to give info . like in chromium when it fails to compile and
you have FEATURES="ccache" . it will give you a info to disable ccache and retry before creating a bug.
Code: |
chromium_pkg_die() {
if [[ "${EBUILD_PHASE}" != "compile" ]]; then
return
fi
# ccache often causes bogus compile failures, especially when the cache gets
# corrupted.
if has ccache ${FEATURES}; then
ewarn
ewarn "You have enabled ccache. Please try disabling ccache"
ewarn "before reporting a bug."
ewarn
fi
|
regards
Last edited by hedmo on Mon Nov 23, 2020 10:25 am; edited 1 time in total |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2727
|
Posted: Mon Nov 23, 2020 6:08 am Post subject: |
|
|
It doesn't look much documented (nor used much), but can use EBUILD_DEATH_HOOKS which I believe(?) is a portage-specific extension.
portage has a function to register those (register_die_hook()) but seems nobody use it likely to avoid failing with non-portage, and instead add it manually like below.
Gave it a try, ebuild: Code: | # Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION="Set for failure"
HOMEPAGE=""
LICENSE="freedist"
SLOT="0"
KEYWORDS="~amd64 ~x86"
has dying_message ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" dying_message"
dying_message() {
ewarn
ewarn "Hmmm '${EBUILD_PHASE}' sure looks empty.. I guess we can't use this."
ewarn "But we're getting an error message anyway!"
if has news ${FEATURES}; then
ewarn "By the way, aren't news wonderful?"
fi
ewarn
}
S=${WORKDIR}
src_compile() { emake; } |
Results: Code: | # emerge useless-apps/die
Calculating dependencies... done!
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) useless-apps/die-0::gentoo
>>> Unpacking source...
>>> Source unpacked in /tmp/portage/useless-apps/die-0/work
>>> Preparing source in /tmp/portage/useless-apps/die-0/work ...
>>> Source prepared.
>>> Configuring source in /tmp/portage/useless-apps/die-0/work ...
>>> Source configured.
>>> Compiling source in /tmp/portage/useless-apps/die-0/work ...
make -j11
make: *** No targets specified and no makefile found. Stop.
* ERROR: useless-apps/die-0::gentoo failed (compile phase):
* emake failed
*
* If you need support, post the output of `emerge --info '=useless-apps/die-0::gentoo'`,
* the complete build log and the output of `emerge -pqv '=useless-apps/die-0::gentoo'`.
* The complete build log is located at '/var/log/portage/useless-apps:die-0:20201123-060225.log.gz'.
* The ebuild environment file is located at '/tmp/portage/useless-apps/die-0/temp/environment'.
* Working directory: '/tmp/portage/useless-apps/die-0/work'
* S: '/tmp/portage/useless-apps/die-0/work'
*
* Hmmm '' sure looks empty.. I guess we can't use this.
* But we're getting an error message anyway!
* By the way, aren't news wonderful?
*
>>> Failed to emerge useless-apps/die-0, Log file:
[...] |
|
|
Back to top |
|
|
hedmo Veteran
Joined: 29 Aug 2009 Posts: 1305 Location: sweden
|
Posted: Mon Nov 23, 2020 7:24 am Post subject: |
|
|
Ionen wrote: | It doesn't look much documented (nor used much), but can use EBUILD_DEATH_HOOKS which I believe(?) is a portage-specific extension.
portage has a function to register those (register_die_hook()) but seems nobody use it likely to avoid failing with non-portage, and instead add it manually like below.
Gave it a try, |
Ionen
thanks it worked as i wanted. |
|
Back to top |
|
|
|
|
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
|
|