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

gup: 0.5.5 -> 0.6.0 and extract src into JSON #21516

Merged
merged 2 commits into from Jan 26, 2017
Merged

Conversation

timbertson
Copy link
Contributor

Motivation for this change
  • update to latest version
  • extract fetchFromGitHub attributes into separate JSON file for scripted updates
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
    • Linux
  • 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.

@mention-bot
Copy link

@timbertson, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nckx to be a potential reviewer.

@@ -0,0 +1 @@
src.json.gup
Copy link
Member

Choose a reason for hiding this comment

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

And what's in src.json.gup and does it make sense not to commit it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at this point - it's just:

#!bash -eu
update_script="$(which nix-prefetch-src)"
gup -u src.in.json "$update_script"
"$update_script" src.in.json "$1"

..which relies on a script in https://github.com/timbertson/app-customisations/ being on $PATH. One day I might package it for easy public use, but I haven't put in that effort yet.

@7c6f434c
Copy link
Member

7c6f434c commented Dec 31, 2016 via email

@7c6f434c
Copy link
Member

7c6f434c commented Jan 4, 2017

So nix-prefetch-src is likely to get renamed nix-prefetch-github in the long run, right?

Is src.nix used anywhere?

@timbertson
Copy link
Contributor Author

Is src.nix used anywhere?

Oops, not anymore. Removed, thanks.

So nix-prefetch-src is likely to get renamed nix-prefetch-github in the long run, right?

Actually the opposite - I've been thinking this sort of scheme might be widely applicable for scriptable updates, so I'd eventually like it to support all kinds of repos (aided by a type property in the input JSON). For now I'd like to get this merged as a timbertson-special if that's OK, but I plan to raise the issue on the mailing list and see if there's general support for this approach.

@timbertson
Copy link
Contributor Author

Well, after a brief diversion ( #21734) nix-prefetch-source is now in nixpkgs proper, so I've redone this PR using it directly (although I did have to bump a version). Could you please take another look @7c6f434c ?

if [ -n "${GUP_TARGET:-}" ]; then
gup --always
fi
curl -LSs -o "$1" https://raw.githubusercontent.com/timbertson/gup/master/nix/gup-python.nix
Copy link
Member

Choose a reason for hiding this comment

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

So you combine master version of build.nix with latest-release source version? Isn't that going to break?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could possibly do something more complex to get the branch that's just been updated, but practically speaking I'll always be updating to the latest release. If I ever need to update to an old release for some reason, I'd have to fix this up (although the .nix file doesn't change that much between versions anyway, so it still might not matter)

Copy link
Member

Choose a reason for hiding this comment

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

OK, if you commit to always prevent «master contains build.nix for the future release, not for the current» as the maintainer on both sides, then I guess that's acceptable.

passthru = {
updateScript = ''
set -e
echo
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update.nix which runs the updateScript doesn't print a newline before invoking the script, but this update script wants its own line (since it prints a prompt)

updateScript = ''
set -e
echo
cd ${toString ./.}
Copy link
Member

Choose a reason for hiding this comment

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

Oh, this does work? nice…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was pretty surprised, but yes!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(well, as long as you're building it from a checkout ./default.nix, not <nixpkgs> - that probably wouldn't work)

@7c6f434c
Copy link
Member

7c6f434c commented Jan 25, 2017 via email

@timbertson
Copy link
Contributor Author

Did you try <nixpkgs> when it is the full checkout that happens to be in $NIX_PATH?

Yep, that works too. It just doesn't work if you're using the channel instead of a git checkout, since that's always going to live in /nix/store.

@7c6f434c 7c6f434c merged commit 1d44213 into NixOS:master Jan 26, 2017
@7c6f434c
Copy link
Member

Well, running an updater without having a checkout doesn't make too much sense anyway.

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

4 participants