From f9ca0f92626669c66c117acf11c6278d288b39e5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 28 Jul 2018 17:14:07 -0400 Subject: [PATCH 1/6] refactor: install fpm and build packages sooner --- Makefile | 56 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 810f221..a16b5a3 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,8 @@ endef build: @$(MAKE) build/darwin/$(NAME) @$(MAKE) build/linux/$(NAME) + @$(MAKE) build/deb/$(NAME)_$(VERSION)_amd64.deb + @$(MAKE) build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm @$(MAKE) docker-image build/darwin/$(NAME): @@ -22,29 +24,7 @@ build/darwin/$(NAME): build/linux/$(NAME): mkdir -p build/linux && CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-X main.Version=$(VERSION)" -o build/linux/$(NAME) -clean: - rm -rf build - -circleci: - docker version - rm -f ~/.gitconfig - -deps: - go get -u github.com/progrium/gh-release/... - dep ensure -vendor-only - -docker-image: - docker build -q -f Dockerfile.build -t $(IMAGE_NAME):$(BUILD_TAG) . - -release: build - rm -rf release && mkdir release - tar -zcf release/$(NAME)_$(VERSION)_linux_$(HARDWARE).tgz -C build/linux $(NAME) - tar -zcf release/$(NAME)_$(VERSION)_darwin_$(HARDWARE).tgz -C build/darwin $(NAME) - @$(MAKE) release/$(NAME)_$(VERSION)_amd64.deb - @$(MAKE) release/$(NAME)-$(VERSION)-1.x86_64.rpm - gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) - -release/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME) +build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME) fpm \ --architecture amd64 \ --category utils \ @@ -54,12 +34,12 @@ release/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME) --maintainer "Jose Diaz-Gonzalez " \ --name procfile-util \ --output-type deb \ - --package release/$(NAME)_$(VERSION)_amd64.deb \ + --package build/deb/$(NAME)_$(VERSION)_amd64.deb \ --url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \ --version $(VERSION) \ build/linux/$(NAME)=/usr/local/bin/$(NAME) -release/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME) +build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME) fpm \ --architecture x86_64 \ --category utils \ @@ -69,8 +49,32 @@ release/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME) --maintainer "Jose Diaz-Gonzalez " \ --name procfile-util \ --output-type rpm \ - --package release/$(NAME)-$(VERSION)-1.x86_64.rpm \ + --package build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm \ --rpm-os linux \ --url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \ --version $(VERSION) \ build/linux/$(NAME)=/usr/local/bin/$(NAME) + +clean: + rm -rf build + +circleci: + docker version + rm -f ~/.gitconfig + apt install ruby ruby-dev rubygems build-essential -y + gem install --no-ri --no-rdoc fpm + +deps: + go get -u github.com/progrium/gh-release/... + dep ensure -vendor-only + +docker-image: + docker build -q -f Dockerfile.build -t $(IMAGE_NAME):$(BUILD_TAG) . + +release: build + rm -rf release && mkdir release + tar -zcf release/$(NAME)_$(VERSION)_linux_$(HARDWARE).tgz -C build/linux $(NAME) + tar -zcf release/$(NAME)_$(VERSION)_darwin_$(HARDWARE).tgz -C build/darwin $(NAME) + cp build/deb/$(NAME)_$(VERSION)_amd64.deb release/$(NAME)_$(VERSION)_amd64.deb + cp build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm release/$(NAME)-$(VERSION)-1.x86_64.rpm + gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) From 4ad02351de92eda7b471d5cd30f14cbcd6c57532 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 28 Jul 2018 17:15:31 -0400 Subject: [PATCH 2/6] refactor: cleanup makefile --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a16b5a3..db6db77 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ NAME = procfile-util +EMAIL = procfile-util@josediazgonzalez.com MAINTAINER = josegonzalez +MAINTAINER_NAME = Jose Diaz-Gonzalez REPOSITORY = go-procfile-util HARDWARE = $(shell uname -m) VERSION ?= 0.0.2 @@ -31,7 +33,7 @@ build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME) --description "$$DESCRIPTION" \ --input-type dir \ --license 'MIT License' \ - --maintainer "Jose Diaz-Gonzalez " \ + --maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \ --name procfile-util \ --output-type deb \ --package build/deb/$(NAME)_$(VERSION)_amd64.deb \ @@ -46,7 +48,7 @@ build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME) --description "$$DESCRIPTION" \ --input-type dir \ --license 'MIT License' \ - --maintainer "Jose Diaz-Gonzalez " \ + --maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \ --name procfile-util \ --output-type rpm \ --package build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm \ From 106098077542acbcf27803856ee4c04a02ca74bf Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 28 Jul 2018 17:16:07 -0400 Subject: [PATCH 3/6] fix: add missing sudo for package installation --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index db6db77..ec8a73c 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ clean: circleci: docker version rm -f ~/.gitconfig - apt install ruby ruby-dev rubygems build-essential -y + sudo apt install ruby ruby-dev rubygems build-essential -y gem install --no-ri --no-rdoc fpm deps: From d613d820bb40ae2da5d23b72e7a084410ad3a418 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 28 Jul 2018 17:17:14 -0400 Subject: [PATCH 4/6] feat: install fpm via sudo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ec8a73c..82be3fd 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ circleci: docker version rm -f ~/.gitconfig sudo apt install ruby ruby-dev rubygems build-essential -y - gem install --no-ri --no-rdoc fpm + sudo gem install --no-ri --no-rdoc fpm deps: go get -u github.com/progrium/gh-release/... From e01442315f6c346bf0aa9752dd7564ae6d6cb64a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 28 Jul 2018 17:18:35 -0400 Subject: [PATCH 5/6] fix: add missing mkdir --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 82be3fd..947657e 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ build/linux/$(NAME): mkdir -p build/linux && CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-X main.Version=$(VERSION)" -o build/linux/$(NAME) build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME) - fpm \ + mkdir -p build/deb && fpm \ --architecture amd64 \ --category utils \ --description "$$DESCRIPTION" \ @@ -42,7 +42,7 @@ build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME) build/linux/$(NAME)=/usr/local/bin/$(NAME) build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME) - fpm \ + mkdir -p build/rpm && fpm \ --architecture x86_64 \ --category utils \ --description "$$DESCRIPTION" \ From daece3a6cf3ab6eb592a470bc81682bc8caee4c1 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 28 Jul 2018 17:20:32 -0400 Subject: [PATCH 6/6] fix: install rpm --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 947657e..109ebb5 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME) build/linux/$(NAME)=/usr/local/bin/$(NAME) build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME) + sudo apt install rpm -y mkdir -p build/rpm && fpm \ --architecture x86_64 \ --category utils \