Blame SOURCES/Makefile

1bbbef
all: grafana-pcp-$(VER).tar.gz \
1bbbef
	 grafana-pcp-vendor-$(VER).tar.xz \
1bbbef
	 grafana-pcp-webpack-$(VER).tar.gz
1bbbef
db3ad6
grafana-pcp-$(VER).tar.gz:
1bbbef
	wget https://github.com/performancecopilot/grafana-pcp/archive/v$(VER)/grafana-pcp-$(VER).tar.gz
db3ad6
db3ad6
ALL_PATCHES := $(wildcard *.patch)
db3ad6
PATCHES_TO_APPLY := $(ALL_PATCHES)
db3ad6
db3ad6
grafana-pcp-vendor-$(VER).tar.xz: grafana-pcp-$(VER).tar.gz
1bbbef
	rm -rf grafana-pcp-$(VER)
1bbbef
	tar xfz grafana-pcp-$(VER).tar.gz
1bbbef
db3ad6
	# patches can affect Go or Node.js dependencies, or the webpack
db3ad6
	for patch in $(PATCHES_TO_APPLY); do patch -d grafana-pcp-$(VER) -p1 --fuzz=0 < $$patch; done
db3ad6
1bbbef
	# Go
1bbbef
	cd grafana-pcp-$(VER) && go mod vendor -v
1bbbef
	awk '$$2~/^v/ && $$4 != "indirect" {print "Provides: bundled(golang(" $$1 ")) = " substr($$2, 2)}' grafana-pcp-$(VER)/go.mod | \
1bbbef
		sed -E 's/=(.*)-(.*)-(.*)/=\1-\2.\3/g' > $@.manifest
1bbbef
1bbbef
	# Node.js
1bbbef
	cd grafana-pcp-$(VER) && yarn install --pure-lockfile
1bbbef
	# Remove files with licensing issues
1bbbef
	find grafana-pcp-$(VER) -type d -name 'node-notifier' -prune -exec rm -r {} \;
db3ad6
	find grafana-pcp-$(VER) -type f -name '*.exe' -delete
1bbbef
	# Remove not required packages
1bbbef
	rm -r grafana-pcp-$(VER)/node_modules/puppeteer
1bbbef
	./list_bundled_nodejs_packages.py grafana-pcp-$(VER)/ >> $@.manifest
1bbbef
1bbbef
	# Jsonnet
1bbbef
	cd grafana-pcp-$(VER) && jb --jsonnetpkg-home=vendor_jsonnet install
1bbbef
1bbbef
	# Create tarball
1bbbef
	XZ_OPT=-9 tar cfJ $@ \
1bbbef
		grafana-pcp-$(VER)/vendor \
db3ad6
		grafana-pcp-$(VER)/node_modules \
1bbbef
		grafana-pcp-$(VER)/vendor_jsonnet
1bbbef
db3ad6
grafana-pcp-webpack-$(VER).tar.gz: grafana-pcp-$(VER).tar.gz
1bbbef
	cd grafana-pcp-$(VER) && \
db3ad6
		../build_frontend.sh
1bbbef
1bbbef
	tar cfz $@ grafana-pcp-$(VER)/dist
1bbbef
1bbbef
clean:
1bbbef
	rm -rf *.tar.gz *.tar.xz *.manifest *.rpm grafana-pcp-*/