Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ebegin: Output QA warning if call to eend is missing #811

Closed
wants to merge 1 commit into from

Conversation

laumann
Copy link
Contributor

@laumann laumann commented Apr 12, 2022

The idea here is to check if EBEGIN_EEND is set after the phase has been
executed. If so, then a call to eend is probably missing. This is under
the assumption that ebegin-eend invocations should be properly paired
within the same phase.

In ebegin, the EBEGIN_EEND variable is also checked, and, if set,
indicates that ebegin has been called and is missing the closing call to
eend.

I doubt that this check is perfect, but it seems to work in what little
testing I've done.

Closes: https://bugs.gentoo.org/835823
Signed-off-by: Thomas Bracht Laumann Jespersen t@laumann.xyz

The idea here is to check if EBEGIN_EEND is set after the phase has been
executed. If so, then a call to eend is probably missing. This is under
the assumption that ebegin-eend invocations should be properly paired
within the same phase.

In ebegin, the EBEGIN_EEND variable is also checked, and, if set,
indicates that ebegin has been called and is missing the closing call to
eend.

I doubt that this check is perfect, but it seems to work in what little
testing I've done.

Closes: https://bugs.gentoo.org/835823
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
@laumann
Copy link
Contributor Author

laumann commented Apr 12, 2022

For the sake of completeness, here's the very simple ebuild I've tested with:

# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="Testing package"
HOMEPAGE="http://nowhere.com"

LICENSE="GPL-2"
SLOT="0"

pkg_pretend() {
	ebegin "well hello there"
	ebegin "well hello again"
}

pkg_setup() {
	eend 0
}

and the output:

$ ebuild dev-libs/foobar/foobar-0.0.1.ebuild clean setup
Appending /home/tj/sources/gentoo/portage-tester to PORTDIR_OVERLAY...
 * well hello there ...
 * well hello again ...
 * QA Notice: ebegin called, but missing call to eend (phase: pretend)
 * QA Notice: ebegin called, but missing call to eend (phase: pretend)
 * QA Notice: eend called without preceding ebegin (phase: setup)
 [ ok ]

@thesamesam thesamesam requested a review from zmedico April 15, 2022 04:44
Copy link
Member

@zmedico zmedico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants