summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-08-21 22:59:39 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-08-21 22:59:39 -0700
commiteb5efed421783dddbc6ebfe4ee7a9a987dfda3a5 (patch)
tree384c9057f63cb4a9d49a57e94acb2ec9b3e22d30
parent5a9ef130ea51f02a486b18f7173b980f3a539440 (diff)
parente301d623329d3f484316643c6a50dc3df4806dab (diff)
downloadspack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.tar.gz
spack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.tar.bz2
spack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.tar.xz
spack-eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5.zip
Merge branch 'features/postgresql' into develop
- add spack cd command. - Fix bug in modules hook Conflicts: lib/spack/spack/cmd/stage.py lib/spack/spack/hooks/dotkit.py share/spack/setup-env.bash
-rw-r--r--lib/spack/spack/__init__.py41
-rw-r--r--lib/spack/spack/cmd/stage.py41
-rw-r--r--lib/spack/spack/hooks/tclmodule.py4
-rw-r--r--share/spack/csh/spack.csh4
-rwxr-xr-xshare/spack/setup-env.sh5
-rw-r--r--var/spack/packages/openssl/package.py26
-rw-r--r--var/spack/packages/postgresql/package.py20
-rw-r--r--var/spack/packages/tau/package.py1
8 files changed, 115 insertions, 27 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index ab8978cecf..bf91a885ca 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -22,20 +22,6 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
-
-#
-# When packages call 'from spack import *', this is what is brought in.
-#
-# Spack internal code calls 'import spack' and accesses other
-# variables (spack.db, paths, etc.) directly.
-#
-# TODO: maybe this should be separated out and should go in build_environment.py?
-# 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', 'when', 'provides', 'depends_on', 'version',
- 'patch', 'Version', 'working_dir', 'which', 'Executable',
- 'filter_file', 'change_sed_delimiter']
-
import os
import tempfile
from llnl.util.filesystem import *
@@ -140,11 +126,30 @@ do_checksum = True
#
sys_type = None
+
+#
+# When packages call 'from spack import *', this extra stuff is brought in.
+#
+# Spack internal code should call 'import spack' and accesses other
+# variables (spack.db, paths, etc.) directly.
#
-# Extra imports that should be generally usable from package.py files.
+# TODO: maybe this should be separated out and should go in build_environment.py?
+# 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.
#
-from llnl.util.filesystem import working_dir
+__all__ = ['Package', 'Version', 'when']
from spack.package import Package
-from spack.relations import *
-from spack.multimethod import when
from spack.version import Version
+from spack.multimethod import when
+
+import llnl.util.filesystem
+from llnl.util.filesystem import *
+__all__ += llnl.util.filesystem.__all__
+
+import spack.relations
+from spack.relations import *
+__all__ += spack.relations.__all__
+
+import spack.util.executable
+from spack.util.executable import *
+__all__ += spack.util.executable.__all__
diff --git a/lib/spack/spack/cmd/stage.py b/lib/spack/spack/cmd/stage.py
index 2673cdc266..5df0ffc2a5 100644
--- a/lib/spack/spack/cmd/stage.py
+++ b/lib/spack/spack/cmd/stage.py
@@ -22,8 +22,10 @@
# 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
from external import argparse
+import llnl.util.tty as tty
import spack
import spack.cmd
@@ -33,18 +35,45 @@ def setup_parser(subparser):
subparser.add_argument(
'-n', '--no-checksum', action='store_true', dest='no_checksum',
help="Do not check downloaded packages against checksum")
+
+ dir_parser = subparser.add_mutually_exclusive_group()
+ dir_parser.add_argument(
+ '-d', '--print-stage-dir', action='store_const', dest='print_dir',
+ const='print_stage', help="Prints out the stage directory for a spec.")
+ dir_parser.add_argument(
+ '-b', '--print-build-dir', action='store_const', dest='print_dir',
+ const='print_build', help="Prints out the expanded archive path for a spec.")
+
subparser.add_argument(
- 'packages', nargs=argparse.REMAINDER, help="specs of packages to stage")
+ 'specs', nargs=argparse.REMAINDER, help="specs of packages to stage")
def stage(parser, args):
- if not args.packages:
+ if not args.specs:
tty.die("stage requires at least one package argument")
if args.no_checksum:
spack.do_checksum = False
- specs = spack.cmd.parse_specs(args.packages, concretize=True)
- for spec in specs:
- package = spack.db.get(spec)
- package.do_stage()
+ specs = spack.cmd.parse_specs(args.specs, concretize=True)
+
+ if args.print_dir:
+ if len(specs) != 1:
+ tty.die("--print-stage-dir and --print-build-dir options only take one spec.")
+
+ spec = specs[0]
+ pkg = spack.db.get(spec)
+
+ if args.print_dir == 'print_stage':
+ print pkg.stage.path
+ elif args.print_dir == 'print_build':
+ if not os.listdir(pkg.stage.path):
+ tty.die("Stage directory is empty. Run this first:",
+ "spack stage " + " ".join(args.specs))
+ print pkg.stage.expanded_archive_path
+
+ else:
+ for spec in specs:
+ package = spack.db.get(spec)
+ package.do_stage()
+
diff --git a/lib/spack/spack/hooks/tclmodule.py b/lib/spack/spack/hooks/tclmodule.py
index d93da3177e..0b9fd5a67c 100644
--- a/lib/spack/spack/hooks/tclmodule.py
+++ b/lib/spack/spack/hooks/tclmodule.py
@@ -26,10 +26,10 @@ import spack.modules
def post_install(pkg):
- dk = spack.modules.TclModule(pkg)
+ dk = spack.modules.TclModule(pkg.spec)
dk.write()
def post_uninstall(pkg):
- dk = spack.modules.TclModule(pkg)
+ dk = spack.modules.TclModule(pkg.spec)
dk.remove()
diff --git a/share/spack/csh/spack.csh b/share/spack/csh/spack.csh
index 169e9878bf..6073673333 100644
--- a/share/spack/csh/spack.csh
+++ b/share/spack/csh/spack.csh
@@ -45,6 +45,10 @@ set _sp_spec=""
# Figure out what type of module we're running here.
set _sp_modtype = ""
switch ($_sp_subcommand)
+case "cd":
+ shift _sp_args
+ cd `spack stage --print-build-dir $_sp_args`
+ breaksw
case use:
case unuse:
case load:
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 0142e04817..9a6090a93b 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -75,6 +75,10 @@ function spack {
# Filter out use and unuse. For any other commands, just run the
# command.
case $_sp_subcommand in
+ "cd")
+ cd $(spack stage --print-build-dir "$@")
+ return
+ ;;
"use"|"unuse"|"load"|"unload")
# Shift any other args for use off before parsing spec.
_sp_module_args=""
@@ -108,6 +112,7 @@ function spack {
;;
*)
command spack $_sp_flags $_sp_subcommand $_sp_spec
+ ;;
esac
}
diff --git a/var/spack/packages/openssl/package.py b/var/spack/packages/openssl/package.py
new file mode 100644
index 0000000000..c5a8aeb9dc
--- /dev/null
+++ b/var/spack/packages/openssl/package.py
@@ -0,0 +1,26 @@
+from spack import *
+
+class Openssl(Package):
+ """The OpenSSL Project is a collaborative effort to develop a
+ robust, commercial-grade, full-featured, and Open Source
+ toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
+ Transport Layer Security (TLS v1) protocols as well as a
+ full-strength general purpose cryptography library."""
+ homepage = "http://www.openssl.org"
+ url = "http://www.openssl.org/source/openssl-1.0.1h.tar.gz"
+
+ version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
+
+ depends_on("zlib")
+ parallel = False
+
+ def install(self, spec, prefix):
+ config = Executable("./config")
+ config("--prefix=%s" % prefix,
+ "--openssldir=%s/etc/openssl" % prefix,
+ "zlib",
+ "no-krb5",
+ "shared")
+
+ make()
+ make("install")
diff --git a/var/spack/packages/postgresql/package.py b/var/spack/packages/postgresql/package.py
new file mode 100644
index 0000000000..46922b7b71
--- /dev/null
+++ b/var/spack/packages/postgresql/package.py
@@ -0,0 +1,20 @@
+from spack import *
+
+class Postgresql(Package):
+ """PostgreSQL is a powerful, open source object-relational
+ database system. It has more than 15 years of active
+ development and a proven architecture that has earned it a
+ strong reputation for reliability, data integrity, and
+ correctness."""
+ homepage = "http://www.postgresql.org/"
+ url = "http://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.bz2"
+
+ version('9.3.4', 'd0a41f54c377b2d2fab4a003b0dac762')
+
+ depends_on("openssl")
+
+ def install(self, spec, prefix):
+ configure("--prefix=%s" % prefix,
+ "--with-openssl")
+ make()
+ make("install")
diff --git a/var/spack/packages/tau/package.py b/var/spack/packages/tau/package.py
index 8d9dbe1759..048fac80aa 100644
--- a/var/spack/packages/tau/package.py
+++ b/var/spack/packages/tau/package.py
@@ -12,7 +12,6 @@ class Tau(Package):
version('2.23.1', '6593b47ae1e7a838e632652f0426fe72')
-
def install(self, spec, prefix):
# TAU isn't happy with directories that have '@' in the path. Sigh.
change_sed_delimiter('@', ';', 'configure')