NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.53k forks source link

GitHub unstable archive tracking issue #32997

Open lukateras opened 6 years ago

lukateras commented 6 years ago

GitHub ref archives are unstable, and should be fetched via fetchFromGitHub for normalization. See https://github.com/NixOS/nix/issues/1735#issuecomment-352082326. /cc @orivej

Here is an (incomplete) list of places where fetchurl is used with an unstable GitHub archive instead of fetchFromGitHub or fetchzip:

Script that was used to generate this list:

#! /usr/bin/env nix-shell
#! nix-shell -i sh -p ag git

IFS=$'\n'

commit=$(git rev-parse HEAD)
pattern='(?<=fetchurl {\n) *url *= *"?https?://(www.)?github.com/.*/archive/.*"?'

for match in $(ag --no-heading $pattern); do
    path=$(echo "$match" | cut -d: -f1)
    line=$(echo "$match" | cut -d: -f2)

    echo "* [ ] [$path#L$line](https://github.com/NixOS/nixpkgs/blob/$commit/$path#L$line)"
done
orivej commented 6 years ago

The #L should have been a part of the link.

I'm going to fix this on the weekend.

I'm not entirely sure whether they should be replaced with fetchFromGitHub or fetchzip. The latter is slightly simpler to generate, results in a smaller diff, currently does not have any practical downsides, and may be converted to fetchFromGitHub later, but it contributes a lot of examples of not using fetchFromGitHub for GitHub.

lukateras commented 6 years ago

The #L should have been a part of the link.

Fixed!

There are a lot of places in Nixpkgs tree where fetchzip is used with a GitHub archive (about 200), and if this were to be done in two steps (incorrect fetchurl -> fetchzip, fetchzip -> fetchFromGitHub) these cases would also be handled.

bjornfor commented 6 years ago

+1 for fetchzip.

(I still don't get why people prefer fetchFromGitHub over fetchzip.)

LnL7 commented 6 years ago

I didn't even know fetchzip works for tarballs, that needs a better name IMHO.

bjornfor commented 6 years ago

s/fetchzip/fetcharchive/ ?

LnL7 commented 6 years ago

@bjornfor yeah or something like fetchunpack.

oxij commented 6 years ago

@bjornfor yeah or something like fetchunpack.

+1. I too think it needs to be renamed to fetchThenUnpack or similar.

c0bw3b commented 5 years ago

mhwaveedit addressed in #47808

das-g commented 5 years ago

pkgs/development/tools/geckodriver/default.nix switched to fetchFromGitHub in 452f9ca8eff7ab8d55998b005caf2f22e39d9abc.

florianjacob commented 5 years ago

journalwatch adressed in #59424

stale[bot] commented 4 years ago

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.