From 206aa1bf1e36226258b5f0f6d3f42b3a9ddf6b1d Mon Sep 17 00:00:00 2001 From: Jokubas Liutkus Date: Thu, 24 Jan 2019 12:54:24 +0000 Subject: [PATCH] Fixing versioning of releases to get rid of `v` in files (#20) * Fixing versioning of releases to get rid of `v` in files Current releases had `v` in all the files which is against a current standard. Therefore, we should remove this. * Changing tarball non-standard binary names Solving issue #19 to make tarballs contain standard binary names and removing the redundant /binaries directory Test: build the tarbals with `./build_tarballs.sh` and checked the tarball contents: ``` vagrant@ubuntu-xenial:~/repos/nvdtools/release$ tar zvft nvdtools-4.4.4-linux-amd64.tar.gz -rwxrwxr-x vagrant/vagrant 3513959 2019-01-24 00:36 cpe2cve -rwxrwxr-x vagrant/vagrant 2233700 2019-01-24 00:36 csv2cpe -rwxrwxr-x vagrant/vagrant 8595732 2019-01-24 00:36 nvdsync -rwxrwxr-x vagrant/vagrant 2229430 2019-01-24 00:36 rpm2cpe ``` --- .travis.yml | 1 + Makefile | 1 - build_tarballs.sh | 6 +++--- debian/rules | 4 ++++ rpm/Makefile | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ed89bbd..25bd53e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ script: - go test -v ./... before_deploy: +- export VERSION=${TRAVIS_TAG:1} - chmod +x build_tarballs.sh && ./build_tarballs.sh - make -C rpm/ - dpkg-buildpackage -rfakeroot -uc -us && mv ../*.deb release diff --git a/Makefile b/Makefile index f861cf9..ff003b4 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ CSV2CPE=csv2cpe NVDSYNC=nvdsync RPM2CPE=rpm2cpe -VERSION=$(TRAVIS_TAG) NAME=nvdtools PKG=$(NAME)-$(VERSION) TGZ=$(PKG).tar.gz diff --git a/build_tarballs.sh b/build_tarballs.sh index ac75c0a..4e89545 100755 --- a/build_tarballs.sh +++ b/build_tarballs.sh @@ -5,17 +5,17 @@ CSV2CPE=csv2cpe NVDSYNC=nvdsync RPM2CPE=rpm2cpe NAME=nvdtools -VERSION=$TRAVIS_TAG function build_binaries_and_tars(){ GOOS=$1; shift ARCHS=("$@") for GOARCH in ${ARCHS[@]}; do for BINARY in $CPE2CVE $CSV2CPE $NVDSYNC $RPM2CPE; do - env GOOS=$GOOS GOARCH=$GOARCH go build -o binaries/$BINARY-$VERSION-$GOOS-$GOARCH ./cmd/$BINARY + env GOOS=$GOOS GOARCH=$GOARCH go build -o $BINARY ./cmd/$BINARY done tar -zcvf release/$NAME-$VERSION-$GOOS-$GOARCH.tar.gz \ - binaries/{$CPE2CVE,$CSV2CPE,$NVDSYNC,$RPM2CPE}-$VERSION-$GOOS-$GOARCH + {$CPE2CVE,$CSV2CPE,$NVDSYNC,$RPM2CPE} + make clean done } diff --git a/debian/rules b/debian/rules index 04fdba7..ae620d8 100755 --- a/debian/rules +++ b/debian/rules @@ -2,3 +2,7 @@ %: dh $@ + +override_dh_gencontrol: + dh_gencontrol -- -v$(VERSION) + diff --git a/rpm/Makefile b/rpm/Makefile index 4afa068..7ae4e86 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -8,4 +8,4 @@ all: mv ../nvdtools-*.gz $(HOME)/rpmbuild/SOURCES cp nvdtools.spec $(HOME)/rpmbuild/SPECS cd $(HOME)/rpmbuild/SPECS - rpmbuild -ba --define="_tag $(TRAVIS_TAG)" nvdtools.spec + rpmbuild -ba --define="_tag $(VERSION)" nvdtools.spec