From c9fbba22a21e75eb83208256ba6365583473e3fa Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 19 Sep 2014 09:50:09 -0700 Subject: First version of AutomaDeD package. --- var/spack/packages/automaded/package.py | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 var/spack/packages/automaded/package.py (limited to 'var') diff --git a/var/spack/packages/automaded/package.py b/var/spack/packages/automaded/package.py new file mode 100644 index 0000000000..9fbd93e3b3 --- /dev/null +++ b/var/spack/packages/automaded/package.py @@ -0,0 +1,51 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + +class Automaded(Package): + """AutomaDeD (Automata-based Debugging for Dissimilar parallel + tasks) is a tool for automatic diagnosis of performance and + correctness problems in MPI applications. It creates + control-flow models of each MPI process and, when a failure + occurs, these models are leveraged to find the origin of + problems automatically. MPI calls are intercepted (using + wrappers) to create the models. When an MPI application hangs, + AutomaDeD creates a progress-dependence graph that helps + finding the process (or group of processes) that caused the hang. + """ + + homepage = "https://github.com/scalability-llnl/AutomaDeD" + url = "https://github.com/scalability-llnl/AutomaDeD/archive/v1.0.tar.gz" + + version('1.0', '16a3d4def2c4c77d0bc4b21de8b3ab03') + + depends_on('mpi') + depends_on('boost') + depends_on('callpath') + + def install(self, spec, prefix): + cmake("-DSTATE_TRACKER_WITH_CALLPATH=ON", *std_cmake_args) + make() + make("install") -- cgit v1.2.3-70-g09d2 From 2de2d4bea7689f4421beee526c6ded9199740b6d Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 23 Sep 2014 14:59:30 -0700 Subject: Modify MPI installs to work without fortran. --- lib/spack/spack/__init__.py | 4 ++-- var/spack/packages/mpich/package.py | 16 +++++++++++++--- var/spack/packages/openmpi/package.py | 30 ++++++++++++++++++++---------- 3 files changed, 35 insertions(+), 15 deletions(-) (limited to 'var') diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index bf91a885ca..da7088640f 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -137,9 +137,9 @@ sys_type = None # TODO: it's not clear where all the stuff that needs to be included in packages # should live. This file is overloaded for spack core vs. for packages. # -__all__ = ['Package', 'Version', 'when'] +__all__ = ['Package', 'Version', 'when', 'ver'] from spack.package import Package -from spack.version import Version +from spack.version import Version, ver from spack.multimethod import when import llnl.util.filesystem diff --git a/var/spack/packages/mpich/package.py b/var/spack/packages/mpich/package.py index 19a1efe9c3..9062a6bae8 100644 --- a/var/spack/packages/mpich/package.py +++ b/var/spack/packages/mpich/package.py @@ -38,8 +38,18 @@ class Mpich(Package): provides('mpi@:1', when='@1:') def install(self, spec, prefix): - configure( - "--prefix=" + prefix, - "--enable-shared") + config_args = ["--prefix=" + prefix, + "--enable-shared"] + + # TODO: Spack should make it so that you can't actually find + # these compilers if they're "disabled" for the current + # compiler configuration. + if not self.compiler.f77: + config_args.append("--disable-f77") + + if not self.compiler.fc: + config_args.append("--disable-fc") + + configure(*config_args) make() make("install") diff --git a/var/spack/packages/openmpi/package.py b/var/spack/packages/openmpi/package.py index 0ce09bdd8d..1ef8a8f000 100644 --- a/var/spack/packages/openmpi/package.py +++ b/var/spack/packages/openmpi/package.py @@ -10,22 +10,32 @@ class Openmpi(Package): """ homepage = "http://www.open-mpi.org" - url = "http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.5.tar.bz2" - version('1.6.5', '03aed2a4aa4d0b27196962a2a65fc475') + version('1.8.2', 'ab538ed8e328079d566fc797792e016e', + url='http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.2.tar.gz') - provides('mpi@:2') + version('1.6.5', '03aed2a4aa4d0b27196962a2a65fc475', + url = "http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.5.tar.bz2") + patch('ad_lustre_rwcontig_open_source.patch', when="@1.6.5") + patch('llnl-platforms.patch', when="@1.6.5") - patch('ad_lustre_rwcontig_open_source.patch') - patch('llnl-platforms.patch') + provides('mpi@:2') def install(self, spec, prefix): - configure("--prefix=%s" % prefix, - "--with-platform=contrib/platform/lanl/tlcc2/optimized-nopanasas") + config_args = ["--prefix=%s" % prefix] + + # TODO: use variants for this, e.g. +lanl, +llnl, etc. + # use this for LANL builds, but for LLNL builds, we need: + # "--with-platform=contrib/platform/llnl/optimized" + if self.version == ver("1.6.5"): + confg_args.append("--with-platform=contrib/platform/lanl/tlcc2/optimized-nopanasas") - # TODO: implement variants next, so we can have LLNL and LANL options. - # use above for LANL builds, but for LLNL builds, we need this - # "--with-platform=contrib/platform/llnl/optimized") + # TODO: Spack should make it so that you can't actually find + # these compilers if they're "disabled" for the current + # compiler configuration. + if not self.compiler.f77 and not self.compiler.fc: + config_args.append("--enable-mpi-fortran=no") + configure(*config_args) make() make("install") -- cgit v1.2.3-70-g09d2 From bff2192498aa715280a257f62d238a40727483c2 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 23 Sep 2014 21:48:44 -0700 Subject: Added SWIG package. --- var/spack/packages/swig/package.py | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 var/spack/packages/swig/package.py (limited to 'var') diff --git a/var/spack/packages/swig/package.py b/var/spack/packages/swig/package.py new file mode 100644 index 0000000000..d7a3d815b9 --- /dev/null +++ b/var/spack/packages/swig/package.py @@ -0,0 +1,44 @@ +############################################################################## +# Copyright (c) 2014, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Matthew LeGendre, legendre1@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + +class Swig(Package): + """SWIG is an interface compiler that connects programs written in + C and C++ with scripting languages such as Perl, Python, Ruby, + and Tcl. It works by taking the declarations found in C/C++ + header files and using them to generate the wrapper code that + scripting languages need to access the underlying C/C++ + code. In addition, SWIG provides a variety of customization + features that let you tailor the wrapping process to suit your + application.""" + homepage = "http://www.swig.org" + url = "http://prdownloads.sourceforge.net/swig/swig-3.0.2.tar.gz" + + version('3.0.2', '62f9b0d010cef36a13a010dc530d0d41') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + make() + make("install") -- cgit v1.2.3-70-g09d2 From 63292c5826279d67ead30be03d4d954d40c2b342 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 27 Sep 2014 15:39:00 -0700 Subject: Update callpath to 1.0.2 --- var/spack/packages/callpath/package.py | 1 + 1 file changed, 1 insertion(+) (limited to 'var') diff --git a/var/spack/packages/callpath/package.py b/var/spack/packages/callpath/package.py index 84170d9c9e..f78ddcbc0c 100644 --- a/var/spack/packages/callpath/package.py +++ b/var/spack/packages/callpath/package.py @@ -31,6 +31,7 @@ class Callpath(Package): homepage = "https://github.com/scalability-llnl/callpath" url = "https://github.com/scalability-llnl/callpath/archive/v1.0.1.tar.gz" + version('1.0.2', 'b1994d5ee7c7db9d27586fc2dcf8f373') version('1.0.1', '0047983d2a52c5c335f8ba7f5bab2325') depends_on("dyninst") -- cgit v1.2.3-70-g09d2 From 3bd52678bec6bf7f923d8ebc3073a68d86da7282 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 27 Sep 2014 20:47:38 -0700 Subject: MPICH sets MPI compilers to use real compilers and not spack wrappers. --- lib/spack/llnl/util/filesystem.py | 27 +++++++++++++++++++++++---- var/spack/packages/mpich/package.py | 24 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) (limited to 'var') diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 3782aefcce..a70111b915 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -38,7 +38,7 @@ import llnl.util.tty as tty from spack.util.compression import ALLOWED_ARCHIVE_TYPES -def filter_file(regex, repl, *filenames): +def filter_file(regex, repl, *filenames, **kwargs): """Like sed, but uses python regular expressions. Filters every line of file through regex and replaces the file @@ -49,16 +49,31 @@ def filter_file(regex, repl, *filenames): return a suitable replacement string. If it is a string, it can contain ``\1``, ``\2``, etc. to represent back-substitution as sed would allow. + + Keyword Options: + string[=False] If True, treat regex as a plain string. + backup[=True] Make a backup files suffixed with ~ + ignore_absent[=False] Ignore any files that don't exist. """ - # Keep callables intact - if not hasattr(repl, '__call__'): - # Allow strings to use \1, \2, etc. for replacement, like sed + string = kwargs.get('string', False) + backup = kwargs.get('backup', True) + ignore_absent = kwargs.get('ignore_absent', False) + + # Allow strings to use \1, \2, etc. for replacement, like sed + if not callable(repl): unescaped = repl.replace(r'\\', '\\') repl = lambda m: re.sub( r'\\([0-9])', lambda x: m.group(int(x.group(1))), unescaped) + if string: + regex = re.escape(regex) + for filename in filenames: backup = filename + "~" + + if ignore_absent and not os.path.exists(filename): + continue + shutil.copy(filename, backup) try: with closing(open(backup)) as infile: @@ -71,6 +86,10 @@ def filter_file(regex, repl, *filenames): shutil.move(backup, filename) raise + finally: + if not backup: + shutil.rmtree(backup, ignore_errors=True) + def change_sed_delimiter(old_delim, new_delim, *filenames): """Find all sed search/replace commands and change the delimiter. diff --git a/var/spack/packages/mpich/package.py b/var/spack/packages/mpich/package.py index 9062a6bae8..57378626ab 100644 --- a/var/spack/packages/mpich/package.py +++ b/var/spack/packages/mpich/package.py @@ -23,6 +23,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +import os class Mpich(Package): """MPICH is a high performance and widely portable implementation of @@ -53,3 +54,26 @@ class Mpich(Package): configure(*config_args) make() make("install") + + self.filter_compilers() + + + def filter_compilers(self): + """Run after install to make the MPI compilers use the + compilers that Spack built the package with. + + If this isn't done, they'll have CC, CXX, F77, and FC set + to Spack's generic cc, c++, f77, and f90. We want them to + be bound to whatever compiler they were built with. + """ + bin = self.prefix.bin + mpicc = os.path.join(bin, 'mpicc') + mpicxx = os.path.join(bin, 'mpicxx') + mpif77 = os.path.join(bin, 'mpif77') + mpif90 = os.path.join(bin, 'mpif90') + + kwargs = { 'ignore_absent' : True, 'backup' : False, 'string' : True } + filter_file('CC="cc"', 'CC="%s"' % self.compiler.cc, mpicc, **kwargs) + filter_file('CXX="c++"', 'CXX="%s"' % self.compiler.cxx, mpicxx, **kwargs) + filter_file('F77="f77"', 'F77="%s"' % self.compiler.f77, mpif77, **kwargs) + filter_file('FC="f90"', 'FC="%s"' % self.compiler.fc, mpif90, **kwargs) -- cgit v1.2.3-70-g09d2 From c74cd63389eff149d8c0db4f7d68d173a72b48b3 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 16 Sep 2014 16:56:16 -0700 Subject: Callpath build works when a tag is fetched from git. --- LICENSE | 48 ++++---- lib/spack/spack/fetch_strategy.py | 208 ++++++++++++++++++++++++--------- lib/spack/spack/package.py | 27 +++-- lib/spack/spack/stage.py | 6 +- var/spack/packages/callpath/package.py | 2 + 5 files changed, 198 insertions(+), 93 deletions(-) (limited to 'var') diff --git a/LICENSE b/LICENSE index 72a3a77890..6ad4af5861 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013, Lawrence Livermore National Security, LLC. +Copyright (c) 2013-2014, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory. This file is part of Spack. @@ -55,22 +55,22 @@ Modification 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called “this License”). Each -licensee is addressed as “you”. +this Lesser General Public License (also called "this License"). Each +licensee is addressed as "you". -A “library” means a collection of software functions and/or data +A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. -The “Library”, below, refers to any such software library or work -which has been distributed under these terms. A “work based on the -Library” means either the Library or any derivative work under +The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term “modification”.) +included without limitation in the term "modification".) -“Source code” for a work means the preferred form of the work for +"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control @@ -83,7 +83,7 @@ covered only if its contents constitute a work based on the Library it). Whether that is true depends on what the Library does and what the program that uses the Library does. -1. You may copy and distribute verbatim copies of the Library’s +1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact @@ -170,17 +170,17 @@ source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or -linked with it, is called a “work that uses the Library”. Such a work, +linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. -However, linking a “work that uses the Library” with the Library +However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a “work that uses the -library”. The executable is therefore covered by this License. Section +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. -When a “work that uses the Library” uses material from a header file +When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be @@ -200,10 +200,10 @@ distribute the object code for the work under the terms of Section whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link -a “work that uses the Library” with the Library to produce a work +a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of -the work for the customer’s own use and reverse engineering for +the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the @@ -218,7 +218,7 @@ a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable liked with the Library, with the -complete machine-readable “work that uses the Library”, as object code +complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of @@ -227,7 +227,7 @@ recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy -of the library already present on the user’s computer system, rather +of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface- compatible @@ -245,8 +245,8 @@ specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. -For an executable, the required form of the “work that uses the -Library” must include any data and utility programs needed for +For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major @@ -296,7 +296,7 @@ the Library or works based on it. Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further -restrictions on the recipients’ exercise of the rights granted +restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. @@ -347,7 +347,7 @@ differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and -“any later version”, you have the option of following the terms and +"any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by @@ -367,7 +367,7 @@ NO WARRANTY 1 BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE LIBRARY “AS IS” WITHOUT WARRANTY OF ANY KIND, +PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index b0845700b6..cba0ace6d3 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -47,12 +47,27 @@ import llnl.util.tty as tty import spack import spack.error import spack.util.crypto as crypto +from spack.util.executable import * +from spack.util.string import * from spack.version import Version, ver from spack.util.compression import decompressor_for +"""List of all fetch strategies, created by FetchStrategy metaclass.""" +all_strategies = [] class FetchStrategy(object): + """Superclass of all fetch strategies.""" + enabled = False # Non-abstract subclasses should be enabled. + required_attributes = None # Attributes required in version() args. + + class __metaclass__(type): + """This metaclass registers all fetch strategies in a list.""" + def __init__(cls, name, bases, dict): + type.__init__(cls, name, bases, dict) + if cls.enabled: all_strategies.append(cls) + + def __init__(self): # The stage is initialized late, so that fetch strategies can be constructed # at package construction time. This is where things will be fetched. @@ -76,12 +91,16 @@ class FetchStrategy(object): # This method is used to match fetch strategies to version() # arguments in packages. @classmethod - def match(kwargs): - return any(k in kwargs for k in self.attributes) + def matches(cls, args): + return any(k in args for k in cls.required_attributes) class URLFetchStrategy(FetchStrategy): - attributes = ('url', 'md5') + """FetchStrategy that pulls source code from a URL for an archive, + checks the archive against a checksum,and decompresses the archive. + """ + enabled = True + required_attributes = ['url'] def __init__(self, url=None, digest=None, **kwargs): super(URLFetchStrategy, self).__init__() @@ -172,11 +191,11 @@ class URLFetchStrategy(FetchStrategy): assert(self.stage) if not self.digest: raise NoDigestError("Attempt to check URLFetchStrategy with no digest.") - checker = crypto.Checker(digest) + checker = crypto.Checker(self.digest) if not checker.check(self.archive_file): raise ChecksumError( "%s checksum failed for %s." % (checker.hash_name, self.archive_file), - "Expected %s but got %s." % (digest, checker.sum)) + "Expected %s but got %s." % (self.digest, checker.sum)) def reset(self): @@ -191,46 +210,73 @@ class URLFetchStrategy(FetchStrategy): def __str__(self): - if self.url: - return self.url - else: - return "URLFetchStrategy " + url = self.url if self.url else "no url" + return "URLFetchStrategy<%s>" % url class VCSFetchStrategy(FetchStrategy): - def __init__(self, name): + def __init__(self, name, *rev_types, **kwargs): super(VCSFetchStrategy, self).__init__() self.name = name + # Set a URL based on the type of fetch strategy. + self.url = kwargs.get(name, None) + if not self.url: raise ValueError( + "%s requires %s argument." % (self.__class__, name)) + + # Ensure that there's only one of the rev_types + if sum((k in kwargs for k in rev_types)) > 1: + raise FetchStrategyError( + "Supply only one of %s to fetch with %s." % ( + comma_or(rev_types), name)) + + # Set attributes for each rev type. + for rt in rev_types: + setattr(self, rt, getattr(kwargs, rt, None)) + def check(self): assert(self.stage) - tty.msg("No check needed when fetching with %s." % self.name) + tty.msg("No checksum needed when fetching with %s." % self.name) + def expand(self): assert(self.stage) tty.debug("Source fetched with %s is already expanded." % self.name) + def __str__(self): + return "%s<%s>" % (self.__class__, self.url) + + class GitFetchStrategy(VCSFetchStrategy): - attributes = ('git', 'ref', 'tag', 'branch') + """Fetch strategy that gets source code from a git repository. + Use like this in a package: - def __init__(self, **kwargs): - super(GitFetchStrategy, self).__init__("git") - self.url = kwargs.get('git', None) - if not self.url: - raise ValueError("GitFetchStrategy requires git argument.") + version('name', git='https://github.com/project/repo.git') - if sum((k in kwargs for k in ('ref', 'tag', 'branch'))) > 1: - raise FetchStrategyError( - "Git requires exactly one ref, branch, or tag.") + Optionally, you can provide a branch, or commit to check out, e.g.: + + version('1.1', git='https://github.com/project/repo.git', tag='v1.1') + + You can use these three optional attributes in addition to ``git``: + + * ``branch``: Particular branch to build from (default is master) + * ``tag``: Particular tag to check out + * ``commit``: Particular commit hash in the repo + """ + enabled = True + required_attributes = ('git',) + def __init__(self, **kwargs): + super(GitFetchStrategy, self).__init__( + 'git', 'tag', 'branch', 'commit', **kwargs) self._git = None - self.ref = kwargs.get('ref', None) - self.branch = kwargs.get('branch', None) + + # For git fetch branches and tags the same way. if not self.branch: - self.branch = kwargs.get('tag', None) + self.branch = self.tag @property @@ -252,21 +298,20 @@ class GitFetchStrategy(VCSFetchStrategy): self.stage.chdir() if self.stage.source_path: - tty.msg("Already fetched %s." % self.source_path) + tty.msg("Already fetched %s." % self.stage.source_path) return tty.msg("Trying to clone git repository: %s" % self.url) - - if self.ref: + if self.commit: # Need to do a regular clone and check out everything if - # they asked for a particular ref. - git('clone', self.url) - self.chdir_to_source() - git('checkout', self.ref) + # they asked for a particular commit. + self.git('clone', self.url) + self.stage.chdir_to_source() + self.git('checkout', self.commit) else: - # Can be more efficient if not checking out a specific ref. + # Can be more efficient if not checking out a specific commit. args = ['clone'] # If we want a particular branch ask for it. @@ -279,26 +324,77 @@ class GitFetchStrategy(VCSFetchStrategy): args.append('--single-branch') args.append(self.url) - git(*args) - self.chdir_to_source() + self.git(*args) + self.stage.chdir_to_source() def reset(self): assert(self.stage) - git = which('git', required=True) + self.stage.chdir_to_source() + self.git('checkout', '.') + self.git('clean', '-f') + +class SvnFetchStrategy(VCSFetchStrategy): + """Fetch strategy that gets source code from a subversion repository. + Use like this in a package: + + version('name', svn='http://www.example.com/svn/trunk') + + Optionally, you can provide a revision for the URL: + + version('name', svn='http://www.example.com/svn/trunk', + revision='1641') + """ + enabled = True + required_attributes = ['svn'] + + def __init__(self, **kwargs): + super(SvnFetchStrategy, self).__init__( + 'svn', 'revision', **kwargs) + self._svn = None + + + @property + def svn(self): + if not self._svn: + self._svn = which('svn', required=True) + return self._svn + + + def fetch(self): + assert(self.stage) + self.stage.chdir() + + if self.stage.source_path: + tty.msg("Already fetched %s." % self.stage.source_path) + return + + tty.msg("Trying to check out svn repository: %s" % self.url) + + args = ['checkout', '--force'] + if self.revision: + args += ['-r', self.revision] + + self.svn(*args) self.stage.chdir_to_source() - git('checkout', '.') - git('clean', '-f') - def __str__(self): - return self.url + def _remove_untracked_files(self): + """Removes untracked files in an svn repository.""" + status = self.svn('status', '--no-ignore', check_output=True) + for line in status.split('\n'): + if not re.match('^[I?]'): + continue + path = line[8:].strip() + shutil.rmtree(path, ignore_errors=True) -class SvnFetchStrategy(FetchStrategy): - attributes = ('svn', 'rev', 'revision') - pass + def reset(self): + assert(self.stage) + self.stage.chdir_to_source() + self._remove_untracked_files() + self.svn('revert', '.', '-R') def from_url(url): @@ -312,25 +408,31 @@ def from_url(url): def args_are_for(args, fetcher): - return any(arg in args for arg in fetcher.attributes) + fetcher.matches(args) def from_args(args, pkg): """Determine a fetch strategy based on the arguments supplied to version() in the package description.""" - fetchers = (URLFetchStrategy, GitFetchStrategy) - for fetcher in fetchers: - if args_are_for(args, fetcher): - attrs = {} - for attr in fetcher.attributes: - default = getattr(pkg, attr, None) - if default: - attrs[attr] = default - - attrs.update(args) + + # Test all strategies against per-version arguments. + for fetcher in all_strategies: + if fetcher.matches(args): + return fetcher(**args) + + # If nothing matched for a *specific* version, test all strategies + # against + for fetcher in all_strategies: + attrs = dict((attr, getattr(pkg, attr, None)) + for attr in fetcher.required_attributes) + attrs.update(args) + if fetcher.matches(attrs): return fetcher(**attrs) - return None + raise InvalidArgsError( + "Could not construct fetch strategy for package %s", + pkg.spec.format("%_%@")) + class FetchStrategyError(spack.error.SpackError): def __init__(self, msg, long_msg): diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 553e0118e3..e9fca9ec49 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -453,19 +453,18 @@ class Package(object): raise ValueError("Can only get a stage for a concrete package.") if self._stage is None: - if not self.url: - raise PackageVersionError(self.version) - - # TODO: move this logic into a mirror module. - # TODO: get rid of dependence on extension. - mirror_path = "%s/%s" % (self.name, "%s-%s.%s" % ( - self.name, self.version, extension(self.url))) - self._stage = Stage( - self.fetcher, mirror_path=mirror_path, name=self.spec.short_spec) + self.fetcher, mirror_path=self.mirror_path(), name=self.spec.short_spec) return self._stage + def mirror_path(self): + """Get path to this package's archive in a mirror.""" + filename = "%s-%s." % (self.name, self.version) + filename += extension(self.url) if self.has_url() else "tar.gz" + return "%s/%s" % (self.name, filename) + + def preorder_traversal(self, visited=None, **kwargs): """This does a preorder traversal of the package's dependence DAG.""" virtual = kwargs.get("virtual", False) @@ -617,9 +616,7 @@ class Package(object): self.stage.fetch() if spack.do_checksum and self.version in self.versions: - digest = self.versions[self.version].checksum - self.stage.check(digest) - tty.msg("Checksum passed for %s@%s" % (self.name, self.version)) + self.stage.check() def do_stage(self): @@ -645,8 +642,14 @@ class Package(object): if not self.spec.concrete: raise ValueError("Can only patch concrete packages.") + # Kick off the stage first. self.do_stage() + # If there are no patches, note it. + if not self.patches: + tty.msg("No patches needed for %s." % self.name) + return + # Construct paths to special files in the archive dir used to # keep track of whether patches were successfully applied. archive_dir = self.stage.source_path diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index 5dc6eac488..ed92fb17f7 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -84,14 +84,12 @@ class Stage(object): """ if isinstance(url_or_fetch_strategy, basestring): self.fetcher = fetch_strategy.from_url(url_or_fetch_strategy) - self.fetcher.set_stage(self) - elif isinstance(url_or_fetch_strategy, fetch_strategy.FetchStrategy): self.fetcher = url_or_fetch_strategy - else: raise ValueError("Can't construct Stage without url or fetch strategy") + self.fetcher.set_stage(self) self.name = kwargs.get('name') self.mirror_path = kwargs.get('mirror_path') @@ -260,7 +258,7 @@ class Stage(object): continue - def check(self, digest): + def check(self): """Check the downloaded archive against a checksum digest. No-op if this stage checks code out of a repository.""" self.fetcher.check() diff --git a/var/spack/packages/callpath/package.py b/var/spack/packages/callpath/package.py index 84170d9c9e..6102458291 100644 --- a/var/spack/packages/callpath/package.py +++ b/var/spack/packages/callpath/package.py @@ -33,6 +33,8 @@ class Callpath(Package): version('1.0.1', '0047983d2a52c5c335f8ba7f5bab2325') + depends_on("libelf") + depends_on("libdwarf") depends_on("dyninst") depends_on("adept-utils") depends_on("mpi") -- cgit v1.2.3-70-g09d2 From da84764e97ead919bee7fb02d469c25a6b03ab63 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 1 Oct 2014 23:32:36 -0700 Subject: Add test case for git fetching. --- lib/spack/spack/fetch_strategy.py | 15 ++- lib/spack/spack/package.py | 21 +++- lib/spack/spack/packages.py | 21 +++- lib/spack/spack/test/__init__.py | 3 +- lib/spack/spack/test/git_fetch.py | 175 ++++++++++++++++++++++++++++ lib/spack/spack/test/install.py | 5 - var/spack/mock_packages/git-test/package.py | 10 ++ 7 files changed, 232 insertions(+), 18 deletions(-) create mode 100644 lib/spack/spack/test/git_fetch.py create mode 100644 var/spack/mock_packages/git-test/package.py (limited to 'var') diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index cba0ace6d3..328f45c3d6 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -225,15 +225,14 @@ class VCSFetchStrategy(FetchStrategy): "%s requires %s argument." % (self.__class__, name)) # Ensure that there's only one of the rev_types - if sum((k in kwargs for k in rev_types)) > 1: + if sum(k in kwargs for k in rev_types) > 1: raise FetchStrategyError( "Supply only one of %s to fetch with %s." % ( comma_or(rev_types), name)) # Set attributes for each rev type. for rt in rev_types: - setattr(self, rt, getattr(kwargs, rt, None)) - + setattr(self, rt, kwargs.get(rt, None)) def check(self): assert(self.stage) @@ -301,7 +300,14 @@ class GitFetchStrategy(VCSFetchStrategy): tty.msg("Already fetched %s." % self.stage.source_path) return - tty.msg("Trying to clone git repository: %s" % self.url) + args = [] + if self.commit: + args.append('at commit %s' % self.commit) + elif self.tag: + args.append('at tag %s' % self.branch) + elif self.branch: + args.append('on branch %s' % self.branch) + tty.msg("Trying to clone git repository:", self.url, *args) if self.commit: # Need to do a regular clone and check out everything if @@ -460,4 +466,3 @@ class NoDigestError(FetchStrategyError): class InvalidArgsError(FetchStrategyError): def __init__(self, msg, long_msg): super(InvalidArgsError, self).__init__(msg, long_msg) - diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index e9fca9ec49..c6e1fd90ef 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -372,10 +372,8 @@ class Package(object): if not hasattr(self, 'url'): self.url = None - # Set up a fetch strategy for this package. - self.fetcher = None - if self.spec.concrete: - self.fetcher = fs.from_args(self.versions[self.version], self) + # Init fetch strategy to None + self._fetcher = None # Set a default list URL (place to find available versions) if not hasattr(self, 'list_url'): @@ -458,6 +456,21 @@ class Package(object): return self._stage + @property + def fetcher(self): + if not self.spec.concrete: + raise ValueError("Can only get a fetcher for a concrete package.") + + if not self._fetcher: + self._fetcher = fs.from_args(self.versions[self.version], self) + return self._fetcher + + + @fetcher.setter + def fetcher(self, f): + self._fetcher = f + + def mirror_path(self): """Get path to this package's archive in a mirror.""" filename = "%s-%s." % (self.name, self.version) diff --git a/lib/spack/spack/packages.py b/lib/spack/spack/packages.py index 72f9403a64..047d82a93a 100644 --- a/lib/spack/spack/packages.py +++ b/lib/spack/spack/packages.py @@ -47,10 +47,10 @@ _package_file_name = 'package.py' def _autospec(function): """Decorator that automatically converts the argument of a single-arg function to a Spec.""" - def converter(self, spec_like): + def converter(self, spec_like, **kwargs): if not isinstance(spec_like, spack.spec.Spec): spec_like = spack.spec.Spec(spec_like) - return function(self, spec_like) + return function(self, spec_like, **kwargs) return converter @@ -63,10 +63,14 @@ class PackageDB(object): @_autospec - def get(self, spec): + def get(self, spec, **kwargs): if spec.virtual: raise UnknownPackageError(spec.name) + if kwargs.get('new', False): + if spec in self.instances: + del self.instances[spec] + if not spec in self.instances: package_class = self.get_class_for_package_name(spec.name) try: @@ -77,6 +81,17 @@ class PackageDB(object): return self.instances[spec] + @_autospec + def delete(self, spec): + """Force a package to be recreated.""" + del self.instances[spec] + + + def purge(self): + """Clear entire package instance cache.""" + self.instances.clear() + + @_autospec def get_installed(self, spec): """Get all the installed specs that satisfy the provided spec constraint.""" diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py index 8ddc7f227d..b00f9a31ce 100644 --- a/lib/spack/spack/test/__init__.py +++ b/lib/spack/spack/test/__init__.py @@ -47,7 +47,8 @@ test_names = ['versions', 'package_sanity', 'config', 'directory_layout', - 'python_version'] + 'python_version', + 'git_fetch'] def list_tests(): diff --git a/lib/spack/spack/test/git_fetch.py b/lib/spack/spack/test/git_fetch.py new file mode 100644 index 0000000000..c7c11621f9 --- /dev/null +++ b/lib/spack/spack/test/git_fetch.py @@ -0,0 +1,175 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +import os +import unittest +import shutil +import tempfile +from contextlib import closing + +from llnl.util.filesystem import * + +import spack +from spack.version import ver +from spack.stage import Stage +from spack.util.executable import which +from spack.test.mock_packages_test import * + +test_repo_path = 'test-repo' +test_file_name = 'test-file.txt' + +test_branch = 'test-branch' +test_branch_file_name = 'branch-test-file' + +test_tag_branch = 'test-tag-branch' +test_tag = 'test-tag' +test_tag_file_name = 'tag-test-file' + +untracked = 'foobarbaz' + +git = which('git', required=True) + +def rev_hash(rev): + return git('rev-parse', rev, return_output=True).strip() + + +class GitFetchTest(MockPackagesTest): + """Tests fetching from a dummy git repository.""" + + def setUp(self): + """Create a git repository with master and two other branches, + and one tag, so that we can experiment on it.""" + super(GitFetchTest, self).setUp() + self.stage = Stage('fetch-test') + + self.repo_path = join_path(self.stage.path, test_repo_path) + mkdirp(self.repo_path) + + self.test_file = join_path(self.repo_path, test_file_name) + touch(self.test_file) + + with working_dir(self.repo_path): + git('init') + git('add', self.test_file) + git('commit', '-m', 'testing') + + git('branch', test_branch) + git('branch', test_tag_branch) + + git('checkout', test_branch) + touch(test_branch_file_name) + git('add', test_branch_file_name) + git('commit', '-m' 'branch test') + + git('checkout', test_tag_branch) + touch(test_tag_file_name) + git('add', test_tag_file_name) + git('commit', '-m' 'tag test') + git('tag', test_tag) + + git('checkout', 'master') + + self.commit = rev_hash(test_tag) + + spec = Spec('git-test') + spec.concretize() + self.pkg = spack.db.get(spec, new=True) + + + def tearDown(self): + """Destroy the stage space used by this test.""" + super(GitFetchTest, self).tearDown() + + if self.stage is not None: + self.stage.destroy() + + self.pkg.do_clean_dist() + + + def assert_rev(self, rev): + """Check that the current git revision is equal to the supplied rev.""" + self.assertEqual(rev_hash('HEAD'), rev_hash(rev)) + + + def try_fetch(self, rev, test_file, args): + """Tries to: + 1. Fetch the repo using a fetch strategy constructed with + supplied args. + 2. Check if the test_file is in the checked out repository. + 3. Assert that the repository is at the revision supplied. + 4. Add and remove some files, then reset the repo, and + ensure it's all there again. + """ + self.pkg.versions[ver('git')] = args + + self.pkg.do_stage() + self.assert_rev(rev) + + file_path = join_path(self.pkg.stage.source_path, test_file) + self.assertTrue(os.path.isdir(self.pkg.stage.source_path)) + self.assertTrue(os.path.isfile(file_path)) + + os.unlink(file_path) + self.assertFalse(os.path.isfile(file_path)) + + touch(untracked) + self.assertTrue(os.path.isfile(untracked)) + self.pkg.do_clean_work() + self.assertFalse(os.path.isfile(untracked)) + + self.assertTrue(os.path.isdir(self.pkg.stage.source_path)) + self.assertTrue(os.path.isfile(file_path)) + + self.assert_rev(rev) + + + def test_fetch_master(self): + """Test a default git checkout with no commit or tag specified.""" + self.try_fetch('master', test_file_name, { + 'git' : self.repo_path + }) + + + def test_fetch_branch(self): + """Test fetching a branch.""" + self.try_fetch(test_branch, test_branch_file_name, { + 'git' : self.repo_path, + 'branch' : test_branch + }) + + + def test_fetch_tag(self): + """Test fetching a tag.""" + self.try_fetch(test_tag, test_tag_file_name, { + 'git' : self.repo_path, + 'tag' : test_tag + }) + + + def test_fetch_commit(self): + """Test fetching a particular commit.""" + self.try_fetch(self.commit, test_tag_file_name, { + 'git' : self.repo_path, + 'commit' : self.commit + }) diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py index 896f19ac01..0d53bb45c7 100644 --- a/lib/spack/spack/test/install.py +++ b/lib/spack/spack/test/install.py @@ -101,13 +101,8 @@ class InstallTest(MockPackagesTest): self.assertTrue(spec.concrete) # Get the package - print - print "======== GETTING PACKAGE ========" pkg = spack.db.get(spec) - print "======== GOT PACKAGE ========" - print - # Fake the URL for the package so it downloads from a file. archive_path = join_path(self.stage.path, archive_name) pkg.fetcher = URLFetchStrategy('file://' + archive_path) diff --git a/var/spack/mock_packages/git-test/package.py b/var/spack/mock_packages/git-test/package.py new file mode 100644 index 0000000000..689185463c --- /dev/null +++ b/var/spack/mock_packages/git-test/package.py @@ -0,0 +1,10 @@ +from spack import * + +class GitTest(Package): + """Mock package that uses git for fetching.""" + homepage = "http://www.git-fetch-example.com" + + version('git', git='to-be-filled-in-by-test') + + def install(self, spec, prefix): + pass -- cgit v1.2.3-70-g09d2 From faae720c3693733ac272c191b7c3ab4908b02b6b Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 2 Oct 2014 01:14:00 -0700 Subject: add tests for svn fetching. --- lib/spack/spack/fetch_strategy.py | 26 ++++- lib/spack/spack/package.py | 2 +- lib/spack/spack/stage.py | 2 +- lib/spack/spack/test/__init__.py | 3 +- lib/spack/spack/test/svn_fetch.py | 150 ++++++++++++++++++++++++++++ var/spack/mock_packages/svn-test/package.py | 10 ++ 6 files changed, 186 insertions(+), 7 deletions(-) create mode 100644 lib/spack/spack/test/svn_fetch.py create mode 100644 var/spack/mock_packages/svn-test/package.py (limited to 'var') diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 328f45c3d6..411c8cc276 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -209,11 +209,18 @@ class URLFetchStrategy(FetchStrategy): self.expand() - def __str__(self): + def __repr__(self): url = self.url if self.url else "no url" return "URLFetchStrategy<%s>" % url + def __str__(self): + if self.url: + return self.url + else: + return "URLFetchStrategy" + + class VCSFetchStrategy(FetchStrategy): def __init__(self, name, *rev_types, **kwargs): super(VCSFetchStrategy, self).__init__() @@ -245,6 +252,10 @@ class VCSFetchStrategy(FetchStrategy): def __str__(self): + return self.url + + + def __repr__(self): return "%s<%s>" % (self.__class__, self.url) @@ -359,6 +370,8 @@ class SvnFetchStrategy(VCSFetchStrategy): super(SvnFetchStrategy, self).__init__( 'svn', 'revision', **kwargs) self._svn = None + if self.revision is not None: + self.revision = str(self.revision) @property @@ -381,6 +394,7 @@ class SvnFetchStrategy(VCSFetchStrategy): args = ['checkout', '--force'] if self.revision: args += ['-r', self.revision] + args.append(self.url) self.svn(*args) self.stage.chdir_to_source() @@ -388,12 +402,16 @@ class SvnFetchStrategy(VCSFetchStrategy): def _remove_untracked_files(self): """Removes untracked files in an svn repository.""" - status = self.svn('status', '--no-ignore', check_output=True) + status = self.svn('status', '--no-ignore', return_output=True) + self.svn('status', '--no-ignore') for line in status.split('\n'): - if not re.match('^[I?]'): + if not re.match('^[I?]', line): continue path = line[8:].strip() - shutil.rmtree(path, ignore_errors=True) + if os.path.isfile(path): + os.unlink(path) + elif os.path.isdir(path): + shutil.rmtree(path, ignore_errors=True) def reset(self): diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index c6e1fd90ef..59bfafa241 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -643,7 +643,7 @@ class Package(object): archive_dir = self.stage.source_path if not archive_dir: self.stage.expand_archive() - tty.msg("Created stage directory in %s." % self.stage.path) + tty.msg("Created stage in %s." % self.stage.path) else: tty.msg("Already staged %s in %s." % (self.name, self.stage.path)) self.stage.chdir_to_source() diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index ed92fb17f7..0d684df92d 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -254,7 +254,7 @@ class Stage(object): fetcher.fetch() break except spack.error.SpackError, e: - tty.msg("Download from %s failed." % fetcher) + tty.msg("Fetching %s failed." % fetcher) continue diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py index b00f9a31ce..61464293d2 100644 --- a/lib/spack/spack/test/__init__.py +++ b/lib/spack/spack/test/__init__.py @@ -48,7 +48,8 @@ test_names = ['versions', 'config', 'directory_layout', 'python_version', - 'git_fetch'] + 'git_fetch', + 'svn_fetch'] def list_tests(): diff --git a/lib/spack/spack/test/svn_fetch.py b/lib/spack/spack/test/svn_fetch.py new file mode 100644 index 0000000000..e253f21921 --- /dev/null +++ b/lib/spack/spack/test/svn_fetch.py @@ -0,0 +1,150 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +import os +import re +import unittest +import shutil +import tempfile +from contextlib import closing + +from llnl.util.filesystem import * + +import spack +from spack.version import ver +from spack.stage import Stage +from spack.util.executable import which +from spack.test.mock_packages_test import * + +test_repo_path = 'test-repo' + +test_import_path = 'test-import' +test_file_name = 'test-file.txt' +test_rev_file_name = 'test-rev-file' + +untracked = 'foobarbaz' + +svn = which('svn', required=True) +svnadmin = which('svnadmin', required=True) + + +class SvnFetchTest(MockPackagesTest): + """Tests fetching from a dummy git repository.""" + + def setUp(self): + """Create an svn repository with two revisions.""" + super(SvnFetchTest, self).setUp() + self.stage = Stage('fetch-test') + self.stage.chdir() + + repo_path = join_path(self.stage.path, test_repo_path) + svnadmin('create', repo_path) + self.repo_url = 'file://' + repo_path + + self.import_path = join_path(self.stage.path, test_import_path) + mkdirp(self.import_path) + with working_dir(self.import_path): + touch(test_file_name) + + svn('import', self.import_path, self.repo_url, '-m', 'Initial import') + + shutil.rmtree(self.import_path) + svn('checkout', self.repo_url, self.import_path) + with working_dir(self.import_path): + touch(test_rev_file_name) + svn('add', test_rev_file_name) + svn('ci', '-m', 'second revision') + + spec = Spec('svn-test') + spec.concretize() + self.pkg = spack.db.get(spec, new=True) + + + def tearDown(self): + """Destroy the stage space used by this test.""" + super(SvnFetchTest, self).tearDown() + + if self.stage is not None: + self.stage.destroy() + + self.pkg.do_clean_dist() + + + def assert_rev(self, rev): + """Check that the current revision is equal to the supplied rev.""" + def get_rev(): + output = svn('info', return_output=True) + self.assertTrue("Revision" in output) + for line in output.split('\n'): + match = re.match(r'Revision: (\d+)', line) + if match: + return int(match.group(1)) + self.assertEqual(get_rev(), rev) + + + def try_fetch(self, rev, test_file, args): + """Tries to: + 1. Fetch the repo using a fetch strategy constructed with + supplied args. + 2. Check if the test_file is in the checked out repository. + 3. Assert that the repository is at the revision supplied. + 4. Add and remove some files, then reset the repo, and + ensure it's all there again. + """ + self.pkg.versions[ver('svn')] = args + + self.pkg.do_stage() + self.assert_rev(rev) + + file_path = join_path(self.pkg.stage.source_path, test_file) + self.assertTrue(os.path.isdir(self.pkg.stage.source_path)) + self.assertTrue(os.path.isfile(file_path)) + + os.unlink(file_path) + self.assertFalse(os.path.isfile(file_path)) + + touch(untracked) + self.assertTrue(os.path.isfile(untracked)) + self.pkg.do_clean_work() + self.assertFalse(os.path.isfile(untracked)) + + self.assertTrue(os.path.isdir(self.pkg.stage.source_path)) + self.assertTrue(os.path.isfile(file_path)) + + self.assert_rev(rev) + + + def test_fetch_default(self): + """Test a default checkout and make sure it's on rev 1""" + self.try_fetch(2, test_rev_file_name, { + 'svn' : self.repo_url + }) + + + def test_fetch_r1(self): + """Test fetching an older revision (0).""" + self.try_fetch(1, test_file_name, { + 'svn' : self.repo_url, + 'revision' : 1 + }) diff --git a/var/spack/mock_packages/svn-test/package.py b/var/spack/mock_packages/svn-test/package.py new file mode 100644 index 0000000000..ba4d5522b4 --- /dev/null +++ b/var/spack/mock_packages/svn-test/package.py @@ -0,0 +1,10 @@ +from spack import * + +class SvnTest(Package): + """Mock package that uses svn for fetching.""" + url = "http://www.example.com/svn-test-1.0.tar.gz" + + version('svn', 'to-be-filled-in-by-test') + + def install(self, spec, prefix): + pass -- cgit v1.2.3-70-g09d2 From 0fa1c5b0a54c2b64dfc431449b1ba4491b9981c0 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 27 Sep 2014 00:04:50 -0700 Subject: Add Mercurial fetch strategy and lwm2. --- lib/spack/spack/fetch_strategy.py | 70 ++++++++++++++++++++++++++++++++++++++ var/spack/packages/lwm2/package.py | 18 ++++++++++ 2 files changed, 88 insertions(+) create mode 100644 var/spack/packages/lwm2/package.py (limited to 'var') diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 411c8cc276..ad9af43c96 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -421,6 +421,76 @@ class SvnFetchStrategy(VCSFetchStrategy): self.svn('revert', '.', '-R') +class HgFetchStrategy(VCSFetchStrategy): + """Fetch strategy that gets source code from a Mercurial repository. + Use like this in a package: + + version('name', hg='https://jay.grs.rwth-aachen.de/hg/lwm2') + + Optionally, you can provide a branch, or revision to check out, e.g.: + + version('torus', hg='https://jay.grs.rwth-aachen.de/hg/lwm2', branch='torus') + + You can use these three optional attributes in addition to ``hg``: + + * ``branch``: Particular branch to build from (default is 'default') + * ``tag``: Particular tag to check out + * ``revision``: Particular revision hash in the repo + """ + enabled = True + required_attributes = ['hg'] + + def __init__(self, **kwargs): + super(HgFetchStrategy, self).__init__( + 'hg', 'tag', 'branch', 'revision', **kwargs) + self._hg = None + + # For git fetch branches and tags the same way. + if not self.revision: + self.revision = self.branch + if not self.revision: + self.revision = self.tag + + + @property + def hg(self): + if not self._hg: + self._hg = which('hg', required=True) + return self._hg + + + def fetch(self): + assert(self.stage) + self.stage.chdir() + + if self.stage.source_path: + tty.msg("Already fetched %s." % self.stage.source_path) + return + + tty.msg("Trying to clone Mercurial repository: %s" % self.url) + + args = ['clone', self.url] + if self.revision: + args += ['-r', self.revision] + + self.hg(*args) + + + def reset(self): + assert(self.stage) + self.stage.chdir() + + scrubbed = "scrubbed-source-tmp" + args = ['clone'] + if self.revision: + args += ['-r', self.revision] + args += [self.stage.source_path, scrubbed] + + self.hg(*args) + shutil.rmtree(self.stage.source_path, ignore_errors=True) + shutil.move(scrubbed, self.stage.source_path) + + def from_url(url): """Given a URL, find an appropriate fetch strategy for it. Currently just gives you a URLFetchStrategy that uses curl. diff --git a/var/spack/packages/lwm2/package.py b/var/spack/packages/lwm2/package.py new file mode 100644 index 0000000000..bf95c3fe12 --- /dev/null +++ b/var/spack/packages/lwm2/package.py @@ -0,0 +1,18 @@ +from spack import * + +class Lwm2(Package): + """LWM2: Light Weight Measurement Module. This is a PMPI module + that can collect a number of time-sliced MPI and POSIX I/O + measurements from a program. + """ + homepage = "https://jay.grs.rwth-aachen.de/redmine/projects/lwm2" + + version('torus', hg='https://jay.grs.rwth-aachen.de/hg/lwm2', branch='torus') + + depends_on("papi") + depends_on("mpi") + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + make() + make("install") -- cgit v1.2.3-70-g09d2 From 37e96ff6e14e419fbc31a43a1de966a7221e8ac1 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 4 Oct 2014 18:38:47 -0700 Subject: Added test for Mercurial fetching. --- lib/spack/spack/fetch_strategy.py | 35 +++---- lib/spack/spack/test/__init__.py | 3 +- lib/spack/spack/test/hg_fetch.py | 143 +++++++++++++++++++++++++++++ var/spack/mock_packages/hg-test/package.py | 10 ++ var/spack/packages/lwm2/package.py | 2 +- 5 files changed, 174 insertions(+), 19 deletions(-) create mode 100644 lib/spack/spack/test/hg_fetch.py create mode 100644 var/spack/mock_packages/hg-test/package.py (limited to 'var') diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index ad9af43c96..321c7fbd54 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -315,7 +315,7 @@ class GitFetchStrategy(VCSFetchStrategy): if self.commit: args.append('at commit %s' % self.commit) elif self.tag: - args.append('at tag %s' % self.branch) + args.append('at tag %s' % self.tag) elif self.branch: args.append('on branch %s' % self.branch) tty.msg("Trying to clone git repository:", self.url, *args) @@ -431,26 +431,21 @@ class HgFetchStrategy(VCSFetchStrategy): version('torus', hg='https://jay.grs.rwth-aachen.de/hg/lwm2', branch='torus') - You can use these three optional attributes in addition to ``hg``: + You can use the optional 'revision' attribute to check out a + branch, tag, or particular revision in hg. To prevent + non-reproducible builds, using a moving target like a branch is + discouraged. - * ``branch``: Particular branch to build from (default is 'default') - * ``tag``: Particular tag to check out - * ``revision``: Particular revision hash in the repo + * ``revision``: Particular revision, branch, or tag. """ enabled = True required_attributes = ['hg'] def __init__(self, **kwargs): super(HgFetchStrategy, self).__init__( - 'hg', 'tag', 'branch', 'revision', **kwargs) + 'hg', 'revision', **kwargs) self._hg = None - # For git fetch branches and tags the same way. - if not self.revision: - self.revision = self.branch - if not self.revision: - self.revision = self.tag - @property def hg(self): @@ -467,7 +462,10 @@ class HgFetchStrategy(VCSFetchStrategy): tty.msg("Already fetched %s." % self.stage.source_path) return - tty.msg("Trying to clone Mercurial repository: %s" % self.url) + args = [] + if self.revision: + args.append('at revision %s' % self.revision) + tty.msg("Trying to clone Mercurial repository:", self.url, *args) args = ['clone', self.url] if self.revision: @@ -480,15 +478,18 @@ class HgFetchStrategy(VCSFetchStrategy): assert(self.stage) self.stage.chdir() + source_path = self.stage.source_path scrubbed = "scrubbed-source-tmp" + args = ['clone'] if self.revision: args += ['-r', self.revision] - args += [self.stage.source_path, scrubbed] - + args += [source_path, scrubbed] self.hg(*args) - shutil.rmtree(self.stage.source_path, ignore_errors=True) - shutil.move(scrubbed, self.stage.source_path) + + shutil.rmtree(source_path, ignore_errors=True) + shutil.move(scrubbed, source_path) + self.stage.chdir_to_source() def from_url(url): diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py index 61464293d2..ca4c869e42 100644 --- a/lib/spack/spack/test/__init__.py +++ b/lib/spack/spack/test/__init__.py @@ -49,7 +49,8 @@ test_names = ['versions', 'directory_layout', 'python_version', 'git_fetch', - 'svn_fetch'] + 'svn_fetch', + 'hg_fetch'] def list_tests(): diff --git a/lib/spack/spack/test/hg_fetch.py b/lib/spack/spack/test/hg_fetch.py new file mode 100644 index 0000000000..4b9a2f8bc9 --- /dev/null +++ b/lib/spack/spack/test/hg_fetch.py @@ -0,0 +1,143 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +import os +import unittest +import shutil +import tempfile +from contextlib import closing + +from llnl.util.filesystem import * + +import spack +from spack.version import ver +from spack.stage import Stage +from spack.util.executable import which +from spack.test.mock_packages_test import * + +test_repo_path = 'test-repo' +test_file_name = 'test-file.txt' +test_rev1_file_name = 'test-file2.txt' +untracked = 'foobarbaz' + +hg = which('hg', required=True) + +class HgFetchTest(MockPackagesTest): + """Tests fetching from a dummy hg repository.""" + + def get_rev(self): + """Get current mercurial revision.""" + return hg('id', '-i', return_output=True).strip() + + + def setUp(self): + """Create a hg repository with master and two other branches, + and one tag, so that we can experiment on it.""" + super(HgFetchTest, self).setUp() + self.stage = Stage('fetch-test') + + self.repo_path = join_path(self.stage.path, test_repo_path) + mkdirp(self.repo_path) + + test_file = join_path(self.repo_path, test_file_name) + test_file_rev1 = join_path(self.repo_path, test_rev1_file_name) + + with working_dir(self.repo_path): + hg('init') + + touch(test_file) + hg('add', test_file) + hg('commit', '-m', 'revision 0', '-u', 'test') + self.rev0 = self.get_rev() + + touch(test_file_rev1) + hg('add', test_file_rev1) + hg('commit', '-m' 'revision 1', '-u', 'test') + self.rev1 = self.get_rev() + + spec = Spec('hg-test') + spec.concretize() + self.pkg = spack.db.get(spec, new=True) + + + def tearDown(self): + """Destroy the stage space used by this test.""" + super(HgFetchTest, self).tearDown() + + if self.stage is not None: + self.stage.destroy() + + self.pkg.do_clean_dist() + + + def assert_rev(self, rev): + """Check that the current hg revision is equal to the supplied rev.""" + self.assertEqual(self.get_rev(), rev) + + + def try_fetch(self, rev, test_file, args): + """Tries to: + 1. Fetch the repo using a fetch strategy constructed with + supplied args. + 2. Check if the test_file is in the checked out repository. + 3. Assert that the repository is at the revision supplied. + 4. Add and remove some files, then reset the repo, and + ensure it's all there again. + """ + self.pkg.versions[ver('hg')] = args + + self.pkg.do_stage() + self.assert_rev(rev) + + file_path = join_path(self.pkg.stage.source_path, test_file) + self.assertTrue(os.path.isdir(self.pkg.stage.source_path)) + self.assertTrue(os.path.isfile(file_path)) + + os.unlink(file_path) + self.assertFalse(os.path.isfile(file_path)) + + touch(untracked) + self.assertTrue(os.path.isfile(untracked)) + self.pkg.do_clean_work() + self.assertFalse(os.path.isfile(untracked)) + + self.assertTrue(os.path.isdir(self.pkg.stage.source_path)) + self.assertTrue(os.path.isfile(file_path)) + + self.assert_rev(rev) + + + def test_fetch_default(self): + """Test a default hg checkout with no commit or tag specified.""" + self.try_fetch(self.rev1, test_rev1_file_name, { + 'hg' : self.repo_path + }) + + + def test_fetch_rev0(self): + """Test fetching a branch.""" + self.try_fetch(self.rev0, test_file_name, { + 'hg' : self.repo_path, + 'revision' : self.rev0 + }) diff --git a/var/spack/mock_packages/hg-test/package.py b/var/spack/mock_packages/hg-test/package.py new file mode 100644 index 0000000000..462f1e4c3a --- /dev/null +++ b/var/spack/mock_packages/hg-test/package.py @@ -0,0 +1,10 @@ +from spack import * + +class HgTest(Package): + """Test package that does fetching with mercurial.""" + homepage = "http://www.hg-fetch-example.com" + + version('hg', hg='to-be-filled-in-by-test') + + def install(self, spec, prefix): + pass diff --git a/var/spack/packages/lwm2/package.py b/var/spack/packages/lwm2/package.py index bf95c3fe12..31afff8816 100644 --- a/var/spack/packages/lwm2/package.py +++ b/var/spack/packages/lwm2/package.py @@ -7,7 +7,7 @@ class Lwm2(Package): """ homepage = "https://jay.grs.rwth-aachen.de/redmine/projects/lwm2" - version('torus', hg='https://jay.grs.rwth-aachen.de/hg/lwm2', branch='torus') + version('torus', hg='https://jay.grs.rwth-aachen.de/hg/lwm2', revision='torus') depends_on("papi") depends_on("mpi") -- cgit v1.2.3-70-g09d2 From 616d2322570937dfd9e0a90d7166c1d7489467c6 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 6 Oct 2014 10:26:54 -0700 Subject: Add package for Torsten's netgauge tool. --- var/spack/packages/netgauge/package.py | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 var/spack/packages/netgauge/package.py (limited to 'var') diff --git a/var/spack/packages/netgauge/package.py b/var/spack/packages/netgauge/package.py new file mode 100644 index 0000000000..851cd6d135 --- /dev/null +++ b/var/spack/packages/netgauge/package.py @@ -0,0 +1,35 @@ +# FIXME: +# This is a template package file for Spack. We've conveniently +# put "FIXME" labels next to all the things you'll want to change. +# +# Once you've edited all the FIXME's, delete this whole message, +# save this file, and test out your package like this: +# +# spack install netgauge +# +# You can always get back here to change things with: +# +# spack edit netgauge +# +# See the spack documentation for more information on building +# packages. +# +from spack import * + +class Netgauge(Package): + """Netgauge is a high-precision network parameter measurement + tool. It supports benchmarking of many different network protocols + and communication patterns. The main focus lies on accuracy, + statistical analysis and easy extensibility. + """ + homepage = "http://unixer.de/research/netgauge/" + url = "http://unixer.de/research/netgauge/netgauge-2.4.6.tar.gz" + + version('2.4.6', 'e0e040ec6452e93ca21ccc54deac1d7f') + + depends_on("mpi") + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + make() + make("install") -- cgit v1.2.3-70-g09d2 From 4cae48c8df8e637d6fc10a62d84c9408e82cbd2a Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 6 Oct 2014 13:48:50 -0700 Subject: Add libNBC (non-blocking collectives) --- var/spack/packages/libNBC/package.py | 43 ++++++++++++++++++++++++++++++++++ var/spack/packages/netgauge/package.py | 30 +++++++++++++++--------- 2 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 var/spack/packages/libNBC/package.py (limited to 'var') diff --git a/var/spack/packages/libNBC/package.py b/var/spack/packages/libNBC/package.py new file mode 100644 index 0000000000..6d08f3219c --- /dev/null +++ b/var/spack/packages/libNBC/package.py @@ -0,0 +1,43 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + +class Libnbc(Package): + """LibNBC is a prototypic implementation of a nonblocking + interface for MPI collective operations. Based on ANSI C and + MPI-1, it supports all MPI-1 collective operations in a + nonblocking manner. LibNBC is distributed under the BSD license. + """ + homepage = "http://unixer.de/research/nbcoll/libnbc/" + url = "http://unixer.de/research/nbcoll/libnbc/libNBC-1.1.1.tar.gz" + + version('1.1.1', 'ece5c94992591a9fa934a90e5dbe50ce') + + depends_on("mpi") + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + make() + make("install") diff --git a/var/spack/packages/netgauge/package.py b/var/spack/packages/netgauge/package.py index 851cd6d135..c2378b0718 100644 --- a/var/spack/packages/netgauge/package.py +++ b/var/spack/packages/netgauge/package.py @@ -1,19 +1,27 @@ -# FIXME: -# This is a template package file for Spack. We've conveniently -# put "FIXME" labels next to all the things you'll want to change. +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. # -# Once you've edited all the FIXME's, delete this whole message, -# save this file, and test out your package like this: +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 # -# spack install netgauge +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. # -# You can always get back here to change things with: +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. # -# spack edit netgauge -# -# See the spack documentation for more information on building -# packages. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. # +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## from spack import * class Netgauge(Package): -- cgit v1.2.3-70-g09d2 From 36a87f5bf9884978ba1f672322d9b7f663cf4f58 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 8 Oct 2014 03:07:54 -0700 Subject: Update documentation to add an auto-generated list of packages. --- lib/spack/docs/.gitignore | 1 + lib/spack/docs/Makefile | 9 +- .../docs/_themes/sphinx_rtd_theme/footer.html | 2 +- lib/spack/docs/conf.py | 2 +- lib/spack/docs/index.rst | 1 + lib/spack/llnl/util/tty/colify.py | 8 +- lib/spack/spack/cmd/info.py | 118 +++++++++++++++++---- var/spack/packages/cmake/package.py | 2 + var/spack/packages/dyninst/package.py | 2 + var/spack/packages/launchmon/package.py | 2 + var/spack/packages/libunwind/package.py | 2 + var/spack/packages/scr/package.py | 3 + var/spack/packages/spindle/package.py | 5 + 13 files changed, 133 insertions(+), 24 deletions(-) (limited to 'var') diff --git a/lib/spack/docs/.gitignore b/lib/spack/docs/.gitignore index 4d5300fbb9..7701dd9f12 100644 --- a/lib/spack/docs/.gitignore +++ b/lib/spack/docs/.gitignore @@ -1,2 +1,3 @@ +package_list.rst spack*.rst _build diff --git a/lib/spack/docs/Makefile b/lib/spack/docs/Makefile index 4baba720ef..4d71c2052e 100644 --- a/lib/spack/docs/Makefile +++ b/lib/spack/docs/Makefile @@ -21,6 +21,12 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . all: html +# +# This autogenerates a package list. +# +package_list: + spack info -r > package_list.rst + # # This creates a git repository and commits generated html docs. # It them pushes the new branch into THIS repository as gh-pages. @@ -69,9 +75,10 @@ help: @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: + -rm -f package_list.rst -rm -rf $(BUILDDIR)/* $(APIDOC_FILES) -html: apidoc +html: apidoc package_list $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." diff --git a/lib/spack/docs/_themes/sphinx_rtd_theme/footer.html b/lib/spack/docs/_themes/sphinx_rtd_theme/footer.html index 0eccd11178..5ec315e58f 100644 --- a/lib/spack/docs/_themes/sphinx_rtd_theme/footer.html +++ b/lib/spack/docs/_themes/sphinx_rtd_theme/footer.html @@ -13,7 +13,7 @@

- © Copyright 2013, + © Copyright 2013-2014, Lawrence Livermore National Laboratory.
Written by Todd Gamblin, tgamblin@llnl.gov, LLNL-CODE-647188 diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 700cb00299..b4d49c594d 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -90,7 +90,7 @@ master_doc = 'index' # General information about the project. project = u'Spack' -copyright = u'2013, Lawrence Livermore National Laboratory' +copyright = u'2013-2014, Lawrence Livermore National Laboratory' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/lib/spack/docs/index.rst b/lib/spack/docs/index.rst index ac0eac93f3..73eff43ab7 100644 --- a/lib/spack/docs/index.rst +++ b/lib/spack/docs/index.rst @@ -48,6 +48,7 @@ Table of Contents packaging_guide site_configuration developer_guide + package_list API Docs Indices and tables diff --git a/lib/spack/llnl/util/tty/colify.py b/lib/spack/llnl/util/tty/colify.py index 5586b2681a..ff06241937 100644 --- a/lib/spack/llnl/util/tty/colify.py +++ b/lib/spack/llnl/util/tty/colify.py @@ -109,13 +109,15 @@ def colify(elts, **options): # elts needs to be an array of strings so we can count the elements elts = [str(elt) for elt in elts] if not elts: - return + return (0, ()) if not tty: if tty is False or not isatty(output): for elt in elts: output.write("%s\n" % elt) - return + + maxlen = max(len(str(s)) for s in elts) + return (1, (maxlen,)) console_cols = options.get("cols", None) if not console_cols: @@ -150,6 +152,8 @@ def colify(elts, **options): if row == rows_last_col: cols -= 1 + return (config.cols, tuple(config.widths)) + def colified(elts, **options): """Invokes the colify() function but returns the result as a string diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py index bb147b30f5..c86dcac2f5 100644 --- a/lib/spack/spack/cmd/info.py +++ b/lib/spack/spack/cmd/info.py @@ -24,52 +24,132 @@ ############################################################################## import re import textwrap -from llnl.util.tty.colify import colify +from StringIO import StringIO +from llnl.util.tty.colify import * import spack description = "Get detailed information on a particular package" def setup_parser(subparser): - subparser.add_argument('name', metavar="PACKAGE", help="name of packages to get info on") + subparser.add_argument('-r', '--rst', action='store_true', + help="List all packages in reStructured text, for docs.") + subparser.add_argument('name', metavar="PACKAGE", nargs='?', help="name of packages to get info on") -def info(parser, args): - package = spack.db.get(args.name) - print "Package: ", package.name - print "Homepage: ", package.homepage +def format_doc(pkg, **kwargs): + """Wrap doc string at 72 characters and format nicely""" + indent = kwargs.get('indent', 0) + + if not pkg.__doc__: + return "" + + doc = re.sub(r'\s+', ' ', pkg.__doc__) + lines = textwrap.wrap(doc, 72) + results = StringIO() + for line in lines: + results.write((" " * indent) + line + "\n") + return results.getvalue() + + +def github_url(pkg): + """Link to a package file on github.""" + return ("https://github.com/scalability-llnl/spack/blob/master/var/spack/packages/%s/package.py" % + pkg.name) + + +def rst_table(elts): + """Print out a RST-style table.""" + cols = StringIO() + ncol, widths = colify(elts, output=cols, tty=True) + header = " ".join("=" * (w-1) for w in widths) + return "%s\n%s%s" % (header, cols.getvalue(), header) + + +def info_rst(): + """Print out information on all packages in restructured text.""" + pkgs = sorted(spack.db.all_packages(), key=lambda s:s.name.lower()) + + print "Package List" + print "==================" + + print "This is a list of things you can install using Spack. It is" + print "automatically generated based on the packages in the latest Spack" + print "release." + print + + print "Spack currently has %d mainline packages:" % len(pkgs) + print + print rst_table("`%s`_" % p.name for p in pkgs) + print + print "-----" + + # Output some text for each package. + for pkg in pkgs: + print + print ".. _%s:" % pkg.name + print + print pkg.name + print "-" * len(pkg.name) + print "Links" + print " * `Homepage <%s>`__" % pkg.homepage + print " * `%s/package.py <%s>`__" % (pkg.name, github_url(pkg)) + print + if pkg.dependencies: + print "Dependencies" + print " " + ", ".join("`%s`_" % d if d != "mpi" else d + for d in pkg.dependencies) + print + print "Description" + print format_doc(pkg, indent=2) + print + print "-----" + + +def info_text(pkg): + """Print out a plain text description of a package.""" + print "Package: ", pkg.name + print "Homepage: ", pkg.homepage print print "Safe versions: " - if not package.versions: + if not pkg.versions: print("None.") else: - maxlen = max(len(str(v)) for v in package.versions) + maxlen = max(len(str(v)) for v in pkg.versions) fmt = "%%-%ss" % maxlen - for v in reversed(sorted(package.versions)): - print " " + (fmt % v) + " " + package.url_for_version(v) + for v in reversed(sorted(pkg.versions)): + print " " + (fmt % v) + " " + pkg.url_for_version(v) print print "Dependencies:" - if package.dependencies: - colify(package.dependencies, indent=4) + if pkg.dependencies: + colify(pkg.dependencies, indent=4) else: print " None" print print "Virtual packages: " - if package.provided: - for spec, when in package.provided.items(): + if pkg.provided: + for spec, when in pkg.provided.items(): print " %s provides %s" % (when, spec) else: print " None" print print "Description:" - if package.__doc__: - doc = re.sub(r'\s+', ' ', package.__doc__) - lines = textwrap.wrap(doc, 72) - for line in lines: - print " " + line + if pkg.__doc__: + print format_doc(pkg, indent=4) else: print " None" + + +def info(parser, args): + if args.rst: + info_rst() + + else: + if not args.name: + tty.die("You must supply a package name.") + pkg = spack.db.get(args.name) + info_text(pkg) diff --git a/var/spack/packages/cmake/package.py b/var/spack/packages/cmake/package.py index ca6553df84..890af9baa9 100644 --- a/var/spack/packages/cmake/package.py +++ b/var/spack/packages/cmake/package.py @@ -25,6 +25,8 @@ from spack import * class Cmake(Package): + """A cross-platform, open-source build system. CMake is a family of + tools designed to build, test and package software.""" homepage = 'https://www.cmake.org' url = 'http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz' diff --git a/var/spack/packages/dyninst/package.py b/var/spack/packages/dyninst/package.py index 069237f7ff..df19ac7bc0 100644 --- a/var/spack/packages/dyninst/package.py +++ b/var/spack/packages/dyninst/package.py @@ -25,6 +25,8 @@ from spack import * class Dyninst(Package): + """API for dynamic binary instrumentation. Modify programs while they + are executing without recompiling, re-linking, or re-executing.""" homepage = "https://paradyn.org" url = "http://www.dyninst.org/sites/default/files/downloads/dyninst/8.1.2/DyninstAPI-8.1.2.tgz" list_url = "http://www.dyninst.org/downloads/dyninst-8.x" diff --git a/var/spack/packages/launchmon/package.py b/var/spack/packages/launchmon/package.py index b6773a85bc..bdf988bdd3 100644 --- a/var/spack/packages/launchmon/package.py +++ b/var/spack/packages/launchmon/package.py @@ -25,6 +25,8 @@ from spack import * class Launchmon(Package): + """Software infrastructure that enables HPC run-time tools to + co-locate tool daemons with a parallel job.""" homepage = "http://sourceforge.net/projects/launchmon" url = "http://downloads.sourceforge.net/project/launchmon/launchmon/1.0.1%20release/launchmon-1.0.1.tar.gz" diff --git a/var/spack/packages/libunwind/package.py b/var/spack/packages/libunwind/package.py index aeadc85eb3..239fcbcfd5 100644 --- a/var/spack/packages/libunwind/package.py +++ b/var/spack/packages/libunwind/package.py @@ -25,6 +25,8 @@ from spack import * class Libunwind(Package): + """A portable and efficient C programming interface (API) to determine + the call-chain of a program.""" homepage = "http://www.nongnu.org/libunwind/" url = "http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz" diff --git a/var/spack/packages/scr/package.py b/var/spack/packages/scr/package.py index d480dba62f..d456ecaba0 100644 --- a/var/spack/packages/scr/package.py +++ b/var/spack/packages/scr/package.py @@ -25,6 +25,9 @@ from spack import * class Scr(Package): + """SCR caches checkpoint data in storage on the compute nodes of a + Linux cluster to provide a fast, scalable checkpoint/restart + capability for MPI codes""" homepage = "https://computation-rnd.llnl.gov/scr" url = "http://downloads.sourceforge.net/project/scalablecr/releases/scr-1.1-7.tar.gz" diff --git a/var/spack/packages/spindle/package.py b/var/spack/packages/spindle/package.py index bb0b74ab6f..fd59282ebb 100644 --- a/var/spack/packages/spindle/package.py +++ b/var/spack/packages/spindle/package.py @@ -25,6 +25,11 @@ from spack import * class Spindle(Package): + """Spindle improves the library-loading performance of dynamically + linked HPC applications. Without Spindle large MPI jobs can + overload on a shared file system when loading dynamically + linked libraries, causing site-wide performance problems. + """ homepage = "https://computation-rnd.llnl.gov/spindle" url = "https://github.com/hpc/Spindle/archive/v0.8.1.tar.gz" list_url = "https://github.com/hpc/Spindle/releases" -- cgit v1.2.3-70-g09d2 From 4c614ac768dafd465d50f31bfebc0c3296881113 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 7 Oct 2014 09:21:05 -0700 Subject: Add SUNDIALS solver package. --- var/spack/packages/sundials/package.py | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 var/spack/packages/sundials/package.py (limited to 'var') diff --git a/var/spack/packages/sundials/package.py b/var/spack/packages/sundials/package.py new file mode 100644 index 0000000000..8b784c8c3c --- /dev/null +++ b/var/spack/packages/sundials/package.py @@ -0,0 +1,39 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + +class Sundials(Package): + """SUNDIALS (SUite of Nonlinear and DIfferential/ALgebraic equation Solvers)""" + homepage = "http://computation.llnl.gov/casc/sundials/" + url = "http://computation.llnl.gov/casc/sundials/download/code/sundials-2.5.0.tar.gz" + + version('2.5.0', 'aba8b56eec600de3109cfb967aa3ba0f') + + depends_on("mpi") + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + make() + make("install") -- cgit v1.2.3-70-g09d2 From 8857b1f69e4a2dca5d08e7817c69e080da8e8266 Mon Sep 17 00:00:00 2001 From: David Boehme Date: Wed, 8 Oct 2014 17:31:11 -0700 Subject: Add Scalasca 2.1 --- var/spack/packages/scalasca/package.py | 38 +++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'var') diff --git a/var/spack/packages/scalasca/package.py b/var/spack/packages/scalasca/package.py index b76d0a7df5..cf7a40c1f5 100644 --- a/var/spack/packages/scalasca/package.py +++ b/var/spack/packages/scalasca/package.py @@ -11,25 +11,47 @@ class Scalasca(Package): # FIXME: add a proper url for your package's homepage here. homepage = "http://www.scalasca.org" - url = "http://apps.fz-juelich.de/scalasca/releases/scalasca/2.1/dist/scalasca-2.1-rc2.tar.gz" + url = "http://apps.fz-juelich.de/scalasca/releases/scalasca/2.1/dist/scalasca-2.1.tar.gz" - version('2.1-rc2', '1a95a39e5430539753e956a7524a756b') + version('2.1', 'bab9c2b021e51e2ba187feec442b96e6', + url = 'http://apps.fz-juelich.de/scalasca/releases/scalasca/2.1/dist/scalasca-2.1.tar.gz' ) depends_on("mpi") depends_on("otf2@1.4") - depends_on("cube") + depends_on("cube@4.2.3") + + backend_user_provided = """\ +CC=cc +CXX=c++ +F77=f77 +FC=f90 +CFLAGS=-fPIC +CXXFLAGS=-fPIC +""" + frontend_user_provided = """\ +CC_FOR_BUILD=cc +CXX_FOR_BUILD=c++ +F77_FOR_BUILD=f70 +FC_FOR_BUILD=f90 +CFLAGS_FOR_BUILD=-fPIC +CXXFLAGS_FOR_BUILD=-fPIC +""" + mpi_user_provided = """\ +MPICC=mpicc +MPICXX=mpicxx +MPIF77=mpif77 +MPIFC=mpif90 +MPI_CFLAGS=-fPIC +MPI_CXXFLAGS=-fPIC +""" def install(self, spec, prefix): configure_args = ["--prefix=%s" % prefix, + "--with-custom-compilers", "--with-otf2=%s" % spec['otf2'].prefix.bin, "--with-cube=%s" % spec['cube'].prefix.bin, "--enable-shared"] - if spec.satisfies('%gcc'): - configure_args.append('--with-nocross-compiler-suite=gcc') - if spec.satisfies('%intel'): - configure_args.append('--with-nocross-compiler-suite=intel') - configure(*configure_args) make() -- cgit v1.2.3-70-g09d2 From 1fcfb80bdd688775e30660c7a777a368dd8fcc71 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 10 Oct 2014 09:21:31 -0700 Subject: SPACK-19 no longer an issue. Removing libtool copy. --- var/spack/packages/stat/package.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'var') diff --git a/var/spack/packages/stat/package.py b/var/spack/packages/stat/package.py index 956b0dcc8c..5df07975f7 100644 --- a/var/spack/packages/stat/package.py +++ b/var/spack/packages/stat/package.py @@ -27,9 +27,5 @@ class Stat(Package): "--with-stackwalker=%s" % spec['dyninst'].prefix, "--with-libdwarf=%s" % spec['libdwarf'].prefix) - # TODO: remove once SPACK-19 is fixed - import shutil - shutil.copy2('/usr/bin/libtool', 'libtool') - make(parallel=False) make("install") -- cgit v1.2.3-70-g09d2 From fb3003f664d13f95c1d8c6e2c430924165bd576f Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 16 Oct 2014 06:56:00 -0700 Subject: Bug fixes for URLs and mirror fetching. --- lib/spack/spack/cmd/mirror.py | 9 ++++++++- lib/spack/spack/concretize.py | 1 + lib/spack/spack/fetch_strategy.py | 24 +++++++++++++++++------- lib/spack/spack/mirror.py | 2 +- lib/spack/spack/stage.py | 23 ++++++++++------------- var/spack/packages/libmonitor/package.py | 3 +-- var/spack/packages/paraver/package.py | 4 ++-- var/spack/packages/stat/package.py | 2 +- 8 files changed, 41 insertions(+), 27 deletions(-) (limited to 'var') diff --git a/lib/spack/spack/cmd/mirror.py b/lib/spack/spack/cmd/mirror.py index 6e2e4dfb24..22838e1344 100644 --- a/lib/spack/spack/cmd/mirror.py +++ b/lib/spack/spack/cmd/mirror.py @@ -71,8 +71,12 @@ def setup_parser(subparser): def mirror_add(args): """Add a mirror to Spack.""" + url = args.url + if url.startswith('/'): + url = 'file://' + url + config = spack.config.get_config('user') - config.set_value('mirror', args.name, 'url', args.url) + config.set_value('mirror', args.name, 'url', url) config.write() @@ -158,6 +162,9 @@ def mirror_create(args): " %-4d already present" % p, " %-4d added" % m, " %-4d failed to fetch." % e) + if error: + tty.error("Failed downloads:") + colify(s.format("$_$@") for s in error) def mirror(parser, args): diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index e603806af9..eee8cb7fde 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -70,6 +70,7 @@ class DefaultConcretizer(object): pkg = spec.package valid_versions = [v for v in pkg.available_versions if any(v.satisfies(sv) for sv in spec.versions)] + if valid_versions: spec.versions = ver([valid_versions[-1]]) else: diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 2b574eaba7..5a508b130c 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -559,7 +559,7 @@ def for_package_version(pkg, version): url = pkg.url_for_verison(version) if not url: raise InvalidArgsError(pkg, version) - return URLFetchStrategy() + return URLFetchStrategy(url) # Grab a dict of args out of the package version dict args = pkg.versions[version] @@ -574,6 +574,8 @@ def for_package_version(pkg, version): for fetcher in all_strategies: attrs = dict((attr, getattr(pkg, attr, None)) for attr in fetcher.required_attributes) + if 'url' in attrs: + attrs['url'] = pkg.url_for_version(version) attrs.update(args) if fetcher.matches(attrs): return fetcher(**attrs) @@ -581,12 +583,12 @@ def for_package_version(pkg, version): raise InvalidArgsError(pkg, version) -class FetchStrategyError(spack.error.SpackError): +class FetchError(spack.error.SpackError): def __init__(self, msg, long_msg): - super(FetchStrategyError, self).__init__(msg, long_msg) + super(FetchError, self).__init__(msg, long_msg) -class FailedDownloadError(FetchStrategyError): +class FailedDownloadError(FetchError): """Raised wen a download fails.""" def __init__(self, url, msg=""): super(FailedDownloadError, self).__init__( @@ -594,18 +596,26 @@ class FailedDownloadError(FetchStrategyError): self.url = url -class NoArchiveFileError(FetchStrategyError): +class NoArchiveFileError(FetchError): def __init__(self, msg, long_msg): super(NoArchiveFileError, self).__init__(msg, long_msg) -class NoDigestError(FetchStrategyError): +class NoDigestError(FetchError): def __init__(self, msg, long_msg): super(NoDigestError, self).__init__(msg, long_msg) -class InvalidArgsError(FetchStrategyError): +class InvalidArgsError(FetchError): def __init__(self, pkg, version): msg = "Could not construct a fetch strategy for package %s at version %s" msg %= (pkg.name, version) super(InvalidArgsError, self).__init__(msg) + + +class ChecksumError(FetchError): + """Raised when archive fails to checksum.""" + def __init__(self, message, long_msg=None): + super(ChecksumError, self).__init__(message, long_msg) + + diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py index f7bbb3f840..2f822b13ab 100644 --- a/lib/spack/spack/mirror.py +++ b/lib/spack/spack/mirror.py @@ -146,7 +146,7 @@ def create(path, specs, **kwargs): archive_file = mirror_archive_filename(spec) archive_path = join_path(subdir, archive_file) - if os.path.exists(archive_file): + if os.path.exists(archive_path): tty.msg("%s is already present. Skipping." % spec.format("$_$@")) present.append(spec) continue diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index 0d684df92d..b371761785 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -32,7 +32,7 @@ from llnl.util.filesystem import * import spack import spack.config -import spack.fetch_strategy as fetch_strategy +import spack.fetch_strategy as fs import spack.error @@ -83,8 +83,8 @@ class Stage(object): stage will be given a unique name automatically. """ if isinstance(url_or_fetch_strategy, basestring): - self.fetcher = fetch_strategy.from_url(url_or_fetch_strategy) - elif isinstance(url_or_fetch_strategy, fetch_strategy.FetchStrategy): + self.fetcher = fs.from_url(url_or_fetch_strategy) + elif isinstance(url_or_fetch_strategy, fs.FetchStrategy): self.fetcher = url_or_fetch_strategy else: raise ValueError("Can't construct Stage without url or fetch strategy") @@ -198,7 +198,10 @@ class Stage(object): @property def archive_file(self): """Path to the source archive within this stage directory.""" - paths = [os.path.join(self.path, os.path.basename(self.url))] + if not isinstance(self.fetcher, fs.URLFetchStrategy): + return None + + paths = [os.path.join(self.path, os.path.basename(self.fetcher.url))] if self.mirror_path: paths.append(os.path.join(self.path, os.path.basename(self.mirror_path))) @@ -242,9 +245,9 @@ class Stage(object): urls = ["%s/%s" % (m, self.mirror_path) for m in _get_mirrors()] digest = None - if isinstance(self.fetcher, fetch_strategy.URLFetchStrategy): + if isinstance(self.fetcher, fs.URLFetchStrategy): digest = self.fetcher.digest - fetchers = [fetch_strategy.URLFetchStrategy(url, digest) + fetchers = [fs.URLFetchStrategy(url, digest) for url in urls] + fetchers for f in fetchers: f.set_stage(self) @@ -365,12 +368,6 @@ class StageError(spack.error.SpackError): super(self, StageError).__init__(message, long_message) -class ChecksumError(StageError): - """Raised when archive fails to checksum.""" - def __init__(self, message, long_msg=None): - super(ChecksumError, self).__init__(message, long_msg) - - class RestageError(StageError): def __init__(self, message, long_msg=None): super(RestageError, self).__init__(message, long_msg) @@ -382,4 +379,4 @@ class ChdirError(StageError): # Keep this in namespace for convenience -FailedDownloadError = spack.fetch_strategy.FailedDownloadError +FailedDownloadError = fs.FailedDownloadError diff --git a/var/spack/packages/libmonitor/package.py b/var/spack/packages/libmonitor/package.py index 210712436a..ed619e4cce 100644 --- a/var/spack/packages/libmonitor/package.py +++ b/var/spack/packages/libmonitor/package.py @@ -27,9 +27,8 @@ from spack import * class Libmonitor(Package): """Libmonitor is a library for process and thread control.""" homepage = "http://hpctoolkit.org" - url = "file:///g/g0/legendre/tools/oss/openspeedshop-release-2.1/SOURCES/libmonitor-20130218.tar.gz" - version('20130218', 'aa85c2c580e2dafb823cc47b09374279') + version('20130218', svn='https://outreach.scidac.gov/svn/libmonitor/trunk', revision=146) def install(self, spec, prefix): configure("--prefix=" + prefix) diff --git a/var/spack/packages/paraver/package.py b/var/spack/packages/paraver/package.py index 45bac95b28..5f8a153d4c 100644 --- a/var/spack/packages/paraver/package.py +++ b/var/spack/packages/paraver/package.py @@ -7,9 +7,9 @@ class Paraver(Package): is expressed on its input trace format. Traces for parallel MPI, OpenMP and other programs can be genereated with Extrae.""" homepage = "http://www.bsc.es/computer-sciences/performance-tools/paraver" - url = "http://www.bsc.es/ssl/apps/performanceTools/files/paraver-sources-4.5.2.tar.gz" + url = "http://www.bsc.es/ssl/apps/performanceTools/files/paraver-sources-4.5.3.tar.gz" - version('4.5.2', 'ea463dd494519395c99ebae294edee17') + version('4.5.3', '625de9ec0d639acd18d1aaa644b38f72') depends_on("boost") #depends_on("extrae") diff --git a/var/spack/packages/stat/package.py b/var/spack/packages/stat/package.py index 956b0dcc8c..fbd1418d41 100644 --- a/var/spack/packages/stat/package.py +++ b/var/spack/packages/stat/package.py @@ -5,8 +5,8 @@ class Stat(Package): homepage = "http://paradyn.org/STAT/STAT.html" url = "https://github.com/lee218llnl/stat/archive/v2.0.0.tar.gz" - version('2.0.0', 'c7494210b0ba26b577171b92838e1a9b') version('2.1.0', 'ece26beaf057aa9134d62adcdda1ba91') + version('2.0.0', 'c7494210b0ba26b577171b92838e1a9b') depends_on('libdwarf') depends_on('dyninst') -- cgit v1.2.3-70-g09d2 From e4c2891d4ba5cc57a39f24c68affec8ee1eeca2c Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 22 Oct 2014 00:49:16 -0700 Subject: Test for URL extrapolation. --- lib/spack/spack/package.py | 7 ++- lib/spack/spack/test/__init__.py | 3 +- lib/spack/spack/test/url_extrapolate.py | 90 ++++++++++++++++++++++++++++++ lib/spack/spack/test/url_parse.py | 7 ++- var/spack/mock_packages/dyninst/package.py | 11 ++-- 5 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 lib/spack/spack/test/url_extrapolate.py (limited to 'var') diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index e462562e85..f1a16fdea1 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -440,9 +440,10 @@ class Package(object): version_urls = self.version_urls() if version in version_urls: return version_urls[version] - else: - return url.substitute_version(self.nearest_url(version), - self.url_version(version)) + + # If we have no idea, try to substitute the version. + return url.substitute_version(self.nearest_url(version), + self.url_version(version)) @property diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py index be9ac5a560..aa986662bf 100644 --- a/lib/spack/spack/test/__init__.py +++ b/lib/spack/spack/test/__init__.py @@ -51,7 +51,8 @@ test_names = ['versions', 'git_fetch', 'svn_fetch', 'hg_fetch', - 'mirror'] + 'mirror', + 'url_extrapolate'] def list_tests(): diff --git a/lib/spack/spack/test/url_extrapolate.py b/lib/spack/spack/test/url_extrapolate.py new file mode 100644 index 0000000000..514d119deb --- /dev/null +++ b/lib/spack/spack/test/url_extrapolate.py @@ -0,0 +1,90 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +"""\ +Tests ability of spack to extrapolate URL versions from existing versions. +""" +import spack +import spack.url as url +from spack.spec import Spec +from spack.version import ver +from spack.test.mock_packages_test import * + + +class UrlExtrapolateTest(MockPackagesTest): + + def test_known_version(self): + d = spack.db.get('dyninst') + + self.assertEqual( + d.url_for_version('8.2'), 'http://www.paradyn.org/release8.2/DyninstAPI-8.2.tgz') + self.assertEqual( + d.url_for_version('8.1.2'), 'http://www.paradyn.org/release8.1.2/DyninstAPI-8.1.2.tgz') + self.assertEqual( + d.url_for_version('8.1.1'), 'http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz') + + + def test_extrapolate_version(self): + d = spack.db.get('dyninst') + + # Nearest URL for 8.1.1.5 is 8.1.1, and the URL there is + # release8.1/DyninstAPI-8.1.1.tgz. Only the last part matches + # the version, so only extrapolate the last part. Obviously + # dyninst has ambiguous URL versions, but we want to make sure + # extrapolation works in a well-defined way. + self.assertEqual( + d.url_for_version('8.1.1.5'), 'http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.5.tgz') + + # 8.2 matches both the release8.2 component and the DyninstAPI-8.2 component. + # Extrapolation should replace both with the new version. + self.assertEqual( + d.url_for_version('8.2.3'), 'http://www.paradyn.org/release8.2.3/DyninstAPI-8.2.3.tgz') + + + def test_with_package(self): + d = spack.db.get('dyninst@8.2') + self.assertEqual(d.fetcher.url, 'http://www.paradyn.org/release8.2/DyninstAPI-8.2.tgz') + + d = spack.db.get('dyninst@8.1.2') + self.assertEqual(d.fetcher.url, 'http://www.paradyn.org/release8.1.2/DyninstAPI-8.1.2.tgz') + + d = spack.db.get('dyninst@8.1.1') + self.assertEqual(d.fetcher.url, 'http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz') + + + def test_concrete_package(self): + s = Spec('dyninst@8.2') + s.concretize() + d = spack.db.get(s) + self.assertEqual(d.fetcher.url, 'http://www.paradyn.org/release8.2/DyninstAPI-8.2.tgz') + + s = Spec('dyninst@8.1.2') + s.concretize() + d = spack.db.get(s) + self.assertEqual(d.fetcher.url, 'http://www.paradyn.org/release8.1.2/DyninstAPI-8.1.2.tgz') + + s = Spec('dyninst@8.1.1') + s.concretize() + d = spack.db.get(s) + self.assertEqual(d.fetcher.url, 'http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz') diff --git a/lib/spack/spack/test/url_parse.py b/lib/spack/spack/test/url_parse.py index a03d6098f1..7a4d201d90 100644 --- a/lib/spack/spack/test/url_parse.py +++ b/lib/spack/spack/test/url_parse.py @@ -281,11 +281,16 @@ class UrlParseTest(unittest.TestCase): 'synergy', '1.3.6p2', 'http://synergy.googlecode.com/files/synergy-1.3.6p2-MacOSX-Universal.zip') - def test_mvapich2_version(self): + def test_mvapich2_19_version(self): self.check( 'mvapich2', '1.9', 'http://mvapich.cse.ohio-state.edu/download/mvapich2/mv2/mvapich2-1.9.tgz') + def test_mvapich2_19_version(self): + self.check( + 'mvapich2', '2.0', + 'http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.0.tar.gz') + def test_hdf5_version(self): self.check( 'hdf5', '1.8.13', diff --git a/var/spack/mock_packages/dyninst/package.py b/var/spack/mock_packages/dyninst/package.py index 7657e2c33f..7998578da1 100644 --- a/var/spack/mock_packages/dyninst/package.py +++ b/var/spack/mock_packages/dyninst/package.py @@ -26,11 +26,14 @@ from spack import * class Dyninst(Package): homepage = "https://paradyn.org" - url = "http://www.dyninst.org/sites/default/files/downloads/dyninst/8.1.2/DyninstAPI-8.1.2.tgz" - list_url = "http://www.dyninst.org/downloads/dyninst-8.x" + url = "http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz" - version('8.1.2', 'bf03b33375afa66fe0efa46ce3f4b17a') - version('8.1.1', '1f8743e3a5662b25ce64a7edf647e77d') + version('8.2', 'cxyzab', + url='http://www.paradyn.org/release8.2/DyninstAPI-8.2.tgz') + version('8.1.2', 'bcxyza', + url='http://www.paradyn.org/release8.1.2/DyninstAPI-8.1.2.tgz') + version('8.1.1', 'abcxyz', + url='http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz') depends_on("libelf") depends_on("libdwarf") -- cgit v1.2.3-70-g09d2 From c08985f7d1e9d8e7c0f05629033c72ef3ffe1a26 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 10 Oct 2014 15:02:46 -0700 Subject: Add bib2xhtml --- var/spack/packages/bib2xhtml/package.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 var/spack/packages/bib2xhtml/package.py (limited to 'var') diff --git a/var/spack/packages/bib2xhtml/package.py b/var/spack/packages/bib2xhtml/package.py new file mode 100644 index 0000000000..7f8e0cfe5a --- /dev/null +++ b/var/spack/packages/bib2xhtml/package.py @@ -0,0 +1,27 @@ +from spack import * +from glob import glob + +class Bib2xhtml(Package): + """bib2xhtml is a program that converts BibTeX files into HTML.""" + homepage = "http://www.spinellis.gr/sw/textproc/bib2xhtml/" + url='http://www.spinellis.gr/sw/textproc/bib2xhtml/bib2xhtml-v3.0-15-gf506.tar.gz' + + version('3.0-15-gf506', 'a26ba02fe0053bbbf2277bdf0acf8645') + + def url_for_version(self, v): + return ('http://www.spinellis.gr/sw/textproc/bib2xhtml/bib2xhtml-v%s.tar.gz' % v) + + def install(self, spec, prefix): + # Add the bst include files to the install directory + bst_include = join_path(prefix.share, 'bib2xhtml') + mkdirp(bst_include) + for bstfile in glob('html-*bst'): + install(bstfile, bst_include) + + # Install the script and point it at the user's favorite perl + # and the bst include directory. + mkdirp(prefix.bin) + install('bib2xhtml', prefix.bin) + filter_file(r'#!/usr/bin/perl', + '#!/usr/bin/env BSTINPUTS=%s perl' % bst_include, + join_path(prefix.bin, 'bib2xhtml')) -- cgit v1.2.3-70-g09d2 From ce1b30c2298ed3a335c18bd27d5f34621c3197cd Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 23 Oct 2014 21:08:13 -0700 Subject: Adding initial version of MPE2 package. --- var/spack/packages/mpe2/package.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 var/spack/packages/mpe2/package.py (limited to 'var') diff --git a/var/spack/packages/mpe2/package.py b/var/spack/packages/mpe2/package.py new file mode 100644 index 0000000000..f043ad6ba6 --- /dev/null +++ b/var/spack/packages/mpe2/package.py @@ -0,0 +1,24 @@ +from spack import * + +class Mpe2(Package): + """Message Passing Extensions (MPE) -- Parallel, shared X window graphics""" + + homepage = "http://www.mcs.anl.gov/research/projects/perfvis/software/MPE/" + url = "ftp://ftp.mcs.anl.gov/pub/mpi/mpe/mpe2-1.3.0.tar.gz" + + version('1.3.0', '67bf0c7b2e573df3ba0d2059a96c2f7b') + + depends_on("mpi") + + def install(self, spec, prefix): + configure("--prefix=" + prefix, + "--x-includes=/usr/X11R6/include", + "--x-libraries=/usr/X11R6/lib", + "--enable-mpe_graphics=yes", + "--disable-f77", + "--enable-viewers=no", + "--enable-slog2=no", + "--with-mpicc=mpicc") + + make() + make("install") -- cgit v1.2.3-70-g09d2 From 340b5590f17b1023f469c654f18eb6ee71c0db2b Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 25 Oct 2014 14:41:06 -0700 Subject: Add coreutils package. --- var/spack/packages/coreutils/package.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 var/spack/packages/coreutils/package.py (limited to 'var') diff --git a/var/spack/packages/coreutils/package.py b/var/spack/packages/coreutils/package.py new file mode 100644 index 0000000000..78c608d8eb --- /dev/null +++ b/var/spack/packages/coreutils/package.py @@ -0,0 +1,17 @@ +from spack import * + +class Coreutils(Package): + """The GNU Core Utilities are the basic file, shell and text + manipulation utilities of the GNU operating system. These are + the core utilities which are expected to exist on every + operating system. + """ + homepage = "http://www.gnu.org/software/coreutils/" + url = "http://ftp.gnu.org/gnu/coreutils/coreutils-8.23.tar.xz" + + version('8.23', 'abed135279f87ad6762ce57ff6d89c41') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + make() + make("install") -- cgit v1.2.3-70-g09d2 From 76ed5c212cdf41e44428ef723c3d7f5695efbcc8 Mon Sep 17 00:00:00 2001 From: Bob Robey Date: Sat, 25 Oct 2014 21:25:25 -0600 Subject: Adding autotools and ImageMagick and patch for mpe2 --- var/spack/packages/ImageMagick/package.py | 21 +++++++++++++++++++++ var/spack/packages/autoconf/package.py | 14 ++++++++++++++ var/spack/packages/automake/package.py | 16 ++++++++++++++++ var/spack/packages/cmake/package.py | 10 ++++++++-- var/spack/packages/fontconfig/package.py | 16 ++++++++++++++++ var/spack/packages/freetype/package.py | 16 ++++++++++++++++ var/spack/packages/jpeg/package.py | 14 ++++++++++++++ var/spack/packages/libpng/package.py | 14 ++++++++++++++ var/spack/packages/libtiff/package.py | 16 ++++++++++++++++ var/spack/packages/libtool/package.py | 14 ++++++++++++++ var/spack/packages/mpe2/mpe2.patch | 12 ++++++++++++ var/spack/packages/mpe2/package.py | 4 ++++ 12 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 var/spack/packages/ImageMagick/package.py create mode 100644 var/spack/packages/autoconf/package.py create mode 100644 var/spack/packages/automake/package.py create mode 100644 var/spack/packages/fontconfig/package.py create mode 100644 var/spack/packages/freetype/package.py create mode 100644 var/spack/packages/jpeg/package.py create mode 100644 var/spack/packages/libpng/package.py create mode 100644 var/spack/packages/libtiff/package.py create mode 100644 var/spack/packages/libtool/package.py create mode 100644 var/spack/packages/mpe2/mpe2.patch (limited to 'var') diff --git a/var/spack/packages/ImageMagick/package.py b/var/spack/packages/ImageMagick/package.py new file mode 100644 index 0000000000..fc1ee56bbd --- /dev/null +++ b/var/spack/packages/ImageMagick/package.py @@ -0,0 +1,21 @@ +from spack import * + +class Imagemagick(Package): + """ImageMagick is a image processing library""" + homepage = "http://www.imagemagic.org" + url = "http://www.imagemagick.org/download/ImageMagick-6.8.9-8.tar.gz" + + version('6.8.9-8', '74aa203286bfb8aaadd320f787eea64e') + + depends_on(libtool) + depends_on(jpeg) + depends_on(libpng) + depends_on(freetype) + depends_on(fontconfig) + depends_on(libtiff) + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/autoconf/package.py b/var/spack/packages/autoconf/package.py new file mode 100644 index 0000000000..5189faf054 --- /dev/null +++ b/var/spack/packages/autoconf/package.py @@ -0,0 +1,14 @@ +from spack import * + +class Autoconf(Package): + """Autoconf -- system configuration part of autotools""" + homepage = "https://www.gnu.org/software/autoconf/" + url = "http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz" + + version('2.69', '82d05e03b93e45f5a39b828dc9c6c29b') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/automake/package.py b/var/spack/packages/automake/package.py new file mode 100644 index 0000000000..73c01afdd6 --- /dev/null +++ b/var/spack/packages/automake/package.py @@ -0,0 +1,16 @@ +from spack import * + +class Automake(Package): + """Automake -- make file builder part of autotools""" + homepage = "http://www.gnu.org/software/automake/" + url = "http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz" + + version('1.14.1', 'd052a3e884631b9c7892f2efce542d75') + + depends_on(autoconf) + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/cmake/package.py b/var/spack/packages/cmake/package.py index 890af9baa9..9efa370c8b 100644 --- a/var/spack/packages/cmake/package.py +++ b/var/spack/packages/cmake/package.py @@ -28,9 +28,15 @@ class Cmake(Package): """A cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software.""" homepage = 'https://www.cmake.org' - url = 'http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz' - version('2.8.10.2', '097278785da7182ec0aea8769d06860c') + version('2.8.10.2', '097278785da7182ec0aea8769d06860c', + url = 'http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz') + + version('3.0.2', 'db4c687a31444a929d2fdc36c4dfb95f', + url = 'http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz') + +# version('3.0.1', 'e2e05d84cb44a42f1371d9995631dcf5') +# version('3.0.0', '21a1c85e1a3b803c4b48e7ff915a863e') def install(self, spec, prefix): configure('--prefix=' + prefix, diff --git a/var/spack/packages/fontconfig/package.py b/var/spack/packages/fontconfig/package.py new file mode 100644 index 0000000000..89b13604e8 --- /dev/null +++ b/var/spack/packages/fontconfig/package.py @@ -0,0 +1,16 @@ +from spack import * + +class Fontconfig(Package): + """Fontconfig customizing font access""" + homepage = "http://www.freedesktop.org/wiki/Software/fontconfig/" + url = "http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.1.tar.gz" + + version('2.11.1' , 'e75e303b4f7756c2b16203a57ac87eba') + + depends_on('freetype') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/freetype/package.py b/var/spack/packages/freetype/package.py new file mode 100644 index 0000000000..0309b858a1 --- /dev/null +++ b/var/spack/packages/freetype/package.py @@ -0,0 +1,16 @@ +from spack import * + +class Freetype(Package): + """Font package""" + homepage = "http://http://www.freetype.org" + url = "http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz" + + version('2.5.3' , 'cafe9f210e45360279c730d27bf071e9') + + depends_on('libpng') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/jpeg/package.py b/var/spack/packages/jpeg/package.py new file mode 100644 index 0000000000..b34fd5cb2d --- /dev/null +++ b/var/spack/packages/jpeg/package.py @@ -0,0 +1,14 @@ +from spack import * + +class Jpeg(Package): + """jpeg library""" + homepage = "http://www.ijg.org" + url = "http://www.ijg.org/files/jpegsrc.v9a.tar.gz" + + version('9', 'b397211ddfd506b92cd5e02a22ac924d') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/libpng/package.py b/var/spack/packages/libpng/package.py new file mode 100644 index 0000000000..a6d9bf0b46 --- /dev/null +++ b/var/spack/packages/libpng/package.py @@ -0,0 +1,14 @@ +from spack import * + +class Libpng(Package): + """libpng graphics file format""" + homepage = "http://www.libpng.org/pub/png/libpng.html" + url = "http://sourceforge.net/projects/libpng/files/libpng16/1.6.14/libpng-1.6.14.tar.gz/download" + + version('1.6.14', '2101b3de1d5f348925990f9aa8405660') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/libtiff/package.py b/var/spack/packages/libtiff/package.py new file mode 100644 index 0000000000..0de544ad92 --- /dev/null +++ b/var/spack/packages/libtiff/package.py @@ -0,0 +1,16 @@ +from spack import * + +class libtiff(Package): + """libtiff graphics format library""" + homepage = "http://www.remotesensing.org/libtiff/" + url = "http://download.osgeo.org/libtiff/tiff-4.0.3.tar.gz" + + version('4.0.3', '051c1068e6a0627f461948c365290410') + + depends_on('jpeg') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/libtool/package.py b/var/spack/packages/libtool/package.py new file mode 100644 index 0000000000..a07daf9781 --- /dev/null +++ b/var/spack/packages/libtool/package.py @@ -0,0 +1,14 @@ +from spack import * + +class Libtool(Package): + """libtool -- library building part of autotools""" + homepage = "https://www.gnu.org/software/libtool/" + url = "http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz" + + version('2.4.2' , 'd2f3b7d4627e69e13514a40e72a24d50') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + + make() + make("install") diff --git a/var/spack/packages/mpe2/mpe2.patch b/var/spack/packages/mpe2/mpe2.patch new file mode 100644 index 0000000000..3ade1f04f4 --- /dev/null +++ b/var/spack/packages/mpe2/mpe2.patch @@ -0,0 +1,12 @@ +diff -rupN mpe2-1.3.0/src/graphics/src/mpe_graphics.c mpe2-1.3.0.new/src/graphics/src/mpe_graphics.c +--- mpe2-1.3.0/src/graphics/src/mpe_graphics.c 2009-06-15 10:36:22.000000000 -0600 ++++ mpe2-1.3.0.new/src/graphics/src/mpe_graphics.c 2014-10-25 00:11:22.000000000 -0600 +@@ -982,7 +982,7 @@ char *string; + return MPE_ERR_BAD_ARGS; + } + +- printf("color = %d, string = %s\n",(int) color, string); ++//printf("color = %d, string = %s\n",(int) color, string); + + XBSetPixVal( graph->xwin, graph->xwin->cmapping[color] ); + returnVal = XDrawString( graph->xwin->disp, XBDrawable(graph->xwin), diff --git a/var/spack/packages/mpe2/package.py b/var/spack/packages/mpe2/package.py index f043ad6ba6..27295172cc 100644 --- a/var/spack/packages/mpe2/package.py +++ b/var/spack/packages/mpe2/package.py @@ -8,8 +8,12 @@ class Mpe2(Package): version('1.3.0', '67bf0c7b2e573df3ba0d2059a96c2f7b') + patch('mpe2.patch') + depends_on("mpi") + provides("mpe") + def install(self, spec, prefix): configure("--prefix=" + prefix, "--x-includes=/usr/X11R6/include", -- cgit v1.2.3-70-g09d2 From f9149b6cb63416af2f952c71db8750450f30cbc1 Mon Sep 17 00:00:00 2001 From: Bob Robey Date: Sat, 25 Oct 2014 21:59:01 -0600 Subject: Fixing errors in depends_on and updating version for ImageMagick --- var/spack/packages/ImageMagick/package.py | 16 ++++++++-------- var/spack/packages/automake/package.py | 2 +- var/spack/packages/libtiff/package.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'var') diff --git a/var/spack/packages/ImageMagick/package.py b/var/spack/packages/ImageMagick/package.py index fc1ee56bbd..39c733e0df 100644 --- a/var/spack/packages/ImageMagick/package.py +++ b/var/spack/packages/ImageMagick/package.py @@ -3,16 +3,16 @@ from spack import * class Imagemagick(Package): """ImageMagick is a image processing library""" homepage = "http://www.imagemagic.org" - url = "http://www.imagemagick.org/download/ImageMagick-6.8.9-8.tar.gz" + url = "http://www.imagemagick.org/download/ImageMagick-6.8.9-9.tar.gz" - version('6.8.9-8', '74aa203286bfb8aaadd320f787eea64e') + version('6.8.9-9', 'e63fed3e3550851328352c708f800676') - depends_on(libtool) - depends_on(jpeg) - depends_on(libpng) - depends_on(freetype) - depends_on(fontconfig) - depends_on(libtiff) + depends_on('libtool') + depends_on('jpeg') + depends_on('libpng') + depends_on('freetype') + depends_on('fontconfig') +# depends_on('libtiff') def install(self, spec, prefix): configure("--prefix=%s" % prefix) diff --git a/var/spack/packages/automake/package.py b/var/spack/packages/automake/package.py index 73c01afdd6..9115822730 100644 --- a/var/spack/packages/automake/package.py +++ b/var/spack/packages/automake/package.py @@ -7,7 +7,7 @@ class Automake(Package): version('1.14.1', 'd052a3e884631b9c7892f2efce542d75') - depends_on(autoconf) + depends_on('autoconf') def install(self, spec, prefix): configure("--prefix=%s" % prefix) diff --git a/var/spack/packages/libtiff/package.py b/var/spack/packages/libtiff/package.py index 0de544ad92..ec54cf7adf 100644 --- a/var/spack/packages/libtiff/package.py +++ b/var/spack/packages/libtiff/package.py @@ -1,6 +1,6 @@ from spack import * -class libtiff(Package): +class Libtiff(Package): """libtiff graphics format library""" homepage = "http://www.remotesensing.org/libtiff/" url = "http://download.osgeo.org/libtiff/tiff-4.0.3.tar.gz" -- cgit v1.2.3-70-g09d2 From 1c4948e1b0cbcaa6d367152e21c6df7d53ebb945 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 27 Oct 2014 20:02:24 -0700 Subject: Fix long-standing multimethod test error. - New inclusive version ranges from git-fetching branch enable a fix. - Can now write :1 to include 1.3, 1.4, etc. - couldn't do this before so provides() was weird. --- lib/spack/spack/test/multimethod.py | 8 ++++---- var/spack/mock_packages/mpich/package.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'var') diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py index d773113426..cd5d9e625e 100644 --- a/lib/spack/spack/test/multimethod.py +++ b/lib/spack/spack/test/multimethod.py @@ -73,11 +73,11 @@ class MultiMethodTest(MockPackagesTest): def test_undefined_mpi_version(self): - # This currently fails because provides() doesn't do - # the right thing undefined version ranges. - # TODO: fix this. pkg = spack.db.get('multimethod^mpich@0.4') - self.assertEqual(pkg.mpi_version(), 0) + self.assertEqual(pkg.mpi_version(), 1) + + pkg = spack.db.get('multimethod^mpich@1.4') + self.assertEqual(pkg.mpi_version(), 1) def test_default_works(self): diff --git a/var/spack/mock_packages/mpich/package.py b/var/spack/mock_packages/mpich/package.py index e86c1a68ac..75a939a892 100644 --- a/var/spack/mock_packages/mpich/package.py +++ b/var/spack/mock_packages/mpich/package.py @@ -37,7 +37,7 @@ class Mpich(Package): version('3.0', 'foobarbaz') provides('mpi@:3', when='@3:') - provides('mpi@:1', when='@1:') + provides('mpi@:1', when='@:1') def install(self, spec, prefix): pass -- cgit v1.2.3-70-g09d2