diff --git a/docker/package/Dockerfile-ubuntu b/docker/package/Dockerfile-ubuntu index c22d4d223..82392be27 100644 --- a/docker/package/Dockerfile-ubuntu +++ b/docker/package/Dockerfile-ubuntu @@ -18,5 +18,6 @@ ENV OPAMROOT "/tezos-packaging/docker/opamroot" COPY docker/package/*.py /tezos-packaging/docker/package/ COPY docker/package/defaults /tezos-packaging/docker/package/defaults COPY docker/package/scripts /tezos-packaging/docker/package/scripts +COPY docker/package/patches /tezos-packaging/docker/package/patches COPY LICENSE /tezos-packaging/LICENSE ENTRYPOINT ["python3", "-m", "package.package_generator"] diff --git a/docker/package/model.py b/docker/package/model.py index 98e35982a..54cad5798 100644 --- a/docker/package/model.py +++ b/docker/package/model.py @@ -206,6 +206,7 @@ def __init__( postinst_steps: str = "", postrm_steps: str = "", additional_native_deps: List[str] = [], + patches: List[str] = [], ): self.name = name self.desc = desc @@ -216,6 +217,7 @@ def __init__( self.additional_native_deps = additional_native_deps self.meta = meta self.dune_filepath = dune_filepath + self.patches = patches def __get_os_specific_native_deps(self, os_name): return [ @@ -409,6 +411,7 @@ def __init__(self, meta: PackagesMeta, params_revision: str): self.targetProto = None self.meta = meta self.params_revision = params_revision + self.patches = [] def fetch_sources(self, out_dir, binaries_dir=None): os.makedirs(out_dir) @@ -563,6 +566,7 @@ def __init__( self.meta = deepcopy(meta) self.meta.version = self.meta.version + self.letter_version self.target_protos = set() + self.patches = [] for network in target_networks: for proto in network_protos[network]: self.target_protos.add(proto) diff --git a/docker/package/packages.py b/docker/package/packages.py index 9cf952d57..bf6725f6c 100644 --- a/docker/package/packages.py +++ b/docker/package/packages.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2021 Oxhead Alpha # SPDX-License-Identifier: LicenseRef-MIT-OA import os, json +from unittest.mock import patch from .meta import packages_meta @@ -132,12 +133,16 @@ additional_native_deps=["tezos-sapling-params", "udev"], postinst_steps=ledger_udev_postinst, dune_filepath="src/bin_client/main_client.exe", + # TODO: remove on the next upstream release + patches=["build-binary.sh.patch"], ), TezosBinaryPackage( "tezos-admin-client", "Administration tool for the node", meta=packages_meta, dune_filepath="src/bin_client/main_admin.exe", + # TODO: remove on the next upstream release + patches=["build-binary.sh.patch"], ), TezosBinaryPackage( "tezos-signer", @@ -147,12 +152,16 @@ systemd_units=signer_units, postinst_steps=ledger_udev_postinst, dune_filepath="src/bin_signer/main_signer.exe", + # TODO: remove on the next upstream release + patches=["build-binary.sh.patch"], ), TezosBinaryPackage( "tezos-codec", "A client to decode and encode JSON", meta=packages_meta, dune_filepath="src/bin_codec/codec.exe", + # TODO: remove on the next upstream release + patches=["build-binary.sh.patch"], ), ] @@ -256,6 +265,8 @@ def mk_node_unit( postrm_steps=node_postrm_steps, additional_native_deps=["tezos-sapling-params", {"ubuntu": "netbase"}], dune_filepath="src/bin_node/main.exe", + # TODO: remove on the next upstream release + patches=["build-binary.sh.patch"], ) ) @@ -385,6 +396,8 @@ def mk_node_unit( "udev", ], dune_filepath=f"src/proto_{proto_snake_case}/bin_baker/main_baker_{proto_snake_case}.exe", + # TODO: remove on the next upstream release + patches=["build-binary.sh.patch"], ) ) packages.append( @@ -410,6 +423,8 @@ def mk_node_unit( additional_native_deps=["udev"], postinst_steps=daemon_postinst_common + ledger_udev_postinst, dune_filepath=f"src/proto_{proto_snake_case}/bin_accuser/main_accuser_{proto_snake_case}.exe", + # TODO: remove on the next upstream release + patches=["build-binary.sh.patch"], ) ) diff --git a/docker/package/patches/build-binary.sh.patch b/docker/package/patches/build-binary.sh.patch new file mode 100644 index 000000000..c08ee33e5 --- /dev/null +++ b/docker/package/patches/build-binary.sh.patch @@ -0,0 +1,18 @@ +diff --color -Nru tezos-client-14.0-rc1.orig/build-binary.sh tezos-client-14.0-rc1/build-binary.sh +--- tezos-client-14.0-rc1.orig/build-binary.sh 2022-07-22 17:37:24.000000000 +0300 ++++ tezos-client-14.0-rc1/build-binary.sh 2022-07-27 12:01:58.842885979 +0300 +@@ -13,12 +13,12 @@ + + cd tezos + opam init local ../opam-repository --bare --disable-sandboxing +-opam switch create . --repositories=local ++opam switch create . --repositories=local --no-install + eval "$(opam env)" + opams=() + while IFS= read -r -d $'\0'; do + opams+=("$REPLY") +-done < <(find ./vendors ./src ./tezt -name \*.opam -print0) ++done < <(find ./vendors ./src ./tezt ./opam -name \*.opam -print0) + opam install "${opams[@]}" --deps-only --criteria="-notuptodate,-changed,-removed" + eval "$(opam env)" + dune build "$dune_filepath" diff --git a/docker/package/patches/build-binary.sh.patch.license b/docker/package/patches/build-binary.sh.patch.license new file mode 100644 index 000000000..d4114b601 --- /dev/null +++ b/docker/package/patches/build-binary.sh.patch.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2022 Oxhead Alpha +SPDX-License-Identifier: LicenseRef-MIT-OA diff --git a/docker/package/scripts/build-binary.sh b/docker/package/scripts/build-binary.sh index 080fc12d2..63cfa916c 100755 --- a/docker/package/scripts/build-binary.sh +++ b/docker/package/scripts/build-binary.sh @@ -13,12 +13,12 @@ binary_name="$2" cd tezos opam init local ../opam-repository --bare --disable-sandboxing -opam switch create . --repositories=local +opam switch create . --repositories=local --no-install eval "$(opam env)" opams=() while IFS= read -r -d $'\0'; do opams+=("$REPLY") -done < <(find ./vendors ./src ./tezt -name \*.opam -print0) +done < <(find ./vendors ./src ./tezt ./opam -name \*.opam -print0) opam install "${opams[@]}" --deps-only --criteria="-notuptodate,-changed,-removed" eval "$(opam env)" dune build "$dune_filepath" diff --git a/docker/package/ubuntu.py b/docker/package/ubuntu.py index 5cccc9791..bbef1d0e3 100644 --- a/docker/package/ubuntu.py +++ b/docker/package/ubuntu.py @@ -71,6 +71,17 @@ def build_ubuntu_package( ) source_path = f"{cwd}/scripts/{source_script_name}" shutil.copy(source_path, dest_path) + # Patches only make sense when we're reusing the old sources that are not static binary + if ( + len(pkg.patches) > 0 + and source_archive_path is not None + and binaries_dir is None + ): + os.makedirs("debian/patches") + with open("debian/patches/series", "w") as f: + for patch in pkg.patches: + shutil.copy(f"{cwd}/patches/{patch}", f"debian/patches/{patch}") + f.write(patch) with open("debian/compat", "w") as f: f.write("10") pkg.gen_install("debian/install") diff --git a/meta.json b/meta.json index c095a0c15..cb860142f 100644 --- a/meta.json +++ b/meta.json @@ -1,5 +1,5 @@ { - "release": "1", + "release": "2", "maintainer": "Serokell ", "tezos_ref": "refs/tags/v14.0-rc1" }