Skip to content

Commit 9a4bccf

Browse files
committed
move fetch_binary actions out of install method
1 parent 8830cfc commit 9a4bccf

File tree

2 files changed

+20
-39
lines changed

2 files changed

+20
-39
lines changed

lib/spack/spack/cmd/install.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
from spack.package import PackageBase
4242

4343
description = "build and install packages"
44+
section = "build"
45+
level = "short"
4446

4547

4648
def setup_parser(subparser):
@@ -96,11 +98,6 @@ def setup_parser(subparser):
9698
default=None,
9799
help="filename for the log file. if not passed a default will be used"
98100
)
99-
subparser.add_argument(
100-
'-fb', '--fetch-binary', action='store', dest="fetch_binary",
101-
default="never", choices=["never", "always", "lazy"],
102-
help="Build from source, download binaries, " +
103-
"or build if binary not available.")
104101

105102

106103
# Needed for test cases
@@ -315,7 +312,6 @@ def install(parser, args, **kwargs):
315312
'run_tests': args.run_tests,
316313
'verbose': args.verbose,
317314
'fake': args.fake,
318-
'fetch_binary': args.fetch_binary,
319315
'dirty': args.dirty
320316
})
321317

lib/spack/spack/package.py

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
import spack.store
5252
import spack.compilers
5353
import spack.directives
54-
import spack.binary_distribution
55-
import spack.relocate
5654
import spack.error
5755
import spack.fetch_strategy as fs
5856
import spack.hooks
@@ -66,6 +64,7 @@
6664
from llnl.util.link_tree import LinkTree
6765
from llnl.util.tty.log import log_output
6866
from spack import directory_layout
67+
from spack.util.executable import which
6968
from spack.stage import Stage, ResourceStage, StageComposite
7069
from spack.util.environment import dump_environment
7170
from spack.version import *
@@ -1027,17 +1026,27 @@ def namespace(self):
10271026
return namespace
10281027

10291028
def do_fake_install(self):
1030-
"""Make a fake install directory containing a 'fake' file in bin."""
1031-
# FIXME : Make this part of the 'install' behavior ?
1029+
"""Make a fake install directory containing fake executables,
1030+
headers, and libraries."""
1031+
1032+
name = self.name
1033+
library_name = 'lib' + self.name
1034+
dso_suffix = '.dylib' if sys.platform == 'darwin' else '.so'
1035+
chmod = which('chmod')
1036+
10321037
mkdirp(self.prefix.bin)
1033-
touch(join_path(self.prefix.bin, 'fake'))
1038+
touch(join_path(self.prefix.bin, name))
1039+
chmod('+x', join_path(self.prefix.bin, name))
1040+
10341041
mkdirp(self.prefix.include)
1042+
touch(join_path(self.prefix.include, name + '.h'))
1043+
10351044
mkdirp(self.prefix.lib)
1036-
library_name = 'lib' + self.name
1037-
dso_suffix = 'dylib' if sys.platform == 'darwin' else 'so'
10381045
touch(join_path(self.prefix.lib, library_name + dso_suffix))
10391046
touch(join_path(self.prefix.lib, library_name + '.a'))
1047+
10401048
mkdirp(self.prefix.man1)
1049+
10411050
packages_dir = spack.store.layout.build_packages_path(self.spec)
10421051
dump_packages(self.spec, packages_dir)
10431052

@@ -1169,9 +1178,6 @@ def do_install(self,
11691178
if package was implicitly installed (as a dependency).
11701179
dirty (bool): Don't clean the build environment before installing.
11711180
force (bool): Install again, even if already installed.
1172-
fetch_binary (bool) : Whether to download a pre-compiled package
1173-
or build from scratch
1174-
11751181
"""
11761182
if not self.spec.concrete:
11771183
raise ValueError("Can only install concrete packages: %s."
@@ -1201,9 +1207,6 @@ def do_install(self,
12011207

12021208
self._do_install_pop_kwargs(kwargs)
12031209

1204-
tty.msg("Installing %s" % self.name)
1205-
1206-
fetch_binary = kwargs.pop('fetch_binary', 'never')
12071210
# First, install dependencies recursively.
12081211
if install_deps:
12091212
tty.debug('Installing {0} dependencies'.format(self.name))
@@ -1215,7 +1218,6 @@ def do_install(self,
12151218
fake=fake,
12161219
skip_patch=skip_patch,
12171220
verbose=verbose,
1218-
fetch_binary=fetch_binary,
12191221
make_jobs=make_jobs,
12201222
run_tests=run_tests,
12211223
dirty=dirty,
@@ -1227,20 +1229,6 @@ def do_install(self,
12271229
# Set run_tests flag before starting build.
12281230
self.run_tests = run_tests
12291231

1230-
# check and prepare binary install option
1231-
install_binary = False
1232-
binary_distribution = spack.binary_distribution
1233-
if fetch_binary in ("always", "lazy"):
1234-
tarball_available = binary_distribution.download_tarball(self)
1235-
if tarball_available:
1236-
install_binary = True
1237-
binary_distribution.prepare()
1238-
elif fetch_binary == "always":
1239-
tty.die("Download of binary package for %s failed."
1240-
% self.name)
1241-
else:
1242-
tty.warn("No binary package for %s found."
1243-
% self.name)
12441232
# Set parallelism before starting build.
12451233
self.make_jobs = make_jobs
12461234

@@ -1263,7 +1251,7 @@ def build_process(input_stream):
12631251
sys.stdin = input_stream
12641252

12651253
start_time = time.time()
1266-
if not fake and not install_binary:
1254+
if not fake:
12671255
if not skip_patch:
12681256
self.do_patch()
12691257
else:
@@ -1278,11 +1266,8 @@ def build_process(input_stream):
12781266
# Run the pre-install hook in the child process after
12791267
# the directory is created.
12801268
spack.hooks.pre_install(self.spec)
1281-
if fake or install_binary:
1269+
if fake:
12821270
self.do_fake_install()
1283-
if install_binary:
1284-
spack.binary_distribution.extract_tarball(self)
1285-
spack.binary_distribution.relocate_package(self)
12861271
else:
12871272
# Do the real install in the source directory.
12881273
self.stage.chdir_to_source()

0 commit comments

Comments
 (0)