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

maintainers/scripts/update-python-libraries: support fetchFromGitHub #41149

Closed
wants to merge 2 commits into from

Conversation

dotlambda
Copy link
Member

@dotlambda dotlambda commented May 27, 2018

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

cc @seppeljordan

@dotlambda
Copy link
Member Author

dotlambda commented May 27, 2018

Regarding releases vs tags, there are very difficult cases. E.g., mail-parser has some versions as releases, but some only as tags: https://github.com/SpamScope/mail-parser/releases
However, it's difficult to distinguish pre-releases when using tags.

version = tag[1:]
else:
version = tag
sha256 = nix_prefetch_github(owner=owner, repo=repo, rev=tag)['sha256']
Copy link
Member

Choose a reason for hiding this comment

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

Why is nix_prefetch_github needed? The API does not offer sha256? Or is it because it does the choosing between zip and git?

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't the hash for fetchFromGitHub the hash of the unpacked archive? To calculate it, I think I'd need to download and unpack it. That's what I use nix_prefetch_github for.

Copy link
Member

Choose a reason for hiding this comment

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

When fetchFromGitHub picks an archive, it uses fetchzip and for that nix-prefetch-url --unpack can be used to determine the hash.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can use that if you prefer.

Copy link
Member

Choose a reason for hiding this comment

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

No need for that. I was just hoping we could use the API instead of having to perform a download :)

Copy link
Member

Choose a reason for hiding this comment

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

Note that the requests limits for downloading without token is quite low so you would likely to run into limits.

@@ -60,10 +64,19 @@ def _get_values(attribute, text):

:returns: List of matches.
"""
# Find occurences of 'attribute = "string";'
Copy link
Member

Choose a reason for hiding this comment

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

Why are the following changes needed? Could you update the docstring to describe what this function does.

@@ -169,7 +182,24 @@ def _get_latest_version_pypi(package, extension, current_version, target):
return version, sha256


def _get_latest_version_github(package, extension, current_version, target):
def _get_latest_version_github(text, package, extension, current_version, target):
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a docstring, and explain in it how this function roughly works (that is, combination of PyGithub and nix-prefetch-github).

@FRidh FRidh added the 9.needs: port to stable A PR needs a backport to the stable release. label May 28, 2018
@matthiasbeyer
Copy link
Contributor

This is stalled and should probably be closed. @FRidh @Mic92

@stale
Copy link

stale bot commented Jun 2, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@@ -36,6 +38,8 @@ PRERELEASES = False
import logging
logging.basicConfig(level=logging.INFO)

github = Github()
Copy link
Member

Choose a reason for hiding this comment

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

This should accept a github token or it runs into rate limits quick.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@@ -20811,7 +20811,7 @@ with pkgs;

nix-pin = callPackage ../tools/package-management/nix-pin { };

nix-prefetch-github = callPackage ../build-support/nix-prefetch-github {};
nix-prefetch-github = with python3.pkgs; toPythonApplication nix-prefetch-github;
Copy link
Member

Choose a reason for hiding this comment

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

By the way we also have nix-prefetch, which can handle a lot more.

@dotlambda
Copy link
Member Author

Closing this as there are solutions such as https://github.com/Mic92/nix-update.

@dotlambda dotlambda closed this Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants