Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 365691 - dev-util/pkgcheck: should check for double definition of a phase function
Summary: dev-util/pkgcheck: should check for double definition of a phase function
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PkgCore (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PkgCore project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-02 09:43 UTC by Justin Lecher (RETIRED)
Modified: 2023-09-23 15:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher (RETIRED) gentoo-dev 2011-05-02 09:43:35 UTC
Repoman should cry if a phase function is defined twice inside the ebuild
Comment 1 SpanKY gentoo-dev 2011-05-02 12:11:16 UTC
this might be hard to do.  valid ebuild:
if ......
src_compile() {
.....
}
else
src_compile() {
.....
}
fi
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2011-05-02 12:12:57 UTC
That's right.

I just found an ebuild which had

src_install() { ...}

...

src_install() {...}

That's where my idea came from.
Comment 3 Zac Medico gentoo-dev 2011-05-02 15:54:28 UTC
(In reply to comment #0)
> Repoman should cry if a phase function is defined twice inside the ebuild

I'm not sure if it's worth adding a check for stuff like this.

(In reply to comment #1)
> this might be hard to do.  valid ebuild:
> if ......
> src_compile() {
> .....
> }
> else
> src_compile() {
> .....
> }
> fi

If we assume that the functions would be indented in this case, then it's easy. Otherwise, not so easy, and not really worth the effort.

It seems like a questionable practice though anyway. Why not just put the if/else inside the function?
Comment 4 SpanKY gentoo-dev 2011-05-02 16:46:39 UTC
the funcs would not be indented.  if the if statement is checking PV, and the funcs share no common code, then i dont see any harm in it.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-12 03:18:40 UTC
repoman support has been removed per bug 835013.

Please file a new bug (or, I suppose, reopen this one) if you feel this check is still applicable to pkgcheck and doesn't already exist.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-12 03:22:35 UTC
I don't think pkgcheck does this right now.
Comment 7 Larry the Git Cow gentoo-dev 2023-09-23 15:41:19 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=8abeb154ed6047cd730ceb242a2fa08a486f739f

commit 8abeb154ed6047cd730ceb242a2fa08a486f739f
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2023-09-19 18:09:54 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2023-09-23 15:36:03 +0000

    DuplicateFunctionDefinition: new check for duplicate global functions
    
    Closes: https://bugs.gentoo.org/365691
    Resolves: https://github.com/pkgcore/pkgcheck/issues/624
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 src/pkgcheck/checks/codingstyle.py                 | 28 ++++++++++++++++++----
 .../DuplicateFunctionDefinition/expected.json      |  2 ++
 .../DuplicateFunctionDefinition-0.ebuild           | 21 ++++++++++++++++
 3 files changed, 47 insertions(+), 4 deletions(-)