From b32c489ab3731ccad330b11d156a30ff9a286e1f Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Sun, 23 Aug 2020 10:09:02 +0000 Subject: [PATCH] [deb] publish deb package Signed-off-by: Leo Chen --- Makefile | 18 +++++++++---- scripts/package/deb/build.sh | 30 --------------------- scripts/package/deb/dev.aptly.conf | 42 +++++++++++++++++++++++++++++ scripts/package/deb/prod.aptly.conf | 42 +++++++++++++++++++++++++++++ scripts/package/publish-repo.sh | 11 +++++++- 5 files changed, 107 insertions(+), 36 deletions(-) delete mode 100755 scripts/package/deb/build.sh create mode 100644 scripts/package/deb/dev.aptly.conf create mode 100644 scripts/package/deb/prod.aptly.conf diff --git a/Makefile b/Makefile index 9507d2bd6..26bdb7e00 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,12 @@ export LIBRARY_PATH:=$(LD_LIBRARY_PATH) export DYLD_FALLBACK_LIBRARY_PATH:=$(LD_LIBRARY_PATH) export GO111MODULE:=on PKGNAME=harmony -VERSION?=2.3.5 +VERSION?=2.3.6 RPMBUILD=$(HOME)/rpmbuild DEBBUILD=$(HOME)/debbuild SHELL := bash -.PHONY: all help libs exe race trace-pointer debug debug-kill test test-go test-api test-api-attach linux_static deb rpm_init rpm_build rpm +.PHONY: all help libs exe race trace-pointer debug debug-kill test test-go test-api test-api-attach linux_static deb_init deb_build deb debpub_dev debpub_prod rpm_init rpm_build rpm rpmpub_dev rpmpub_prod all: libs bash ./scripts/go_executable_build.sh -S @@ -32,7 +32,7 @@ help: @echo "linux_static - static build the harmony binary & bootnode along with the MCL & BLS libs (for linux)" @echo "arm_static - static build the harmony binary & bootnode on ARM64 platform" @echo "rpm - build a harmony RPM pacakge" - @echo "deb - build a harmony Debian pacakge (todo)" + @echo "deb - build a harmony Debian pacakge" libs: make -C $(TOP)/mcl -j8 @@ -104,6 +104,14 @@ deb_build: deb: deb_init deb_build +debpub_dev: deb + cp scripts/package/deb/dev.aptly.conf ~/.aptly.conf + ./scripts/package/publish-repo.sh -p dev -n deb -s $(DEBBUILD) + +debpub_prod: deb + cp scripts/package/deb/prod.aptly.conf ~/.aptly.conf + ./scripts/package/publish-repo.sh -p prod -n deb -s $(DEBBUILD) + rpm_init: rm -rf $(RPMBUILD) mkdir -p $(RPMBUILD)/{SOURCES,SPECS,BUILD,RPMS,BUILDROOT,SRPMS} @@ -125,7 +133,7 @@ rpm: rpm_init rpm_build rpm --addsign $(RPMBUILD)/RPMS/x86_64/$(PKGNAME)-$(VERSION)-0.x86_64.rpm rpmpub_dev: rpm - ./scripts/package/publish-repo.sh -p dev -t rpm -s $(RPMBUILD) + ./scripts/package/publish-repo.sh -p dev -n rpm -s $(RPMBUILD) rpmpub_prod: rpm - ./scripts/package/publish-repo.sh -p prod -t rpm -s $(RPMBUILD) + ./scripts/package/publish-repo.sh -p prod -n rpm -s $(RPMBUILD) diff --git a/scripts/package/deb/build.sh b/scripts/package/deb/build.sh deleted file mode 100755 index e81795c53..000000000 --- a/scripts/package/deb/build.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ $# != 1 ]; then - echo "$0 version" - exit -fi - -VERSION=$1 - -fpm -s dir -t deb -n harmony -p harmony_VERSION_ARCH.deb -C harmony-${VERSION} \ - -v "$VERSION" \ - --license "MIT" \ - --vendor "Harmony Blockchain" \ - --category "net" \ - --no-depends \ - --no-auto-depends \ - --directories /etc/harmony \ - --directories /data/harmony \ - --architecture x86_64 \ - --maintainer "Leo Chen " \ - --description "Harmony is a sharded, fast finality, low fee, PoS public blockchain.\nThis package contains the validator node program for harmony blockchain." \ - --url "https://harmony.one" \ - --before-install scripts/preinst \ - --after-install scripts/postinst \ - --before-remove scripts/prerm \ - --after-remove scripts/postrm \ - --before-upgrade scripts/preup \ - --after-upgrade scripts/postup \ - --deb-changelog scripts/changelog \ - --deb-systemd-restart-after-upgrade diff --git a/scripts/package/deb/dev.aptly.conf b/scripts/package/deb/dev.aptly.conf new file mode 100644 index 000000000..74493c6e6 --- /dev/null +++ b/scripts/package/deb/dev.aptly.conf @@ -0,0 +1,42 @@ +{ + "rootDir": "/tmp/.aptly", + "downloadConcurrency": 4, + "downloadSpeedLimit": 0, + "architectures": [], + "dependencyFollowSuggests": false, + "dependencyFollowRecommends": false, + "dependencyFollowAllVariants": false, + "dependencyFollowSource": false, + "dependencyVerboseResolve": false, + "gpgDisableSign": false, + "gpgDisableVerify": false, + "gpgProvider": "gpg", + "downloadSourcePackages": false, + "skipLegacyPool": true, + "ppaDistributorID": "ubuntu", + "ppaCodename": "", + "FileSystemPublishEndpoints": { + "harmony-dev": { + "rootDir": "/tmp/repo", + "linkMethod": "copy", + "verifyMethod": "md5" + } + }, + "S3PublishEndpoints": { + "harmony-dev": { + "region": "us-east-1", + "bucket": "haochen-harmony-pub", + "endpoint": "", + "awsAccessKeyID": "", + "awsSecretAccessKey": "", + "prefix": "pub/repo", + "acl": "public-read", + "storageClass": "", + "encryptionMethod": "", + "plusWorkaround": false, + "disableMultiDel": false, + "forceSigV2": false, + "debug": false + } + } +} diff --git a/scripts/package/deb/prod.aptly.conf b/scripts/package/deb/prod.aptly.conf new file mode 100644 index 000000000..7f58394bd --- /dev/null +++ b/scripts/package/deb/prod.aptly.conf @@ -0,0 +1,42 @@ +{ + "rootDir": "/tmp/.aptly", + "downloadConcurrency": 4, + "downloadSpeedLimit": 0, + "architectures": [], + "dependencyFollowSuggests": false, + "dependencyFollowRecommends": false, + "dependencyFollowAllVariants": false, + "dependencyFollowSource": false, + "dependencyVerboseResolve": false, + "gpgDisableSign": false, + "gpgDisableVerify": false, + "gpgProvider": "gpg", + "downloadSourcePackages": false, + "skipLegacyPool": true, + "ppaDistributorID": "ubuntu", + "ppaCodename": "", + "FileSystemPublishEndpoints": { + "harmony-prod": { + "rootDir": "/tmp/repo", + "linkMethod": "copy", + "verifyMethod": "md5" + } + }, + "S3PublishEndpoints": { + "harmony-prod": { + "region": "us-west-1", + "bucket": "pub.harmony.one", + "endpoint": "", + "awsAccessKeyID": "", + "awsSecretAccessKey": "", + "prefix": "release/package/apt", + "acl": "public-read", + "storageClass": "", + "encryptionMethod": "", + "plusWorkaround": false, + "disableMultiDel": false, + "forceSigV2": false, + "debug": false + } + } +} diff --git a/scripts/package/publish-repo.sh b/scripts/package/publish-repo.sh index b93af4731..795894d3b 100755 --- a/scripts/package/publish-repo.sh +++ b/scripts/package/publish-repo.sh @@ -69,7 +69,16 @@ function publish_rpm() { } function publish_deb() { - : + if aptly repo show harmony-$PROFILE > /dev/null; then + aptly repo add harmony-$PROFILE $SRC + aptly publish update bionic s3:harmony-$PROFILE: + else + aptly repo create -distribution=bionic -component=main harmony-$PROFILE + aptly repo add harmony-$PROFILE $SRC + aptly publish repo harmony-$PROFILE s3:harmony-$PROFILE: + fi + # remove the local repo + aptly repo drop harmony-$PROFILE } ################## MAIN ##################