From 3d3eba15ed3b4e713b19a91438c4cfb929be8a01 Mon Sep 17 00:00:00 2001 From: Benjamin Roberts Date: Tue, 27 Oct 2015 09:24:32 +1300 Subject: [PATCH 1/4] Fix permissions on certain EasyBlocks --- easybuild/easyblocks/b/bamtools.py | 0 easybuild/easyblocks/b/blat.py | 0 easybuild/easyblocks/b/bwa.py | 0 easybuild/easyblocks/c/chimera.py | 0 easybuild/easyblocks/generic/cmdcp.py | 0 easybuild/easyblocks/generic/makecp.py | 0 easybuild/easyblocks/m/modeller.py | 0 7 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 easybuild/easyblocks/b/bamtools.py mode change 100755 => 100644 easybuild/easyblocks/b/blat.py mode change 100755 => 100644 easybuild/easyblocks/b/bwa.py mode change 100755 => 100644 easybuild/easyblocks/c/chimera.py mode change 100755 => 100644 easybuild/easyblocks/generic/cmdcp.py mode change 100755 => 100644 easybuild/easyblocks/generic/makecp.py mode change 100755 => 100644 easybuild/easyblocks/m/modeller.py diff --git a/easybuild/easyblocks/b/bamtools.py b/easybuild/easyblocks/b/bamtools.py old mode 100755 new mode 100644 diff --git a/easybuild/easyblocks/b/blat.py b/easybuild/easyblocks/b/blat.py old mode 100755 new mode 100644 diff --git a/easybuild/easyblocks/b/bwa.py b/easybuild/easyblocks/b/bwa.py old mode 100755 new mode 100644 diff --git a/easybuild/easyblocks/c/chimera.py b/easybuild/easyblocks/c/chimera.py old mode 100755 new mode 100644 diff --git a/easybuild/easyblocks/generic/cmdcp.py b/easybuild/easyblocks/generic/cmdcp.py old mode 100755 new mode 100644 diff --git a/easybuild/easyblocks/generic/makecp.py b/easybuild/easyblocks/generic/makecp.py old mode 100755 new mode 100644 diff --git a/easybuild/easyblocks/m/modeller.py b/easybuild/easyblocks/m/modeller.py old mode 100755 new mode 100644 From 0ce1c19edb972d6a32752d4b00db8ed2804426b5 Mon Sep 17 00:00:00 2001 From: Benjamin Roberts Date: Tue, 27 Oct 2015 09:37:49 +1300 Subject: [PATCH 2/4] Update BinariesTarball to include support for an explicit list of binary files if one is provided --- .../easyblocks/generic/binariestarball.py | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/easybuild/easyblocks/generic/binariestarball.py b/easybuild/easyblocks/generic/binariestarball.py index 6a7e39aef16..085746d6fcf 100644 --- a/easybuild/easyblocks/generic/binariestarball.py +++ b/easybuild/easyblocks/generic/binariestarball.py @@ -32,6 +32,7 @@ import stat from easybuild.easyblocks.generic.tarball import Tarball +from easybuild.framework.easyconfig import CUSTOM from easybuild.tools.build_log import EasyBuildError from easybuild.tools.filetools import adjust_permissions @@ -40,21 +41,43 @@ class BinariesTarball(Tarball): """ Support for installing a tarball of binaries """ + @staticmethod + def extra_options(extra_vars=None): + """ + Define list of files to be copied during the installation process + """ + extra_vars = Tarball.extra_options(extra_vars) + # Allow specification of files to copy explicitly. + # If files_to_copy is a zero-length list, all files (but not + # directories, etc.) in start_dir will be copied with their + # current names. + extra_vars['files_to_copy'] = [ + [], + "List of optional (source_file, destination_file) tuples", + CUSTOM, + ] + return extra_vars def install_step(self): """Install by copying unzipped binaries to 'bin' subdir of installation dir, and fixing permissions.""" bindir = os.path.join(self.installdir, 'bin') + items_to_copy = [] try: os.makedirs(bindir) - for item in os.listdir(self.cfg['start_dir']): + if len(self.cfg['files_to_copy']) == 0: + for item in os.listdir(self.cfg['start_dir']): + items_to_copy.append((os.path.join(self.cfg['start_dir'], item), item)) + else: + items_to_copy = self.cfg['files_to_copy'] + for (item, destname) in items_to_copy: if os.path.isfile(item): - shutil.copy2(os.path.join(self.cfg['start_dir'], item), bindir) + shutil.copy2(item, os.path.join(bindir, destname)) # make sure binary has executable permissions - adjust_permissions(os.path.join(bindir, item), stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH, add=True) + adjust_permissions(os.path.join(bindir, destname), stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH, add=True) self.log.debug("Copied %s to %s and fixed permissions" % (item, bindir)) else: - self.log.warning("Skipping non-file %s in %s, not copying it." % (item, self.cfg['start_dir'])) + self.log.warning("%s: not a file. Skipping." % item) except OSError, err: - raise EasyBuildError("Copying binaries in %s to install dir 'bin' failed: %s", self.cfg['start_dir'], err) + raise EasyBuildError("Copying binaries to install dir 'bin' failed: %s" % err) From 6f9be2ed5cb2ccfb209b9c9004d0539b27fd47ca Mon Sep 17 00:00:00 2001 From: Benjamin Roberts Date: Wed, 28 Oct 2015 11:19:36 +1300 Subject: [PATCH 3/4] Some changes recommended by K.H. --- easybuild/easyblocks/generic/binariestarball.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/easybuild/easyblocks/generic/binariestarball.py b/easybuild/easyblocks/generic/binariestarball.py index 085746d6fcf..2e87dc48858 100644 --- a/easybuild/easyblocks/generic/binariestarball.py +++ b/easybuild/easyblocks/generic/binariestarball.py @@ -51,11 +51,9 @@ def extra_options(extra_vars=None): # If files_to_copy is a zero-length list, all files (but not # directories, etc.) in start_dir will be copied with their # current names. - extra_vars['files_to_copy'] = [ - [], - "List of optional (source_file, destination_file) tuples", - CUSTOM, - ] + extra_vars.update({ + 'files_to_copy': [[], "List of optional (source_file, destination_file) tuples", CUSTOM,] + }) return extra_vars def install_step(self): @@ -69,15 +67,14 @@ def install_step(self): for item in os.listdir(self.cfg['start_dir']): items_to_copy.append((os.path.join(self.cfg['start_dir'], item), item)) else: - items_to_copy = self.cfg['files_to_copy'] + items_to_copy.append(os.path.join(self.cfg['start_dir'], item) for item in self.cfg['files_to_copy']) for (item, destname) in items_to_copy: if os.path.isfile(item): shutil.copy2(item, os.path.join(bindir, destname)) # make sure binary has executable permissions adjust_permissions(os.path.join(bindir, destname), stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH, add=True) - self.log.debug("Copied %s to %s and fixed permissions" % (item, bindir)) + self.log.debug("Copied %s to %s and fixed permissions", item, bindir) else: - self.log.warning("%s: not a file. Skipping." % item) + self.log.warning("%s: not a file. Skipping.", item) except OSError, err: - raise EasyBuildError("Copying binaries to install dir 'bin' failed: %s" % err) - + raise EasyBuildError("Copying binaries to install dir 'bin' failed: %s", err) From ac74b85e96df6ac9b26bb39915220ecb596b49bc Mon Sep 17 00:00:00 2001 From: Benjamin Roberts Date: Mon, 22 Feb 2016 11:56:53 +1300 Subject: [PATCH 4/4] make files_to_copy's default value None, not an empty list --- easybuild/easyblocks/generic/binariestarball.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/generic/binariestarball.py b/easybuild/easyblocks/generic/binariestarball.py index 2e87dc48858..dc2505bcd93 100644 --- a/easybuild/easyblocks/generic/binariestarball.py +++ b/easybuild/easyblocks/generic/binariestarball.py @@ -52,7 +52,7 @@ def extra_options(extra_vars=None): # directories, etc.) in start_dir will be copied with their # current names. extra_vars.update({ - 'files_to_copy': [[], "List of optional (source_file, destination_file) tuples", CUSTOM,] + 'files_to_copy': [None, "List of optional (source_file, destination_file) tuples", CUSTOM,] }) return extra_vars @@ -63,7 +63,7 @@ def install_step(self): items_to_copy = [] try: os.makedirs(bindir) - if len(self.cfg['files_to_copy']) == 0: + if self.cfg['files_to_copy'] is None: for item in os.listdir(self.cfg['start_dir']): items_to_copy.append((os.path.join(self.cfg['start_dir'], item), item)) else: