ablab / spades

SPAdes Genome Assembler
http://ablab.github.io/spades/
Other
713 stars 131 forks source link

Fix for package managers storing files in read-only #1314

Closed bzizou closed 3 days ago

bzizou commented 2 weeks ago

This is a quick fix coming from a hack I had to do for the packaging of Spades 4.0.0 into NixOS :

The proposed patch is currently into the proposed update for the Nix Spades package, but it would be great if the fix is done upstream. The problem is that once installed, a Nix package has all the files with no write permission at all (files coming from packages are stored into a read-only directory). The Spades pipeline copies some data files to an output directory, but keeps the modes, even if the preserve_mode argument is set to false because it uses the shutil.copytree() function that implies a shutil.copystat() that can not be disabled (see https://github.com/python/cpython/blob/4bf17c381fb7b465f0f26aecb94a6c54cf9be2d3/Doc/library/shutil.rst?plain=1#L237). So the copied files are read-only and the test pipeline fails. Giving the write access to the owner is enough to solve the issue.

Co-authored by: Andrey Prjibelski andrewprzh@gmail.com

asl commented 2 weeks ago

Thank! Maybe there is some other way (more python'ish) way of doing things instead of just os.system? @andrewprzh Will you please take a look?

bzizou commented 2 weeks ago

Thank! Maybe there is some other way (more python'ish) way of doing things instead of just os.system?

Sure! I did this as a quick fix, working, but dirty ;-)

asl commented 2 weeks ago

@bzizou Will you please check if the updated patch resolves downstream issue?

bzizou commented 4 days ago

@bzizou Will you please check if the updated patch resolves downstream issue?

checking right now...

bzizou commented 4 days ago

I had to squash the commits, to be able to get a single patch for downstream. Now, testing the package with this...

bzizou commented 4 days ago

That's ok! Patch resulting from this PR applied to the package (https://github.com/NixOS/nixpkgs/compare/c27bbb2094c2f855092cc8cf96b7045f8a8a8337..ea7dabc17148dd26457ce4986b0cad405844ede3) Tests are passing!