Skip to content
Snippets Groups Projects
Commit eb5efed4 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

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
parents 5a9ef130 e301d623
No related branches found
No related tags found
No related merge requests found
...@@ -22,20 +22,6 @@ ...@@ -22,20 +22,6 @@
# along with this program; if not, write to the Free Software Foundation, # along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 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 os
import tempfile import tempfile
from llnl.util.filesystem import * from llnl.util.filesystem import *
...@@ -140,11 +126,30 @@ ...@@ -140,11 +126,30 @@
# #
sys_type = None 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.package import Package
from spack.relations import *
from spack.multimethod import when
from spack.version import Version 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__
...@@ -22,8 +22,10 @@ ...@@ -22,8 +22,10 @@
# along with this program; if not, write to the Free Software Foundation, # along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import os
from external import argparse from external import argparse
import llnl.util.tty as tty
import spack import spack
import spack.cmd import spack.cmd
...@@ -33,18 +35,45 @@ def setup_parser(subparser): ...@@ -33,18 +35,45 @@ def setup_parser(subparser):
subparser.add_argument( subparser.add_argument(
'-n', '--no-checksum', action='store_true', dest='no_checksum', '-n', '--no-checksum', action='store_true', dest='no_checksum',
help="Do not check downloaded packages against 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( 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): def stage(parser, args):
if not args.packages: if not args.specs:
tty.die("stage requires at least one package argument") tty.die("stage requires at least one package argument")
if args.no_checksum: if args.no_checksum:
spack.do_checksum = False spack.do_checksum = False
specs = spack.cmd.parse_specs(args.packages, concretize=True) specs = spack.cmd.parse_specs(args.specs, concretize=True)
for spec in specs:
package = spack.db.get(spec) if args.print_dir:
package.do_stage() 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()
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
def post_install(pkg): def post_install(pkg):
dk = spack.modules.TclModule(pkg) dk = spack.modules.TclModule(pkg.spec)
dk.write() dk.write()
def post_uninstall(pkg): def post_uninstall(pkg):
dk = spack.modules.TclModule(pkg) dk = spack.modules.TclModule(pkg.spec)
dk.remove() dk.remove()
...@@ -45,6 +45,10 @@ set _sp_spec="" ...@@ -45,6 +45,10 @@ set _sp_spec=""
# Figure out what type of module we're running here. # Figure out what type of module we're running here.
set _sp_modtype = "" set _sp_modtype = ""
switch ($_sp_subcommand) switch ($_sp_subcommand)
case "cd":
shift _sp_args
cd `spack stage --print-build-dir $_sp_args`
breaksw
case use: case use:
case unuse: case unuse:
case load: case load:
......
...@@ -75,6 +75,10 @@ function spack { ...@@ -75,6 +75,10 @@ function spack {
# Filter out use and unuse. For any other commands, just run the # Filter out use and unuse. For any other commands, just run the
# command. # command.
case $_sp_subcommand in case $_sp_subcommand in
"cd")
cd $(spack stage --print-build-dir "$@")
return
;;
"use"|"unuse"|"load"|"unload") "use"|"unuse"|"load"|"unload")
# Shift any other args for use off before parsing spec. # Shift any other args for use off before parsing spec.
_sp_module_args="" _sp_module_args=""
...@@ -108,6 +112,7 @@ function spack { ...@@ -108,6 +112,7 @@ function spack {
;; ;;
*) *)
command spack $_sp_flags $_sp_subcommand $_sp_spec command spack $_sp_flags $_sp_subcommand $_sp_spec
;;
esac esac
} }
......
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")
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")
...@@ -12,7 +12,6 @@ class Tau(Package): ...@@ -12,7 +12,6 @@ class Tau(Package):
version('2.23.1', '6593b47ae1e7a838e632652f0426fe72') version('2.23.1', '6593b47ae1e7a838e632652f0426fe72')
def install(self, spec, prefix): def install(self, spec, prefix):
# TAU isn't happy with directories that have '@' in the path. Sigh. # TAU isn't happy with directories that have '@' in the path. Sigh.
change_sed_delimiter('@', ';', 'configure') change_sed_delimiter('@', ';', 'configure')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment