Commit 4e0c7dde authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1810014 - Move macOS SDK toolchain task to linux workers. r=firefox-build-system-reviewers,andi

parent 0a31b97e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# TODO: Eventually consolidate with mozpack.pkg module. This is kept separate
# for now because of the vast difference in API, and to avoid churn for the
# users of this module (docker images, macos SDK artifacts) when changes are
# necessary in mozpack.pkg
import bz2
import io
import lzma
+4 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ macosx64-sdk-11.3:
    description: "MacOSX11.3 SDK"
    treeherder:
        symbol: TM(sdk11.3)
    worker-type: b-linux-gcp
    run:
        script: pack-macos-sdk.sh
        arguments:
@@ -45,3 +46,6 @@ macosx64-sdk-11.3:
            - Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk
        toolchain-artifact: project/gecko/mac-sdk/MacOSX11.3.sdk.tar.zst
        toolchain-alias: macosx64-sdk
        resources:
            - python/mozbuild/mozpack/macpkg.py
            - taskcluster/scripts/misc/unpack-sdk.py
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ ADD https://github.com/marco-c/breakpad-mac-update-symbols/raw/21221733edfbcac49
RUN chmod +x /usr/local/bin/lipo

COPY topsrcdir/tools/crashreporter/system-symbols/mac /builds/worker/mac-update-symbols
# %include python/mozbuild/mozpack/macpkg.py
COPY topsrcdir/python/mozbuild/mozpack/macpkg.py /builds/worker/mac-update-symbols/mozpack/
WORKDIR /builds/worker/mac-update-symbols

RUN chown -R worker:worker /builds/worker
+2 −2
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ curl -OL $PKG
shasum -a 256 -c <<EOF
$SHA256  $(basename $PKG)
EOF
pkgutil --expand-full $(basename $PKG) pkg/
mv pkg/Payload/$SDK_DIR $(basename $SDK_DIR)
$GECKO_PATH/mach python $(dirname $0)/unpack-sdk.py $(basename $PKG) pkg/
mv pkg/$SDK_DIR $(basename $SDK_DIR)

$(dirname $0)/pack.sh $(basename $SDK_DIR)
+42 −0
Original line number Diff line number Diff line
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
import shutil
import stat
import sys

from mozpack.macpkg import Pbzx, uncpio, unxar


def unpkg(pkg_path, out_dir="."):
    with open(pkg_path, "rb") as pkg:
        for name, content in unxar(pkg):
            if name == "Payload":
                extract_payload(content, out_dir)


def extract_payload(fileobj, out_dir="."):
    for path, mode, content in uncpio(Pbzx(fileobj)):
        if not path:
            continue
        path = os.path.join(out_dir, path.decode())
        if stat.S_ISDIR(mode):
            os.makedirs(path, exist_ok=True)
        else:
            parent = os.path.dirname(path)
            if parent:
                os.makedirs(parent, exist_ok=True)

            if stat.S_ISLNK(mode):
                os.symlink(content.read(), path)
            elif stat.S_ISREG(mode):
                with open(path, "wb") as out:
                    shutil.copyfileobj(content, out)
            else:
                raise Exception(f"File mode {mode:o} is not supported")


if __name__ == "__main__":
    unpkg(*sys.argv[1:])
Loading