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

WIP: hackish script to compare JSON from Guix and Nix #26105

Closed
wants to merge 5 commits into from

Conversation

armijnhemel
Copy link
Contributor

Motivation for this change

Simple script to see where nixpkgs and guix deviate. This is still very much a WIP and needs a lot of spit and polish (hardcoded paths, etc.)

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.

@armijnhemel
Copy link
Contributor Author

@rbvermaa here you go ;-)

@@ -0,0 +1,81 @@
#!/usr/bin/python
Copy link
Member

Choose a reason for hiding this comment

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

Can you make this a package instead? Also /usr/bin/python would never work directly on nixos.

Copy link
Member

@vcunat vcunat May 26, 2017

Choose a reason for hiding this comment

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

/usr/bin/env python should work OK, I believe, though it seems better to explicitly state python2 or python3.

Both ways – maintainers/scripts/* and actual package – seem OK to me. It does seem targeted mainly on nixpkgs (or guix) contributors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright, thanks. This is still WIP of course, more comments welcome. I will try to work a bit on using the homepage attribute to correlate packages as well.

If people are interested I could also check against for example Debian (fairly straightforward), or something like libraries.io. It might be worth exploring this topic a bit more.

import os, sys, json

guixjsonfilename = '/tmp/packages-guix.json'
nixjsonfilename = '/tmp/packages.json'
Copy link
Member

Choose a reason for hiding this comment

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

How would a user get both?

@armijnhemel
Copy link
Contributor Author

@armijnhemel
Copy link
Contributor Author

I could turn this into a more useful script, but I wanted to get some feedback first to see if it would be useful for people.

@armijnhemel
Copy link
Contributor Author

Data is now downloaded from the Guix and Nix websites. What would be the right place in Nixpkgs to move this to?

@bobvanderlinden
Copy link
Member

This doesn't seem to work anymore :( I guess because Nix' packages json is gone?

@armijnhemel
Copy link
Contributor Author

This doesn't seem to work anymore :( I guess because Nix' packages json is gone?

It still seems to be there. Maybe it was a temporary glitch while the json was being regenerated?

## NixOS exports the available packages in the stable channel
## (for example: 17.03) as JSON
## http://nixos.org/nixpkgs/packages.json.gz
httpcon = httplib.HTTPConnection('nixos.org')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
httpcon = httplib.HTTPConnection('nixos.org')
httpcon = httplib.HTTPSConnection('nixos.org')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, duh. I probably should be rewriting the script anyway to Python 3

@bobvanderlinden
Copy link
Member

I see now that it is just trying to fetch http://nixos.org/nixpkgs/packages.json.gz instead of https://nixos.org/nixpkgs/packages.json.gz. When using HTTPSConnection for nixos the script is working nicely.

Seeing the output, is this something that https://repology.org/ also solves?

@armijnhemel
Copy link
Contributor Author

armijnhemel commented Apr 14, 2019

I see now that it is just trying to fetch http://nixos.org/nixpkgs/packages.json.gz instead of https://nixos.org/nixpkgs/packages.json.gz. When using HTTPSConnection for nixos the script is working nicely.

Seeing the output, is this something that https://repology.org/ also solves?

This was merely a hackish script to provide something. Using repology instead makes perfect sense to me.

@matthiasbeyer
Copy link
Contributor

This seems to be stalled and should probably be closed. @Mic92 @armijnhemel

@armijnhemel
Copy link
Contributor Author

Happy to close it if someone wants to provide a good alternative based on repology. A the moment I have no time to fix the script.

@matthiasbeyer
Copy link
Contributor

matthiasbeyer commented Jun 19, 2019

Does this solve your problem: https://github.com/matthiasbeyer/repolocli (shameless self-promotion)?

If not, but it could, feel free to submit changes!

@armijnhemel
Copy link
Contributor Author

The original goal was just to see how well we are doing being up to date, but also to make it more automatic instead of someone going to the repology website to check. I never got around to implementing that, so if your program could be used to make an alerting service that would be great :-)

@matthiasbeyer
Copy link
Contributor

I plan to implement something like this, yes. Patches welcome!

@armijnhemel
Copy link
Contributor Author

In that case I will close this one :-)

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