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

linode-cli: init at 1.4.7 #23080

Merged
merged 2 commits into from
May 1, 2017
Merged

linode-cli: init at 1.4.7 #23080

merged 2 commits into from
May 1, 2017

Conversation

nixy
Copy link
Contributor

@nixy nixy commented Feb 22, 2017

Motivation for this change

Want to make the Linode-CLI available through Nix, because Nix is the best :)

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.

src = fetchgit {
url = "git://github.com/linode/cli";
rev = "8d475f3ff161b64dbe1aff167897974f92475a3c";
sha256 = "1c24c7n3fq9c3yibw1i4zlk3hdcjaqcd5cq4kvvw4hfg2l3w6a21";
Copy link
Member

Choose a reason for hiding this comment

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

Please use fetchFromGitHub here instead of fetchgit


src = fetchgit {
url = "git://github.com/linode/cli";
rev = "8d475f3ff161b64dbe1aff167897974f92475a3c";
Copy link
Member

Choose a reason for hiding this comment

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

Please use the version as revision here: https://github.com/linode/cli/releases

  rev = "v${version}";

outputs = [ "out" ];

# Has no tests
doCheck = false;
Copy link
Member

Choose a reason for hiding this comment

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

The package sill misses dependencies:

Warning: prerequisite JSON 0 not found.
Warning: prerequisite LWP::UserAgent 0 not found.
Warning: prerequisite Mozilla::CA 0 not found.
Warning: prerequisite Try::Tiny 0 not found.
Warning: prerequisite WebService::Linode 0 not found.

@nixy
Copy link
Contributor Author

nixy commented Feb 23, 2017

So it looks like my initial attempt at packaging this was pretty naive, but the binary worked surprisingly well all things considered.

I have included all the libraries and am using fetchFromGitHub now, but I am a bit stumped on a library path issue. When I try and run some of the executables I get the following:

Can't locate Linode/CLI.pm in @INC (you may need to install the Linode::CLI module) (@INC contains: /nix/store/lxyzi71fzqy7av2fs4n65286cbiibwcd-perl-linode-cli-1.4.7/bin/lib /nix/store/8svnbpw903za1imxn73fxyjql6hvviz6-perl-5.22.2/lib/perl5/site_perl/5.22.2/darwin-2level /nix/store/8svnbpw903za1imxn73fxyjql6hvviz6-perl-5.22.2/lib/perl5/site_perl/5.22.2 /nix/store/8svnbpw903za1imxn73fxyjql6hvviz6-perl-5.22.2/lib/perl5/5.22.2/darwin-2level /nix/store/8svnbpw903za1imxn73fxyjql6hvviz6-perl-5.22.2/lib/perl5/5.22.2 .) at result/bin/linode-account line 13.
BEGIN failed--compilation aborted at result/bin/linode-account line 13.

I am not terribly familiar with Perl so I am not sure how the @INC variable is defined, or how to modify it in a Nix expression. Any advice? I have taken a look through some other Perl packages and tried modifying $PERL5LIB but it didn't seem to have any effect.

@joachifm
Copy link
Contributor

You might need to wrap the executable, using some variation of

nativeBuildInputs = [ makeWrapper ];
# ...
postInstall = ''
   # ...
  wrapProgram $out/bin/foo --prefix PERL5LIB : "$PERL5LIB"
'';

sha256 = "1wiz067wgxi4z4rz4n9p7dlvx5z4hkl2nxpfvhikl6dri4m2nkkp";
};

# src = fetchgit {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this

# };

# Has no docs output
outputs = [ "out" ];
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default outputs appears to contain "devdoc" at well which caused this build to fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that must be a perl thing

@@ -14958,4 +14958,19 @@ let self = _self // overrides; _self = with self; {
};
};

WebServiceLinode = buildPerlModule rec {
Copy link
Member

@Mic92 Mic92 Feb 24, 2017

Choose a reason for hiding this comment

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

Please add this package in a separate commit with the message: perlPackages.WebServiceLinode: init at 0.28

@nixy nixy force-pushed the init/linode-cli branch 2 times, most recently from bacc724 to 3ff63bd Compare February 24, 2017 20:38
@nixy
Copy link
Contributor Author

nixy commented Feb 24, 2017

I believe this should be good now. Thanks a bunch ya'll. Learning about all kinds of fun Nix functions that make life easier.

@nixy
Copy link
Contributor Author

nixy commented Mar 17, 2017

Anything else I need to do here?

@joachifm
Copy link
Contributor

The travis build fails, can you investigate? Other than that it also needs a rebase.

doCheck = false;

# # Has no docs output
# outputs = [ "out" ];
Copy link
Member

Choose a reason for hiding this comment

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

I think Perl packages are expected to have devdoc output, but there is none in this case, which causes the failure.

@nixy
Copy link
Contributor Author

nixy commented May 1, 2017

I made the changes suggested and I believe the travis build should run, but it looks like Travis rejected my build. It looks like it gave the following errors:

abuse detected: user page on GitHub gives 404
abuse detected: known offender

Anyone know what I can do to prevent that?

@7c6f434c 7c6f434c merged commit 208fa65 into NixOS:master May 1, 2017
@rvl
Copy link
Contributor

rvl commented May 21, 2017

Thanks @nixy @Mic92 @7c6f434c

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