]> git.proxmox.com Git - pve-eslint.git/commitdiff
buildsys: rework downloading and vendoring upstream
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 24 May 2023 16:44:30 +0000 (18:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 24 May 2023 16:51:55 +0000 (18:51 +0200)
try to ensure that a clean dependency/prerequisites chain exists

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Makefile

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