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

udocker: init at 1.1.1 #34493

Merged
merged 1 commit into from Feb 3, 2018
Merged

udocker: init at 1.1.1 #34493

merged 1 commit into from Feb 3, 2018

Conversation

bzizou
Copy link
Contributor

@bzizou bzizou commented Feb 1, 2018

Motivation for this change

udocker may be useful for HPC environments using NIX

This package works at image-creation-time (docker should be installed) and at runtime with at least P1 and P2 modes.

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.

@@ -0,0 +1,35 @@
{ stdenv, fetchurl, proot, patchelf, fakechroot, runc, python, pythonPackages, coreutils }:

stdenv.mkDerivation rec {
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 buildPythonApplication

stdenv.mkDerivation rec {

version = "1.1.1";
name = "udocker-${version}";
Copy link
Member

Choose a reason for hiding this comment

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

Please specify pname = "udocker"; and get rid of name.

version = "1.1.1";
name = "udocker-${version}";

src = fetchurl {
Copy link
Member

Choose a reason for hiding this comment

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

You could also use fetchFromGitHub.

substituteInPlace udocker.py --replace /usr/sbin:/sbin:/usr/bin:/bin $PATH
substituteInPlace udocker.py --replace /bin/chmod ${coreutils}/bin/chmod
substituteInPlace udocker.py --replace /bin/rm ${coreutils}/bin/chmod
substituteInPlace udocker.py --replace "autoinstall = True" "autoinstall = False"
Copy link
Member

Choose a reason for hiding this comment

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

This belongs into postPatch.

@@ -17453,6 +17453,8 @@ with pkgs;
testssl = callPackage ../applications/networking/testssl { };

umurmur = callPackage ../applications/networking/umurmur { };

udocker = callPackage ../applications/virtualization/udocker { };
Copy link
Member

Choose a reason for hiding this comment

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

You can use pythonPackages.callPackage here

@bzizou bzizou force-pushed the udocker branch 2 times, most recently from be6fcf0 to 1e91fef Compare February 1, 2018 15:36
@bzizou
Copy link
Contributor Author

bzizou commented Feb 1, 2018

@dotlambda : thank you for your advices! I think that I fixed everything...

@A1ve5
Copy link

A1ve5 commented Feb 1, 2018

Hi @bzizou, thank you for this.
Just a minor remark to your comment above: Docker isn't necessary to run udocker.
Cheers

@@ -0,0 +1,34 @@
{ stdenv, fetchFromGitHub, proot, patchelf, fakechroot, runc, python, pythonPackages, coreutils }:

with pythonPackages;
Copy link
Member

Choose a reason for hiding this comment

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

Better put buildPythonApplication, simplejson, etc. in the argument set.

homepage = https://www.gitbook.com/book/indigo-dc/udocker;
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.bzizou ];
platforms = stdenv.lib.platforms.linux;
Copy link
Member

Choose a reason for hiding this comment

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

Drop stdenv.lib. in the 3 lines above

repo = "udocker" ;
rev = "v${version}";
sha256 = "134xk7rfj0xki9znryk5qf1nsfa318ahrrsi1k6ia7kipp7i3hb4";
};
Copy link
Member

Choose a reason for hiding this comment

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

Indentation

@bzizou
Copy link
Contributor Author

bzizou commented Feb 1, 2018

@A1ve5 : even at image creation time?

@@ -17453,6 +17453,8 @@ with pkgs;
testssl = callPackage ../applications/networking/testssl { };

umurmur = callPackage ../applications/networking/umurmur { };

udocker = pythonPackages.callPackage ../applications/virtualization/udocker { };
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 this is better suited for tools/virtualization.

postPatch = ''
substituteInPlace udocker.py --replace /usr/sbin:/sbin:/usr/bin:/bin $PATH
substituteInPlace udocker.py --replace /bin/chmod ${coreutils}/bin/chmod
substituteInPlace udocker.py --replace /bin/rm ${coreutils}/bin/chmod
Copy link
Member

Choose a reason for hiding this comment

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

You probably don't want to replace rm by chmod.

@dotlambda
Copy link
Member

@GrahamcOfBorg build udocker

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

writing dependency_links to udocker.egg-info/dependency_links.txt
reading manifest file 'udocker.egg-info/SOURCES.txt'
writing manifest file 'udocker.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/b73vn0zk93bzsnwc8266qc4hb08ga96k-udocker-1.1.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

writing dependency_links to udocker.egg-info/dependency_links.txt
reading manifest file 'udocker.egg-info/SOURCES.txt'
writing manifest file 'udocker.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/j7b2f4sbmfsydwryq6ywg1sax2ddrykm-udocker-1.1.1

@dotlambda
Copy link
Member

dotlambda commented Feb 2, 2018

Ran 0 tests in 0.000s

Please specify the appropriate checkPhase, e.g. python -m unittest discover --pattern='*_tests.py'.
If the tests don't work (e.g. because they need network access) specify doCheck = false and write a comment with the reason.

@bzizou
Copy link
Contributor Author

bzizou commented Feb 2, 2018

@A1ve5 : checks are launched with tox right?

@dotlambda
Copy link
Member

But according to https://github.com/indigo-dc/udocker/blob/master/tox.ini, tox should simply call python -m unittest discover --pattern='*_tests.py' I believe.
I think it is generally not advised to use tox inside Nixpkgs, but @FRidh can certainly clarify this.

@A1ve5
Copy link

A1ve5 commented Feb 2, 2018

@dotlambda our jenkins is running: nosetests -v tests/unit_tests.py --with-xcoverage --cover-package=udocker

@A1ve5
Copy link

A1ve5 commented Feb 2, 2018

@bzizou, yes, to build the images we rely on external tools like Docker. However, when one run "udocker create xyz" the image should be already in local repo and Docker isn't necessary. Not sure if that was your question.

@bzizou
Copy link
Contributor Author

bzizou commented Feb 2, 2018

Tests are ok with NOSE_EXCLUDE=test_03_create_repo,test_04_is_repo,test_02__get_group_from_host nosetests -v tests/unit_tests.py
So I'm going to push an amended commit with this line as checkPhase.

Note that the tests are passing with just nosetests -v tests/unit_tests.py inside a nix-shell --pure but I guess that the 3 failing tests are trying to write into the store...

@FRidh
Copy link
Member

FRidh commented Feb 3, 2018

@GrahamcOfBorg build udocker

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

Test Unique.filename(). ... ok
Test _check_output(). ... ok
Test check_output(). ... ok
Test get_output(). ... ok
Test get_output(). ... ok

----------------------------------------------------------------------
Ran 308 tests in 1.134s

OK

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

Test _check_output(). ... ok
Test check_output(). ... ok
Test get_output(). ... ok
Test get_output(). ... ok

----------------------------------------------------------------------
Ran 308 tests in 4.100s

OK
/nix/store/imrmhan3xnqvfdyw7sxw8lpaaciahmsm-udocker-1.1.1

@FRidh FRidh merged commit 274d4ea into NixOS:master Feb 3, 2018
@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Partial log (click to expand)

Package ‘udocker-1.1.1’ in /private/var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/lnl7-mac/pkgs/tools/virtualization/udocker/default.nix:30 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

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

5 participants