diff --git a/bits_helpers/build.py b/bits_helpers/build.py index acb886d..93f2358 100644 --- a/bits_helpers/build.py +++ b/bits_helpers/build.py @@ -1073,7 +1073,7 @@ def _pkg_install_path(workDir, architecture, spec): *architecture* should already be the *effective* architecture for *spec* (i.e. the result of ``effective_arch(spec, build_arch)``). Callers are responsible for that substitution so that shared packages (``architecture: - shared``) install under ``sw/shared/…`` rather than the build platform. + share``) install under ``sw/share/…`` rather than the build platform. When ``spec["pkg_family"]`` is also set the family directory is inserted between the architecture and the package name. When it is empty the legacy @@ -1131,11 +1131,11 @@ def _arch_prefix_expr(dep_spec): Arch-specific packages use the runtime variable ``$BITS_ARCH_PREFIX`` so that the same init.sh works when relocated (e.g. off CVMFS). - Shared packages (``architecture: shared``) always live under the literal - directory ``shared/``, so we embed that string directly. + Shared packages (``architecture: share``) always live under the literal + directory ``share/``, so we embed that string directly. """ if dep_spec.get("architecture") == SHARED_ARCH: - return '"$WORK_DIR/shared"' + return f'"$WORK_DIR/{SHARED_ARCH}"' return '"$WORK_DIR/$BITS_ARCH_PREFIX"' def _dep_init_path(dep): @@ -3390,7 +3390,7 @@ def _build_row(pkg): effective_architecture=effective_arch(spec, args.architecture)) continue - # Warn if a package declares architecture: shared but has arch-specific + # Warn if a package declares architecture: share but has arch-specific # deps — the shared label would be misleading in that case because its # hash (and therefore install path) will differ across platforms. if spec.get("architecture") == SHARED_ARCH: @@ -3400,7 +3400,7 @@ def _build_row(pkg): ] if arch_specific_deps: warning( - "Package %s declares 'architecture: shared' but depends on " + "Package %s declares 'architecture: share' but depends on " "arch-specific package(s): %s. Its hash may differ across platforms.", spec["package"], ", ".join(arch_specific_deps), ) diff --git a/bits_helpers/utilities.py b/bits_helpers/utilities.py index 40e5d68..9d9e694 100644 --- a/bits_helpers/utilities.py +++ b/bits_helpers/utilities.py @@ -101,14 +101,14 @@ def topological_sort(specs): assert False, "Unreachable error: cycle detection failed" -SHARED_ARCH = "shared" +SHARED_ARCH = "share" """Sentinel value used in all paths for architecture-independent packages. -When a recipe sets ``architecture: shared``, bits substitutes this string for +When a recipe sets ``architecture: share``, bits substitutes this string for the real build architecture in every path component (install dir, tarball name, TARS store, SPECS dir, ``$PKGPATH``). The result is that the package is -installed under ``sw/shared//-/`` and its tarball is -stored under ``TARS/shared/store/…``, making it reusable by any architecture +installed under ``sw/share//-/`` and its tarball is +stored under ``TARS/share/store/…``, making it reusable by any architecture without rebuilding. Recipes that do **not** define ``architecture: shared`` are completely unaffected @@ -173,8 +173,8 @@ def docker_platform_for_arch(bits_arch: str): def effective_arch(spec: dict, build_arch: str) -> str: """Return the architecture string to use in paths and tarball names. - If the recipe declares ``architecture: shared`` the function returns - :data:`SHARED_ARCH` (``"shared"``), so that the package is installed in a + If the recipe declares ``architecture: share`` the function returns + :data:`SHARED_ARCH` (``"share"``), so that the package is installed in a location that every build platform can read. For all other recipes (including those that omit the field entirely) the diff --git a/tests/test_build.py b/tests/test_build.py index 38e2010..b7d4a88 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -623,8 +623,8 @@ def test_initdotsh_from_modules(self) -> None: self.assertNotIn("ROOT_INCLUDE_DIR", setup_on) def test_initdotsh_from_modules_shared_dependency(self) -> None: - """A shared (architecture: shared) dependency must be sourced from the - literal `$WORK_DIR/shared` tree, never `$BITS_ARCH_PREFIX`, including in + """A shared (architecture: share) dependency must be sourced from the + literal `$WORK_DIR/share` tree, never `$BITS_ARCH_PREFIX`, including in --initdotsh-from-modules mode; and a shared package's own _ROOT (and the from-modules INCLUDE_DIR keyed off it) must use that same literal tree.""" base = {"revision": "1", "hash": "h", "commit_hash": "c"} @@ -632,14 +632,14 @@ def test_initdotsh_from_modules_shared_dependency(self) -> None: "App": dict(base, package="App", version="1.0", requires=["libshared", "libarch"]), "libshared": dict(base, package="libshared", version="2.3", - architecture="shared", requires=[]), + architecture="share", requires=[]), "libarch": dict(base, package="libarch", version="4.5", requires=[]), } out = generate_initdotsh("App", specs, "slc7_x86-64", post_build=True, from_modules=True) - # Shared dep: literal `shared/` tree, NOT the relocatable arch variable. - self.assertIn('. "$WORK_DIR/shared"/libshared/2.3-1/etc/profile.d/init.sh', out) + # Shared dep: literal `share/` tree, NOT the relocatable arch variable. + self.assertIn('. "$WORK_DIR/share"/libshared/2.3-1/etc/profile.d/init.sh', out) self.assertNotIn('$BITS_ARCH_PREFIX"/libshared', out) # Arch-specific dep: still the relocatable arch variable, as before. self.assertIn('. "$WORK_DIR/$BITS_ARCH_PREFIX"/libarch/4.5-1/etc/profile.d/init.sh', out) @@ -648,7 +648,7 @@ def test_initdotsh_from_modules_shared_dependency(self) -> None: # it, use the literal tree — never $BITS_ARCH_PREFIX. shared = generate_initdotsh("libshared", specs, "slc7_x86-64", post_build=True, from_modules=True) - self.assertIn('export LIBSHARED_ROOT="$WORK_DIR/shared"/libshared/2.3-1', shared) + self.assertIn('export LIBSHARED_ROOT="$WORK_DIR/share"/libshared/2.3-1', shared) self.assertIn('export LIBSHARED_INCLUDE_DIR="${LIBSHARED_ROOT}/include"', shared) self.assertNotIn('$BITS_ARCH_PREFIX"/libshared', shared) diff --git a/tests/test_qualify_arch.py b/tests/test_qualify_arch.py index 8bfd307..2722247 100644 --- a/tests/test_qualify_arch.py +++ b/tests/test_qualify_arch.py @@ -345,7 +345,7 @@ def test_shared_pkg_path_unaffected(self): spec = _spec("SharedPkg", architecture=SHARED_ARCH) eff = effective_arch(spec, combined) path = _pkg_install_path("/sw", eff, spec) - self.assertIn("shared", path) + self.assertIn("share", path) self.assertNotIn("dev", path) diff --git a/tests/test_reconstruct_layout.py b/tests/test_reconstruct_layout.py index 747105a..03894f9 100644 --- a/tests/test_reconstruct_layout.py +++ b/tests/test_reconstruct_layout.py @@ -82,15 +82,16 @@ def test_matches_createDistLinks_exactly(self): self.assertEqual(a, b, repo) def test_shared_noarch_uses_shared_arch(self): - # A package with architecture: shared installs under TARS/shared/… + # A package with architecture: share installs under TARS/share/… from bits_helpers.utilities import SHARED_ARCH specs = _specs() specs["fftw"]["architecture"] = SHARED_ARCH + tarball = "fftw-3.3.10-2.%s.tar.gz" % SHARED_ARCH with tempfile.TemporaryDirectory() as d: create_version_link(specs["fftw"], self.ARCH, d) - tgt = _readlink(d, "TARS", SHARED_ARCH, "fftw", "fftw-3.3.10-2.shared.tar.gz") + tgt = _readlink(d, "TARS", SHARED_ARCH, "fftw", tarball) self.assertEqual( - tgt, "../../shared/store/bb/bb22" + "0" * 36 + "/fftw-3.3.10-2.shared.tar.gz") + tgt, "../../%s/store/bb/bb22%s/%s" % (SHARED_ARCH, "0" * 36, tarball)) def test_dropped_revision_omits_suffix(self): # force_revision="" (empty) drops the -rev suffix everywhere (ver_rev). diff --git a/tests/test_shared_arch.py b/tests/test_shared_arch.py index 1a328c4..6c91042 100644 --- a/tests/test_shared_arch.py +++ b/tests/test_shared_arch.py @@ -62,7 +62,7 @@ def test_other_architecture_field_is_ignored(self): self.assertEqual(effective_arch(spec, BUILD_ARCH), BUILD_ARCH) def test_shared_sentinel_is_string_shared(self): - self.assertEqual(SHARED_ARCH, "shared") + self.assertEqual(SHARED_ARCH, "share") def test_empty_build_arch_forwarded(self): spec = _spec("mypkg") @@ -76,7 +76,7 @@ def test_different_build_archs_forwarded(self): def test_shared_overrides_any_build_arch(self): spec = _spec("mypkg", architecture=SHARED_ARCH) for build_arch in ("osx_x86-64", "slc7_x86-64", "ubuntu2004_x86-64"): - self.assertEqual(effective_arch(spec, build_arch), "shared") + self.assertEqual(effective_arch(spec, build_arch), "share") # --------------------------------------------------------------------------- @@ -90,14 +90,14 @@ def test_shared_no_family(self): architecture=SHARED_ARCH) arch = effective_arch(spec, BUILD_ARCH) path = _pkg_install_path("sw", arch, spec) - self.assertEqual(path, "sw/shared/mydata/1.0-1") + self.assertEqual(path, "sw/share/mydata/1.0-1") def test_shared_with_family(self): spec = _spec("mydata", version="2.3", revision="5", architecture=SHARED_ARCH, pkg_family="datasets") arch = effective_arch(spec, BUILD_ARCH) path = _pkg_install_path("sw", arch, spec) - self.assertEqual(path, "sw/shared/datasets/mydata/2.3-5") + self.assertEqual(path, "sw/share/datasets/mydata/2.3-5") def test_normal_spec_uses_build_arch(self): spec = _spec("mylib", version="3.1", revision="2") @@ -116,7 +116,7 @@ def test_shared_workdir_prefix_respected(self): architecture=SHARED_ARCH) arch = effective_arch(spec, BUILD_ARCH) path = _pkg_install_path("/home/user/sw", arch, spec) - self.assertEqual(path, "/home/user/sw/shared/mydata/1.0-1") + self.assertEqual(path, "/home/user/sw/share/mydata/1.0-1") # --------------------------------------------------------------------------- @@ -138,8 +138,8 @@ def test_shared_dep_uses_literal_shared_prefix(self): specs = self._make_specs(dep_architecture=SHARED_ARCH) initsh = generate_initdotsh("myapp", specs, BUILD_ARCH, workDir="sw", post_build=False) - # The shared dep's init.sh should use the literal "$WORK_DIR/shared" - self.assertIn('"$WORK_DIR/shared"', initsh) + # The shared dep's init.sh should use the literal "$WORK_DIR/share" + self.assertIn('"$WORK_DIR/share"', initsh) # And NOT use the runtime variable $BITS_ARCH_PREFIX self.assertNotIn('"$WORK_DIR/$BITS_ARCH_PREFIX"/sharedlib', initsh) @@ -148,7 +148,7 @@ def test_arch_dep_uses_arch_prefix_variable(self): initsh = generate_initdotsh("myapp", specs, BUILD_ARCH, workDir="sw", post_build=False) self.assertIn('"$WORK_DIR/$BITS_ARCH_PREFIX"', initsh) - self.assertNotIn('"$WORK_DIR/shared"', initsh) + self.assertNotIn('"$WORK_DIR/share"', initsh) def test_shared_dep_path_contains_package_name(self): specs = self._make_specs(dep_architecture=SHARED_ARCH) @@ -168,7 +168,7 @@ def test_post_build_shared_package_uses_literal_prefix(self): initsh = generate_initdotsh("mydata", specs, BUILD_ARCH, workDir="sw", post_build=True) # MYDATA_ROOT should point to the literal shared prefix (not the arch variable) - self.assertIn('export MYDATA_ROOT="$WORK_DIR/shared"/mydata/3.0-1', initsh) + self.assertIn('export MYDATA_ROOT="$WORK_DIR/share"/mydata/3.0-1', initsh) # Arch-specific deps (like defaults-release) still use the arch-prefix variable self.assertIn('"$WORK_DIR/$BITS_ARCH_PREFIX"', initsh) # But the self (shared) package's ROOT must NOT embed the arch-prefix variable @@ -199,7 +199,7 @@ def test_mixed_deps_each_use_correct_prefix(self): initsh = generate_initdotsh("myapp", specs, BUILD_ARCH, workDir="sw", post_build=False) self.assertIn('"$WORK_DIR/$BITS_ARCH_PREFIX"', initsh) - self.assertIn('"$WORK_DIR/shared"', initsh) + self.assertIn('"$WORK_DIR/share"', initsh) # ---------------------------------------------------------------------------