buildsys: rework downloading and vendoring upstream

try to ensure that a clean dependency/prerequisites chain exists

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-05-24 18:44:30 +02:00
parent 97f46045cb
commit 99671ec811

View File

@ -11,7 +11,7 @@ DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
SRCDIR=src SRCDIR=src
UPSTREAM=eslint UPSTREAM=eslint
UPSTREAMTAG=v8.41.0 UPSTREAMTAG=v8.41.0
BUILDSRC=$(UPSTREAM)-$(UPSTREAMTAG) UPSTREAMSRC=$(UPSTREAM)-$(UPSTREAMTAG)
all: $(DEB) all: $(DEB)
@echo $(DEB) @echo $(DEB)
@ -41,27 +41,37 @@ $(DEB): builddir
.PHONY: download .PHONY: download
download: download:
rm -rf $(UPSTREAM)
$(MAKE) $(UPSTREAM)
$(UPSTREAM):
rm -rf $(UPSTREAM).tmp $(UPSTREAM) rm -rf $(UPSTREAM).tmp $(UPSTREAM)
git clone -b $(UPSTREAMTAG) --depth 1 https://github.com/eslint/eslint $(UPSTREAM).tmp git clone -b $(UPSTREAMTAG) --depth 1 https://github.com/eslint/eslint $(UPSTREAM).tmp
rm -rf $(UPSTREAM).tmp/.git rm -rf $(UPSTREAM).tmp/.git
find $(UPSTREAM).tmp/ -type f -name '.gitignore' -delete find $(UPSTREAM).tmp/ -type f -name '.gitignore' -delete
mv $(UPSTREAM).tmp $(UPSTREAM) mv $(UPSTREAM).tmp $(UPSTREAM)
# NOTE: needs npm installed, downloads packages from npm .PHONY: vendor-upstream
.PHONY: buildupstream vendor-upstream:
buildupstream: $(BUILDSRC) rm -rf $(UPSTREAMSRC) src/lib/eslint.js
cp $(BUILDSRC)/build/eslint.js $(SRCDIR)/lib/eslint.js $(MAKE) src/lib/eslint.js
$(BUILDSRC): $(UPSTREAM) patches src/lib/eslint.js: $(UPSTREAMSRC)/build/eslint.js
rm -rf $@ cp $(UPSTREAMSRC)/build/eslint.js src/lib/eslint.js
$(UPSTREAMSRC)/build/eslint.js: $(UPSTREAMSRC)
# NOTE: needs npm installed, downloads packages from npm
cd $(UPSTREAMSRC); npm install
cd $(UPSTREAMSRC); npm run build:webpack
$(UPSTREAMSRC): $(UPSTREAM) patches
rm -rf $@ $@.tmp
mkdir $@.tmp mkdir $@.tmp
rsync -ra $(UPSTREAM)/ $@.tmp rsync -ra $(UPSTREAM)/ $@.tmp
cd $@.tmp; ln -s ../patches patches cd $@.tmp; ln -s ../patches patches
cd $@.tmp; quilt push -a cd $@.tmp; quilt push -a
cd $@.tmp; rm -rf .pc ./patches cd $@.tmp; rm -rf .pc ./patches
mv $@.tmp $@ mv $@.tmp $@
cd $@; npm install
cd $@; npm run build:webpack
.PHONY: upload .PHONY: upload
upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION) upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)