Skip to content

Commit

Permalink
Merge branch 'more-generic-makefile'
Browse files Browse the repository at this point in the history
  • Loading branch information
sodre committed Dec 2, 2017
2 parents 5832069 + 1a8a0ca commit 59a274f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
TAG:=$(shell git describe --tags | sed -e 's/^v//')
TAG_DIST=$(shell echo $(TAG) | sed -r -e 's/.*-([[:digit:]]+)-g.*/\1/')
TAG_HASH=$(shell echo $(TAG) | sed -r -e 's/^.*(g[0-9a-f]+|$$)/\1/')
NIFI_VERSION=$(shell echo $(TAG) | sed -r -e 's/\+nifi.*//')

PKG=NIFI
PKG_VERSION=$(shell echo $(TAG) | sed -r -e 's/\+nifi.*//')
JQ_VERSION=1.5
VERSION=$(subst +,-,$(TAG))

Expand All @@ -10,7 +12,7 @@ ifeq ($(TRAVIS), true)
else
DISTROS=el7
endif
PARCELS=$(foreach DISTRO,$(DISTROS),NIFI-$(VERSION)-$(DISTRO).parcel)
PARCELS=$(foreach DISTRO,$(DISTROS),$(PKG)-$(VERSION)-$(DISTRO).parcel)

.INTERMEDIATE: %-SHA256
.DELETE_ON_ERROR:
Expand All @@ -23,42 +25,42 @@ info:
@[ ! -z $(TAG) ]
@echo ' Tag dist: $(TAG_DIST)'
@echo ' Tag hash: $(TAG_HASH)'
@echo ' NiFi version: $(NIFI_VERSION)'
@echo ' PKG version: $(PKG_VERSION)'
@echo 'Parcel version: $(VERSION)'
@echo ' Parcels: $(PARCELS)'

clean:
rm -rf release NIFI-*
rm -rf release $(PKG)-*

release: $(foreach PARCEL,$(PARCELS),release/$(PARCEL)) release/manifest.json

%/manifest.json: make_manifest.py
@mkdir -p $(shell dirname $@)
python make_manifest.py $(shell dirname $@)

NIFI-$(VERSION)-%.parcel: NIFI-$(VERSION).parcel
$(PKG)-$(VERSION)-%.parcel: $(PKG)-$(VERSION).parcel
@mkdir -p $(shell dirname $@)
ln $< $@
java -jar validator.jar -f $@

NIFI-$(VERSION).parcel: NIFI-$(VERSION)/meta
$(PKG)-$(VERSION).parcel: $(PKG)-$(VERSION)/meta
@mkdir -p $(shell dirname $@)
tar zcvf $@ --owner root --group=root $(shell dirname $<)

NIFI-$(VERSION)/meta: NIFI-$(VERSION) meta validator.jar
$(PKG)-$(VERSION)/meta: $(PKG)-$(VERSION) meta validator.jar
@mkdir $@
cp meta/nifi_env.sh $@
cat meta/parcel.json | jq ".version=\"$(VERSION)\"" > $@/parcel.json
java -jar validator.jar -p $@/parcel.json || (rm -rf $@ && false)

NIFI-$(VERSION): nifi-$(NIFI_VERSION) nifi-toolkit-$(NIFI_VERSION) jq-$(JQ_VERSION)-linux64
$(PKG)-$(VERSION): nifi-$(PKG_VERSION) nifi-toolkit-$(PKG_VERSION) jq-$(JQ_VERSION)-linux64
rm -rf $@
mkdir -p $@/lib $@/bin
mv jq-$(JQ_VERSION)-linux64 $@/bin/jq
find $@/bin -type f -exec chmod 755 {} \;
cp -avf xslt $@/lib/nifi-xslt
mv nifi-$(NIFI_VERSION) $@/lib/nifi
mv nifi-toolkit-$(NIFI_VERSION) $@/lib/nifi-toolkit
mv nifi-$(PKG_VERSION) $@/lib/nifi
mv nifi-toolkit-$(PKG_VERSION) $@/lib/nifi-toolkit
find $@/lib/nifi-toolkit/bin -type f -exec chmod 755 {} \;
find $@/lib/nifi-toolkit/classpath -type f -exec chmod 644 {} \;

Expand All @@ -75,13 +77,13 @@ jq-$(JQ_VERSION)-linux64: jq-$(JQ_VERSION)-SHA256
touch $@
sha256sum -c $<

nifi-$(NIFI_VERSION)-bin.tar.gz: nifi-$(NIFI_VERSION)-bin.tar.gz-SHA256
wget 'https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=nifi/$(NIFI_VERSION)/$@' -O $@
nifi-$(PKG_VERSION)-bin.tar.gz: nifi-$(PKG_VERSION)-bin.tar.gz-SHA256
wget 'https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=nifi/$(PKG_VERSION)/$@' -O $@
touch $@
sha256sum -c $<

nifi-toolkit-$(NIFI_VERSION)-bin.tar.gz: nifi-toolkit-$(NIFI_VERSION)-bin.tar.gz-SHA256
wget 'https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=nifi/$(NIFI_VERSION)/$@' -O $@
nifi-toolkit-$(PKG_VERSION)-bin.tar.gz: nifi-toolkit-$(PKG_VERSION)-bin.tar.gz-SHA256
wget 'https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=nifi/$(PKG_VERSION)/$@' -O $@
touch $@
sha256sum -c $<

Expand Down

0 comments on commit 59a274f

Please sign in to comment.