Refactor and simplify Makefile
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Kevin Dorner 2022-09-13 05:06:26 +02:00
parent 07d3f19d07
commit 3e9d6db60a
1 changed files with 9 additions and 14 deletions

View File

@ -3,27 +3,22 @@ PKG_VERSION := 3.9.2
PKG_OPSI_RELEASE := 1.0 PKG_OPSI_RELEASE := 1.0
PKG_DEB_RELEASE := 1 PKG_DEB_RELEASE := 1
# Sources and Checksums can be found on https://www.python.org/downloads/windows/ # sources and checksums can be found on https://www.python.org/downloads/windows/
SOURCE_FILENAME := python-$(PKG_VERSION)-amd64.exe SOURCE_FILENAME := python-$(PKG_VERSION)-amd64.exe
SOURCE := https://www.python.org/ftp/python/$(PKG_VERSION)/$(SOURCE_FILENAME) SOURCE := https://www.python.org/ftp/python/$(PKG_VERSION)/$(SOURCE_FILENAME)
CHECKSUM := efb20aa1b648a2baddd949c142d6eb06 CHECKSUM := efb20aa1b648a2baddd949c142d6eb06
default: fetch-sources patch-fields
#Variables below are set automatically
#DEB_CHANGELOG_VERSION := $(shell dpkg-parsechangelog -S Version | sed -rne 's|((-*[^-]+)+)(-[^-]+)|\1|p')
# default target
BUILDDIR := build BUILDDIR := build
$(BUILDDIR): fetch-sources patch-fields $(BUILDDIR):
mkdir -p $(BUILDDIR)/data
create-builddir: fetch-sources: $(BUILDDIR)
[ -d "$(BUILDDIR)/data" ] || mkdir -p $(BUILDDIR)/data
fetch-sources: create-builddir
curl -o $(BUILDDIR)/data/$(SOURCE_FILENAME) $(SOURCE) curl -o $(BUILDDIR)/data/$(SOURCE_FILENAME) $(SOURCE)
echo "$(CHECKSUM) $(BUILDDIR)/data/$(SOURCE_FILENAME)" | md5sum -c echo "$(CHECKSUM) $(BUILDDIR)/data/$(SOURCE_FILENAME)" | md5sum -c
patch-fields: create-builddir patch-fields: $(BUILDDIR)
sed -e "s|@PKG_VERSION@|$(PKG_VERSION)|" \ sed -e "s|@PKG_VERSION@|$(PKG_VERSION)|" \
-e "s|@PKG_OPSI_RELEASE@|$(PKG_OPSI_RELEASE)|" \ -e "s|@PKG_OPSI_RELEASE@|$(PKG_OPSI_RELEASE)|" \
control.in > $(BUILDDIR)/control control.in > $(BUILDDIR)/control
@ -31,7 +26,6 @@ patch-fields: create-builddir
clean: clean:
rm -rf $(BUILDDIR) rm -rf $(BUILDDIR)
install: $(BUILDDIR) install: $(BUILDDIR)
install -Dm644 $(BUILDDIR)/control -t $(DESTDIR)/srv/deploy/install/$(PKG_NAME) install -Dm644 $(BUILDDIR)/control -t $(DESTDIR)/srv/deploy/install/$(PKG_NAME)
install -Dm644 $(BUILDDIR)/data/* -t $(DESTDIR)/srv/deploy/install/$(PKG_NAME)/data install -Dm644 $(BUILDDIR)/data/* -t $(DESTDIR)/srv/deploy/install/$(PKG_NAME)/data
@ -44,7 +38,8 @@ uninstall:
package: package:
dpkg-buildpackage --unsigned-source --unsigned-changes --no-check-builddeps dpkg-buildpackage --unsigned-source --unsigned-changes --no-check-builddeps
package-check: # DEB_CHANGELOG_VERSION := $(shell dpkg-parsechangelog -S Version | sed -rne 's|((-*[^-]+)+)(-[^-]+)|\1|p')
package-check-changelog:
@if [ "$(DEB_CHANGELOG_VERSION)" != "$(PKG_FULL_VERSION)" ]; then \ @if [ "$(DEB_CHANGELOG_VERSION)" != "$(PKG_FULL_VERSION)" ]; then \
echo "Mismatch between debian changelog file and Makefile version"; \ echo "Mismatch between debian changelog file and Makefile version"; \
echo "Debian changelog version: $(DEB_CHANGELOG_VERSION)"; \ echo "Debian changelog version: $(DEB_CHANGELOG_VERSION)"; \
@ -53,4 +48,4 @@ package-check:
fi fi
.PHONY: create-builddir fetch-sources patch-fields clean install uninstall package package-check .PHONY: default fetch-sources patch-fields clean install uninstall package package-check-changelog