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

Possible to use other source? #8

Open
symball opened this issue Jun 14, 2017 · 3 comments
Open

Possible to use other source? #8

symball opened this issue Jun 14, 2017 · 3 comments

Comments

@symball
Copy link

symball commented Jun 14, 2017

If possible, how does a person use a different source for the python package as demonstrated below?

pip2pkgbuild git+https://github.com/fabpot/sphinx-php.git
[ERROR] : Python module not found: git+https://github.com/fabpot/sphinx-php.git
@symball
Copy link
Author

symball commented Jun 14, 2017

After looking through the source code for this script, I see my suggestion (currently is impossible ) because some of the URLs are hard-coded to use the python website.

I'm a developer but not so familiar with python and see that (in the example I gave above) it would take more than just adding support for an extra parameter to change the source to make it work. Rather than just closing it myself, I'll leave the message here as food for thought

@wenLiangcan
Copy link
Owner

Adding support for git repoes is a good idea. The difficult part is fetching meta data of the python module(version, licensing etc.), one way comes up in my mind now is to parse the setup.py file.

There's also another issue I concern, I want to keep the script without any external dependencies, so, I hope dealing with git would not need to import third party modules.

@hseg
Copy link
Contributor

hseg commented Aug 5, 2024

Playing around a little, it appears that we could guess the source url to be curl -L "$MODULE_JSON" | jq '.info.project_urls | .Source // .Homepage'.
We could then guess that the tag that provides the release is named after the release, and just generate source=(git+"$source_url".git#tag=$pkgver).

Several problems:

  • We're assuming the VCS is git -- and some of the cleverness I'm suggesting below might not work for the other VCSs makepkg supports (eg Mercurial doesn't support listing remote tags without cloning)
  • The url I guessed above usually works, but it is possible that neither guess is correct, nor that appending .git to the url is correct for the forge used (it does work for Github, Gitlab, and sourcehut, though)
  • We need to weigh either using a VCS source set to point to a given tag (requires the VCS tool as a makedepend, is slightly heavier on the packager because it pulls in the entire revision history; OTOH gives marginally more indication against xz-like supply chain attacks) or figuring out a way of locating where the release tarballs are located for the forge (which may end up being a pile of special cases, falling back to telling the user to search for themselves)
  • Some projects tag their releases slightly differently from the version number, eg by prepending v to it. For Git specifically, we could find/suggest the user run curl -L "$MODULE_JSON" | jq -r '"git ls-remote --tags \(.info.project_urls | .Source // .Homepage) *\(.releases | to_entries[-1].key)"' to find the appropriate tag (IOW, git ls-remote --tags "$source_url" *"$pkgver"). Note that annotated tags will give two results if you naively glob on both ends, cf eg gengive)

I'm not sure that it's worth reparsing the metadata -- while we may want to change the source url, especially in view of https://rfc.archlinux.page/0020-sources-for-python-packaging/, we don't necessarily

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

No branches or pull requests

3 participants