commit b62e07429bc900cd3b964834255d9282910bbc39
parent 76a1a1d891b081c6274883f9b6cb3e86d2658b78
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Mon, 5 Jan 2026 09:00:05 +0000
Bug 2001103 - Replace dependencies on TAR by python tarfile package in js/src/make-source-package.py r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D276458
Diffstat:
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/js/src/Makefile.in b/js/src/Makefile.in
@@ -17,7 +17,6 @@ ifneq (,$(TAR))
source-package:
DIST=$(DIST) \
- TAR=$(TAR) \
MOZJS_MAJOR_VERSION=$(MOZJS_MAJOR_VERSION) \
MOZJS_MINOR_VERSION=$(MOZJS_MINOR_VERSION) \
MOZJS_PATCH_VERSION=$(MOZJS_PATCH_VERSION) \
diff --git a/js/src/make-source-package.py b/js/src/make-source-package.py
@@ -10,6 +10,7 @@ import os
import shutil
import subprocess
import sys
+import tarfile
from pathlib import Path
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
@@ -57,9 +58,6 @@ def parse_version(topsrc_dir):
tmp_dir = Path("/tmp")
-tar = os.environ.get("TAR", find_command(["tar"]))
-assert_command("TAR", tar)
-
rsync = os.environ.get("RSYNC", find_command(["rsync"]))
assert_command("RSYNC", rsync)
@@ -84,12 +82,10 @@ version = "{}-{}.{}.{}".format(
target_dir = staging_dir / version
package_name = f"{version}.tar.xz"
package_file = dist_dir / package_name
-tar_opts = ["-Jcf"]
# Given there might be some external program that reads the following output,
# use raw `print`, instead of logging.
print("Environment:")
-print(f" TAR = {tar}")
print(f" RSYNC = {rsync}")
print(f" STAGING = {staging_dir}")
print(f" DIST = {dist_dir}")
@@ -430,10 +426,8 @@ def create_tar():
logging.info(f"Packaging source tarball at {package_file}...")
- subprocess.run(
- [str(tar)] + tar_opts + [str(package_file), "-C", str(staging_dir), version],
- check=True,
- )
+ with tarfile.open(str(package_file), "w:xz") as stream:
+ stream.add(staging_dir / version, version)
def build():