]> git.proxmox.com Git - pve-firmware.git/blobdiff - Makefile
buildsys: derive upload dist automatically
[pve-firmware.git] / Makefile
index db1d5d7d8cdb69cb2246a7f562fbf7ff38e9efd1..e000dfedaebdc7aae188c5021460a42d2ae40c22 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,58 +1,63 @@
 include /usr/share/dpkg/pkg-info.mk
 
-FW_DEB=pve-firmware_$(DEB_VERSION)_all.deb
+PACKAGE = pve-firmware
 
-GITVERSION:=$(shell git rev-parse HEAD)
-
-export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
+BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
+ORIG_SRC_TAR=$(PACKAGE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
 
+DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
+FW_DEB=$(PACKAGE)_$(DEB_VERSION)_all.deb
 DEBS=$(FW_DEB)
-BUILDDIR=fwdata
 
 .PHONY: deb
 deb: $(DEBS)
 
 $(FW_DEB): $(BUILDDIR)
-       cp -a debian $(BUILDDIR)
-       echo "git clone git://git.proxmox.com/git/pve-firmware.git\\ngit checkout $(GITVERSION)" >$(BUILDDIR)/debian/SOURCE
        cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
 
+.PHONY: dsc
+dsc:
+       $(MAKE) clean
+       $(MAKE) $(DSC)
+       lintian $(DSC)
+
+$(DSC): $(ORIG_SRC_TAR) $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
+
+sbuild: $(DSC)
+       sbuild $(DSC)
+
 # NOTE: when collapsing FW lists keep major.minor still separated, so we can sunset the older ones
 # without user impact safely. The last oldstable list needs to be kept avoid breakage on upgrade
 .PHONY: fw.list
-fw.list: fwlist-5.4.86-1-pve
-fw.list: fwlist-5.11.x-y-pve
-fw.list: fwlist-5.13.x-y-pve
-fw.list: fwlist-5.15.5-1-pve
-fw.list: fwlist-5.15.19-1-pve
-fw.list: fwlist-5.15.27-1-pve
-fw.list: fwlist-5.15.35-1-pve
-fw.list: fwlist-5.15.53-1-pve
-fw.list: fwlist-5.19.0-1-pve
-fw.list: fwlist-5.19-iwlwifi-extra
-fw.list: fwlist-6.1.0-1-pve
-fw.list: fwlist-6.1.10-1-pve
+fw.list: fwlist-5.15.x.y-pve
+fw.list: fwlist-iwlwifi-extra
 fw.list: fwlist-6.2.2-1-pve
 fw.list: fwlist-6.2.6-1-pve
        rm -f $@.tmp $@
        sort -u $^ > $@.tmp
        mv $@.tmp $@
 
+$(ORIG_SRC_TAR): $(BUILDDIR)
+       tar czf $(ORIG_SRC_TAR) --exclude="$(BUILDDIR)/debian" $(BUILDDIR)
+
 $(BUILDDIR): linux-firmware.git/WHENCE dvb-firmware.git/README fw.list
-       rm -rf $(BUILDDIR) $(BUILDDIR).tmp
-       mkdir -p $(BUILDDIR).tmp/lib/firmware
-       cd linux-firmware.git; ./copy-firmware.sh -v ../$(BUILDDIR).tmp/lib/firmware/
-       ./assemble-firmware.pl fw.list $(BUILDDIR).tmp/lib/firmware
-       find $(BUILDDIR).tmp/lib/firmware -empty -type d -delete
-       install -d $(BUILDDIR).tmp/usr/share/doc/pve-firmware
-       cp linux-firmware.git/WHENCE $(BUILDDIR).tmp/usr/share/doc/pve-firmware/README
-       install -d $(BUILDDIR).tmp/usr/share/doc/pve-firmware/licenses
-       cp linux-firmware.git/LICEN[CS]E* $(BUILDDIR).tmp/usr/share/doc/pve-firmware/licenses
+       rm -rf $@ $@.tmp
+       mkdir -p $@.tmp/lib/firmware
+       cp -a debian $@.tmp
+       echo "git clone git://git.proxmox.com/git/pve-firmware.git\\ngit checkout $$(git rev-parse HEAD)" >$@.tmp/debian/SOURCE
+       cd linux-firmware.git; ./copy-firmware.sh -v ../$@.tmp/lib/firmware/
+       ./assemble-firmware.pl fw.list $@.tmp/lib/firmware
+       find $@.tmp/lib/firmware -empty -type d -delete
+       install -d $@.tmp/usr/share/doc/pve-firmware
+       cp linux-firmware.git/WHENCE $@.tmp/usr/share/doc/pve-firmware/README
+       install -d $@.tmp/usr/share/doc/pve-firmware/licenses
+       cp linux-firmware.git/LICEN[CS]E* $@.tmp/usr/share/doc/pve-firmware/licenses
        # we only compress big ones that almost definitively ain't required in the initrd
        # or are so big and unbuyable (netronome...)
-       cd $(BUILDDIR).tmp/lib/firmware; find . -type f \( -name 'i[wb][lt]*' -o -path '*/netronome/*' \) -print0 | xargs -0 -n1 -P0 -- xz -C crc32
-       cd $(BUILDDIR).tmp/lib/firmware; find . -xtype l -print0 | xargs -0 -n1 -P0 -- sh -c 'ln -sf "$$(readlink "$$0").xz" "$$0"; mv "$$0" "$$0.xz"'
-       mv $(BUILDDIR).tmp $(BUILDDIR)
+       cd $@.tmp/lib/firmware; find . -type f \( -name 'i[wb][lt]*' -o -path '*/netronome/*' \) -print0 | xargs -0 -n1 -P0 -- xz -C crc32
+       cd $@.tmp/lib/firmware; find . -xtype l -print0 | xargs -0 -n1 -P0 -- sh -c 'ln -sf "$$(readlink "$$0").xz" "$$0"; mv "$$0" "$$0.xz"'
+       mv $@.tmp $@
 
 # upgrade to current master
 .PHONY: update_modules
@@ -65,9 +70,11 @@ submodule dvb-firmware.git/README linux-firmware.git/WHENCE:
        test -f "linux-firmware.git/WHENCE" || git submodule update --init
 
 .PHONY: upload
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
 upload: $(DEBS)
-       tar cf - $(DEBS) | ssh repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist bullseye
+       tar cf - $(DEBS) | ssh repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
 
 .PHONY: clean
 clean:
-       rm -rf $(BUILDDIR) $(BUILDDIR).tmp fw.list *.deb *.buildinfo *.dsc *.changes
+       rm -rf $(PACKAGE)-[0-9]*/
+       rm -f $(PACKAGE)*.tar* *.deb *.dsc *.changes *.dsc *.buildinfo *.build