From 87947761ed81105de12b5c0a7e2c5ac249efdca3 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Mon, 12 Feb 2024 16:18:06 -0500 Subject: [PATCH] [CI:BUILD] Add VFKit into pkginstaller, remove QEMU Do not build and install QEMU in the pkginstaller. Instead, build, sign, and install VFKit. Signed-off-by: Ashley Cui --- contrib/pkginstaller/Makefile | 14 +++++------ contrib/pkginstaller/README.md | 4 +-- contrib/pkginstaller/package.sh | 31 ++---------------------- contrib/pkginstaller/scripts/postinstall | 3 --- 4 files changed, 10 insertions(+), 42 deletions(-) diff --git a/contrib/pkginstaller/Makefile b/contrib/pkginstaller/Makefile index 351d3cf41d..c335dc194c 100644 --- a/contrib/pkginstaller/Makefile +++ b/contrib/pkginstaller/Makefile @@ -7,9 +7,9 @@ else GOARCH:=$(ARCH) endif GVPROXY_VERSION ?= 0.7.3 -QEMU_VERSION ?= 8.2.1-1 +VFKIT_VERSION ?= 0.5.1 GVPROXY_RELEASE_URL ?= https://github.com/containers/gvisor-tap-vsock/releases/download/v$(GVPROXY_VERSION)/gvproxy-darwin -QEMU_RELEASE_URL ?= https://github.com/containers/podman-machine-qemu/releases/download/v$(QEMU_VERSION)/podman-machine-qemu-$(ARCH)-$(QEMU_VERSION).tar.xz +VFKIT_RELEASE_URL ?= https://github.com/crc-org/vfkit/releases/download/v$(VFKIT_VERSION)/vfkit-unsigned PACKAGE_DIR ?= out/packaging TMP_DOWNLOAD ?= tmp-download PACKAGE_ROOT ?= root @@ -24,9 +24,9 @@ $(TMP_DOWNLOAD)/gvproxy: mkdir -p $(TMP_DOWNLOAD) cd $(TMP_DOWNLOAD) && curl -sLo gvproxy $(GVPROXY_RELEASE_URL) -$(TMP_DOWNLOAD)/podman-machine-qemu-$(ARCH)-$(QEMU_VERSION).tar.xz: +$(TMP_DOWNLOAD)/vfkit: mkdir -p $(TMP_DOWNLOAD) - cd $(TMP_DOWNLOAD) && curl -sLO $(QEMU_RELEASE_URL) + cd $(TMP_DOWNLOAD) && curl -sLo vfkit $(VFKIT_RELEASE_URL) packagedir: podman_version package_root Distribution welcome.html mkdir -p $(PACKAGE_DIR) @@ -42,10 +42,10 @@ packagedir: podman_version package_root Distribution welcome.html cp ../../LICENSE $(PACKAGE_DIR)/Resources/LICENSE.txt cp hvf.entitlements $(PACKAGE_DIR)/ -package_root: clean-pkgroot $(TMP_DOWNLOAD)/podman-machine-qemu-$(ARCH)-$(QEMU_VERSION).tar.xz $(TMP_DOWNLOAD)/gvproxy - mkdir -p $(PACKAGE_ROOT)/podman/bin $(PACKAGE_ROOT)/podman/qemu - tar -C $(PACKAGE_ROOT)/podman/qemu -xf $(TMP_DOWNLOAD)/podman-machine-qemu-$(ARCH)-$(QEMU_VERSION).tar.xz +package_root: clean-pkgroot $(TMP_DOWNLOAD)/gvproxy $(TMP_DOWNLOAD)/vfkit + mkdir -p $(PACKAGE_ROOT)/podman/bin cp $(TMP_DOWNLOAD)/gvproxy $(PACKAGE_ROOT)/podman/bin/ + cp $(TMP_DOWNLOAD)/vfkit $(PACKAGE_ROOT)/podman/bin/ chmod a+x $(PACKAGE_ROOT)/podman/bin/* %: %.in podman_version diff --git a/contrib/pkginstaller/README.md b/contrib/pkginstaller/README.md index 7aaf648084..ff16629cc7 100644 --- a/contrib/pkginstaller/README.md +++ b/contrib/pkginstaller/README.md @@ -11,9 +11,7 @@ $ make ARCH= CODESIGN_IDENTITY= PRODUCTSIGN_IDENTITY= N ``` The generated pkg will be written to `out/podman-macos-installer-*.pkg`. -Currently the pkg installs `podman`, `qemu`, `gvproxy` and `podman-mac-helper` to `/opt/podman` - -The `qemu` build it uses is from [containers/podman-machine-qemu](https://github.com/containers/podman-machine-qemu) +Currently the pkg installs `podman`, `vfkit`, `gvproxy` and `podman-mac-helper` to `/opt/podman` ## Uninstalling diff --git a/contrib/pkginstaller/package.sh b/contrib/pkginstaller/package.sh index 48d3a85a18..6c75ca562d 100755 --- a/contrib/pkginstaller/package.sh +++ b/contrib/pkginstaller/package.sh @@ -7,10 +7,9 @@ OUTPUT=$1 CODESIGN_IDENTITY=${CODESIGN_IDENTITY:-mock} PRODUCTSIGN_IDENTITY=${PRODUCTSIGN_IDENTITY:-mock} NO_CODESIGN=${NO_CODESIGN:-0} -HELPER_BINARIES_DIR="/opt/podman/qemu/bin" +HELPER_BINARIES_DIR="/opt/podman/bin" binDir="${BASEDIR}/root/podman/bin" -qemuBinDir="${BASEDIR}/root/podman/qemu/bin" version=$(cat "${BASEDIR}/VERSION") arch=$(cat "${BASEDIR}/ARCH") @@ -36,32 +35,6 @@ function sign() { codesign --deep --sign "${CODESIGN_IDENTITY}" --options runtime --timestamp --force ${opts} "$1" } -function signQemu() { - if [ "${NO_CODESIGN}" -eq "1" ]; then - return - fi - - local qemuArch="${arch}" - if [ "${qemuArch}" = amd64 ]; then - qemuArch=x86_64 - fi - - # sign the files inside /opt/podman/qemu/lib - libs=$(find "${BASEDIR}"/root/podman/qemu/lib -depth -name "*.dylib" -or -type f -perm +111) - echo "${libs}" | xargs -t -I % codesign --deep --sign "${CODESIGN_IDENTITY}" --options runtime --timestamp --force % || true - - # sign the files inside /opt/podman/qemu/bin except qemu-system-* - bins=$(find "${BASEDIR}"/root/podman/qemu/bin -depth -type f -perm +111 ! -name "qemu-system-${qemuArch}") - echo "${bins}" | xargs -t -I % codesign --deep --sign "${CODESIGN_IDENTITY}" --options runtime --timestamp --force % || true - - # sign the qemu-system-* binary - # need to remove any extended attributes, otherwise codesign complains: - # qemu-system-aarch64: resource fork, Finder information, or similar detritus not allowed - xattr -cr "${qemuBinDir}/qemu-system-${qemuArch}" - codesign --deep --sign "${CODESIGN_IDENTITY}" --options runtime --timestamp --force \ - --entitlements "${BASEDIR}/hvf.entitlements" "${qemuBinDir}/qemu-system-${qemuArch}" -} - goArch="${arch}" if [ "${goArch}" = aarch64 ]; then goArch=arm64 @@ -70,8 +43,8 @@ fi build_podman "../../../../" sign "${binDir}/podman" sign "${binDir}/gvproxy" +sign "${binDir}/vfkit" sign "${binDir}/podman-mac-helper" -signQemu pkgbuild --identifier com.redhat.podman --version "${version}" \ --scripts "${BASEDIR}/scripts" \ diff --git a/contrib/pkginstaller/scripts/postinstall b/contrib/pkginstaller/scripts/postinstall index c34a733be5..6c90488819 100755 --- a/contrib/pkginstaller/scripts/postinstall +++ b/contrib/pkginstaller/scripts/postinstall @@ -4,8 +4,5 @@ set -e echo "/opt/podman/bin" > /etc/paths.d/podman-pkg -ln -s /opt/podman/bin/podman-mac-helper /opt/podman/qemu/bin/podman-mac-helper -ln -s /opt/podman/bin/gvproxy /opt/podman/qemu/bin/gvproxy - # make sure to ignore errors, this is not a hard requirement to use podman /opt/podman/bin/podman-mac-helper install || :