From adaa7fa2ce865fb8ca22bcf2b711c2c749cd124d Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Mon, 12 Apr 2021 17:48:31 +0800 Subject: [PATCH] feat(fetcherfs): make rpm and deb package --- Makefile | 18 ++++++++++++++++++ build/convert_rpm2deb.sh | 23 +++++++++++++++++++++++ build/docker/Dockerfile.debian-base | 9 +++++++++ build/docker/Makefile | 3 +++ 4 files changed, 53 insertions(+) create mode 100755 build/convert_rpm2deb.sh create mode 100644 build/docker/Dockerfile.debian-base create mode 100644 build/docker/Makefile diff --git a/Makefile b/Makefile index ad366aec53..18253b55fc 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,9 @@ vet: cmd/esxi-agent: prepare_dir CGO_ENABLED=0 $(GO_BUILD) -o $(BIN_DIR)/$(shell basename $@) $(REPO_PREFIX)/$@ +cmd/fetcherfs: prepare_dir + CGO_ENABLED=0 $(GO_BUILD) -o $(BIN_DIR)/$(shell basename $@) $(REPO_PREFIX)/$@ + cmd/%: prepare_dir $(GO_BUILD) -o $(BIN_DIR)/$(shell basename $@) $(REPO_PREFIX)/$@ @@ -101,6 +104,21 @@ deb/%: cmd/% pkg/%: prepare_dir $(GO_INSTALL) $(REPO_PREFIX)/$@ +rpm/fetcherfs: cmd/fetcherfs + docker run --rm \ + --name docker-centos-build-fetcherfs \ + -v $(CURDIR):/data \ + registry.cn-beijing.aliyuncs.com/yunionio/centos-build:1.1-4 \ + /bin/bash -c "VERSION=3.6 /data/build/build.sh fetcherfs /opt/yunion/fetchclient/bin" + +deb/fetcherfs: rpm/fetcherfs + #VERSION=3.6 $(DEB_BUILD_SCRIPT) fetcherfs /opt/yunion/fetchclient/bin + docker run --rm \ + --name docker-debian-build-fetcherfs \ + -v $(CURDIR):/data \ + registry.cn-beijing.aliyuncs.com/yunionio/debian10-base:1.0 \ + /data/build/convert_rpm2deb.sh + build: $(MAKE) $(cmdTargets) diff --git a/build/convert_rpm2deb.sh b/build/convert_rpm2deb.sh new file mode 100755 index 0000000000..4950ec13a7 --- /dev/null +++ b/build/convert_rpm2deb.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +if [ -z "$ROOT_DIR" ]; then + ROOT_DIR=$(dirname $(dirname $(readlink -f "$BASH_SOURCE"))) +fi + +RPMS_DIR=$ROOT_DIR/_output/rpms +DEBS_DIR=$ROOT_DIR/_output/debs + +case $(uname -m) in + x86_64) + CURRENT_ARCH=amd64 + ;; + aarch64) + CURRENT_ARCH=arm64 + ;; +esac + +mkdir -p $DEBS_DIR && cd $DEBS_DIR + +find $RPMS_DIR -type f -name *.rpm -exec alien --target=$CURRENT_ARCH {} \; diff --git a/build/docker/Dockerfile.debian-base b/build/docker/Dockerfile.debian-base new file mode 100644 index 0000000000..6e57e2386e --- /dev/null +++ b/build/docker/Dockerfile.debian-base @@ -0,0 +1,9 @@ +# registry.cn-beijing.aliyuncs.com/yunionio/debian10-base:1.0 + +FROM debian:10 + +RUN apt update && apt install -y alien + +RUN apt-get clean autoclean && \ + apt-get autoremove --yes && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ diff --git a/build/docker/Makefile b/build/docker/Makefile new file mode 100644 index 0000000000..22c1ec6485 --- /dev/null +++ b/build/docker/Makefile @@ -0,0 +1,3 @@ +debian10-base: + docker buildx build --platform linux/arm64,linux/amd64 --push \ + -t registry.cn-beijing.aliyuncs.com/yunionio/debian10-base:1.0 -f ./Dockerfile.debian-base .