From 4871f15e142131f873226215063da27385f2fa99 Mon Sep 17 00:00:00 2001 From: "Zheng, Qi" Date: Tue, 1 Nov 2022 18:42:18 +0800 Subject: [PATCH] [installer] Add occlum golang debian installer --- .../workflows/package_repo_setup_and_test.yml | 8 ++++++++ tools/installer/deb/Makefile | 5 +---- .../installer/deb/toolchains/golang/changelog | 8 +++++++- .../deb/toolchains/golang/occlum-go.sh | 1 + tools/installer/deb/toolchains/golang/rules | 19 ++++++------------- 5 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 tools/installer/deb/toolchains/golang/occlum-go.sh diff --git a/.github/workflows/package_repo_setup_and_test.yml b/.github/workflows/package_repo_setup_and_test.yml index 90cd2efa..4b2c79d4 100644 --- a/.github/workflows/package_repo_setup_and_test.yml +++ b/.github/workflows/package_repo_setup_and_test.yml @@ -12,6 +12,10 @@ on: description: 'Need build new glibc package? ' required: true default: 'N' + update_golang: + description: 'Need build new golang package? ' + required: true + default: 'N' only_test: description: 'Only Test? ' required: true @@ -75,6 +79,10 @@ jobs: if: github.event.inputs.update_glibc == 'Y' run: docker exec ubuntu bash -c "cd /root/workspace/occlum/tools/installer/deb; make glibc" + - name: Build golang toolchain package + if: github.event.inputs.update_golang == 'Y' + run: docker exec ubuntu bash -c "cd /root/workspace/occlum/tools/installer/deb; make golang" + - name: Prepare tools and keys # Since aptly still use gpg1 by default, we all use gpg1 as gpg tool. run: docker exec ubuntu bash -c 'apt-get update; apt-get install -y tree apt-utils gnupg reprepro rng-tools aptly; rm -rf /root/.gnupg; echo "${{ secrets.DEB_PRIVATE_KEY }}" > /root/deb_private_key; gpg1 --allow-secret-key-import --import /root/deb_private_key; diff --git a/tools/installer/deb/Makefile b/tools/installer/deb/Makefile index 83140ce5..fdbe8259 100644 --- a/tools/installer/deb/Makefile +++ b/tools/installer/deb/Makefile @@ -17,11 +17,9 @@ C_TOOLCHAIN_PACKAGE_NAME := occlum-toolchains-gcc # When updating the toolchain packages for Deb, please first update RPM configuration. And then # update the "changelog" file accordingly. MUSL_VERSION := 0.27.0 -GOLAN_VERSION := 0.16.0 +GOLAN_VERSION := 1.18.4 GLIBC_VERSION := 2.31 -GO_PATCH = $(PROJECT_DIR)/tools/toolchains/golang/adapt-golang-to-occlum.patch - .PHONY: all main config_files main_deps musl-gcc deps_c glibc deps_glibc clean clean-build all: main @@ -77,7 +75,6 @@ deps_golang: mkdir -p $(TARGET_DIR) mkdir -p $(DEB_BUILD_DIR)/occlum-toolchains-golang cp -r toolchains/golang $(DEB_BUILD_DIR)/occlum-toolchains-golang/debian - cp -t $(DEB_BUILD_DIR)/occlum-toolchains-golang/debian $(GO_PATCH) $(PROJECT_DIR)/tools/installer/rpm/toolchains/golang/occlum-go.sh glibc: deps_glibc cd $(DEB_BUILD_DIR)/occlum-toolchains-glibc ; \ diff --git a/tools/installer/deb/toolchains/golang/changelog b/tools/installer/deb/toolchains/golang/changelog index e5429c40..2055be64 100644 --- a/tools/installer/deb/toolchains/golang/changelog +++ b/tools/installer/deb/toolchains/golang/changelog @@ -1,5 +1,11 @@ +occlum-toolchains-golang (1.18.4-1) unstable; urgency=medium + + * Upgrade golang version to 1.18.4 + + -- Qi Zheng Tue, 1 Nov 2022 17:16:9 +0000 + occlum-toolchains-golang (0.16.0-1) unstable; urgency=medium * Initial release - -- Chunyang Hui Tue, 18 Aug 2020 14:37:39 +0000 + -- Chunyang Hui Tue, 18 Aug 2020 14:37:39 +0000 diff --git a/tools/installer/deb/toolchains/golang/occlum-go.sh b/tools/installer/deb/toolchains/golang/occlum-go.sh new file mode 100644 index 00000000..dbcf762b --- /dev/null +++ b/tools/installer/deb/toolchains/golang/occlum-go.sh @@ -0,0 +1 @@ +export PATH="$PATH:/opt/occlum/toolchains/golang/bin" diff --git a/tools/installer/deb/toolchains/golang/rules b/tools/installer/deb/toolchains/golang/rules index 18799d6c..ba978d40 100755 --- a/tools/installer/deb/toolchains/golang/rules +++ b/tools/installer/deb/toolchains/golang/rules @@ -9,12 +9,9 @@ export install_dir = $(buildroot)/opt/occlum/toolchains/golang SHELL = /bin/bash -# Needed by musl-cross-make config -TARGET = x86_64-linux-musl -GCC_VER = 8.3.0 -GO_VERSION = 1.13.7 -GO_REPO = https://github.com/golang/go/archive/go$(GO_VERSION).tar.gz -GO_PATCH = adapt-golang-to-occlum.patch +# go1.18.4_for_occlum or go1.16.3_for_occlum +GO_BRANCH = go1.18.4_for_occlum +GO_REPO = https://github.com/occlum/go.git .ONESHELL: prepare override_dh_install @@ -27,19 +24,15 @@ prepare: rm -rf $(install_dir) mkdir -p $(tmp_build_dir) cd $(tmp_build_dir) - wget $(GO_REPO) - tar -xvzf go$(GO_VERSION).tar.gz - cd go-go$(GO_VERSION) - patch -p1 < $(deb_build_dir)/$(name)/debian/$(GO_PATCH) + git clone -b $(GO_BRANCH) $(GO_REPO) . override_dh_auto_build: prepare - cd $(tmp_build_dir)/go-go$(GO_VERSION)/src; \ - export GO_LDFLAGS="-compressdwarf=false"; \ + cd $(tmp_build_dir)/src; \ ./make.bash override_dh_install: mkdir -p $(buildroot)/opt/occlum/toolchains - mv $(tmp_build_dir)/go-go$(GO_VERSION)/ $(install_dir) + mv $(tmp_build_dir)/ $(install_dir) rm -rf $(install_dir)/.git* cat > $(install_dir)/bin/occlum-go <