-
Notifications
You must be signed in to change notification settings - Fork 32
MissingRemoteId: also check EGIT_REPO_URI #643
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -702,6 +702,14 @@ def feed(self, pkgset): | |
| urls = set(filter(self.__filter_url, all_urls)) | ||
| urls = sorted(urls.union(pkg.homepage), key=len) | ||
|
|
||
| if "git-r3" in pkg.inherited and hasattr(pkg, "environment"): | ||
| egit_repo_uri = re.compile(r"^declare -- EGIT_REPO_URI=\"(.*)\"$") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're hardcoding that bash currently uses For the regex, this should be moved to a class var; it both is easier to spot it, and it avoids Your code here implies pkgcore should provide a better api for this, also.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also- considering that regex has mild complexity to get it right- as I mentioned for things like export or array- perhaps this should be broke out in a later PR as a util func, and other regex's rebased to it? |
||
| for env_line in pkg.environment.data.splitlines(): | ||
| result = re.search(egit_repo_uri, env_line) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if result: | ||
| urls.append(result.group(1).removesuffix(".git")) | ||
| break | ||
|
|
||
| for remote_type, regex in self.remotes_map: | ||
| if remote_type in remotes: | ||
| continue | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", "package": "MissingRemoteId", "remote_type": "gitlab", "value": "pkgcore/pkgcheck/extra/MissingRemoteId", "uri": "https://gitlab.com/pkgcore/pkgcheck/extra/MissingRemoteId/-/archive/1/MissingRemoteId-1.tar.bz2"} | ||
| {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", "package": "MissingRemoteId", "remote_type": "kde-invent", "value": "pkgcore/pkgcheck", "uri": "https://invent.kde.org/pkgcore/pkgcheck"} | ||
| {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", "package": "MissingRemoteId", "remote_type": "heptapod", "value": "pkgcore/pkgcore", "uri": "https://foss.heptapod.net/pkgcore/pkgcore/-/archive/4/MissingRemoteId-4.tar.bz2"} | ||
| {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", "package": "MissingRemoteId", "remote_type": "pypi", "value": "MissingRemoteId", "uri": "https://files.pythonhosted.org/packages/source/M/MissingRemoteId/MissingRemoteId-1.tar.gz"} | ||
| {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", "package": "MissingRemoteId", "remote_type": "sourceforge", "value": "pkgcheck", "uri": "https://downloads.sourceforge.net/pkgcheck/MissingRemoteId-2.tar.gz"} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,14 @@ | ||
| --- eapis-testing/MissingRemoteIdCheck/MissingRemoteId/metadata.xml | ||
| +++ fixed/MissingRemoteIdCheck/MissingRemoteId/metadata.xml | ||
| @@ -3,6 +3,10 @@ | ||
| @@ -3,6 +3,11 @@ | ||
| <pkgmetadata> | ||
| <upstream> | ||
| <remote-id type="bitbucket">pkgcore/pkgcheck</remote-id> | ||
| + <remote-id type="gitlab">pkgcore/pkgcheck/extra/MissingRemoteId</remote-id> | ||
| + <remote-id type="heptapod">pkgcore/pkgcheck</remote-id> | ||
| + <remote-id type="pypi">MissingRemoteId</remote-id> | ||
| + <remote-id type="sourceforge">pkgcheck</remote-id> | ||
| + <remote-id type="kde-invent">pkgcore/pkgcheck</remote-id> | ||
| </upstream> | ||
| <use> | ||
| <flag name="test">enable tests</flag> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| EAPI=7 | ||
|
|
||
| inherit git-r3 | ||
|
|
||
| DESCRIPTION="Check EGIT_REPO_URI" | ||
| HOMEPAGE="https://pkgcore.github.io/pkgcheck/" | ||
| EGIT_REPO_URI="https://invent.kde.org/pkgcore/pkgcheck.git" | ||
| LICENSE="BSD" | ||
| SLOT="0" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Copyright 1999-2024 Gentoo Authors | ||
| # Distributed under the terms of the GNU General Public License v2 | ||
|
|
||
| # @ECLASS: git-r3.eclass | ||
| # @MAINTAINER: | ||
| # Michał Górny <mgorny@gentoo.org> | ||
| # @SUPPORTED_EAPIS: 7 8 | ||
| # @BLURB: Eclass for fetching and unpacking git repositories. | ||
| # @DESCRIPTION: | ||
| # Third generation eclass for easing maintenance of live ebuilds using | ||
| # git as remote repository. | ||
|
|
||
| case ${EAPI} in | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is out of scope for your PR, just an observation. I suspect we should inject a function into ebuild/eclass environment tests that is What's others thoughts? And are there are other areas we should do this? Having the capability I'd expect would lead to finding usage. IE, if we build the injection- is it just for this, or are we improving the general case of our tests? |
||
| 7|8) ;; | ||
| *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; | ||
| esac | ||
|
|
||
| if [[ ! ${_GIT_R3_ECLASS} ]]; then | ||
| _GIT_R3_ECLASS=1 | ||
|
|
||
| # @ECLASS_VARIABLE: EGIT_REPO_URI | ||
| # @REQUIRED | ||
| # @DESCRIPTION: | ||
| # URIs to the repository, e.g. https://foo. If multiple URIs are | ||
| # provided, the eclass will consider the remaining URIs as fallbacks | ||
| # to try if the first URI does not work. For supported URI syntaxes, | ||
| # read the manpage for git-clone(1). | ||
| # | ||
| # URIs should be using https:// whenever possible. http:// and git:// | ||
| # URIs are completely insecure and their use (even if only as | ||
| # a fallback) renders the ebuild completely vulnerable to MITM attacks. | ||
| # | ||
| # Can be a whitespace-separated list or an array. | ||
| # | ||
| # Example: | ||
| # @CODE | ||
| # EGIT_REPO_URI="https://a/b.git https://c/d.git" | ||
| # @CODE | ||
|
|
||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is
hasattrneeded here?I don't know this codepath fully- is there an implication that
PackageRepoSourceisn't guaranteed to surface the environment text data? Because from the pkgcore side, it should always be accessible afaik.And if it isn't, I believe that is a bug and should be fixed.