Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rules: set version number during build from changelog #41

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
mx-packageinstaller (24.12.05) mx; urgency=medium

* Set version number during build from changelog within debian/rules

-- fehlix <[email protected]> Tue, 31 Dec 2024 15:11:46 -0500

mx-packageinstaller (24.12.04) mx; urgency=medium

* Adjust regex to read binary-packages for current arch only and
Expand Down
21 changes: 20 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@ export QT_SELECT=5
QMAKE_OPTS = DEFINES+=NO_DEBUG_ON_CONSOLE
MAKE_OPTS = QMAKE=qmake-qt5 LRELEASE=lrelease-qt5 QMAKE_OPTS="$(QMAKE_OPTS)"

# Define version.h
VERSION_H = version.h

# Get version from debian/changelog
VERSION := $(shell dpkg-parsechangelog --show-field Version)

override_dh_auto_clean:
dh_auto_clean
rm -f translations/*.qm
rm -f src/translations/*.qm

override_dh_auto_build:
# Rename existing version.h to version.h~
@echo "Renaming existing version.h to version.h~"
@mv -f $(VERSION_H) $(VERSION_H)~ || true
# Create new version.h with version from changelog
@echo "Creating new version.h with version $(VERSION)"
@echo "#define VERSION \"$(VERSION)\"" > $(VERSION_H)
# Build
lrelease translations/*.ts
dh_auto_build -- $(MAKE_OPTS)

Expand All @@ -19,8 +32,14 @@ override_dh_auto_install:
override_dh_shlibdeps:
dh_shlibdeps -- -xvirtualbox-guest-x11 --ignore-missing-info

# Restore original version.h after build
override_dh_auto_clean:
@echo "Restoring original version.h from version.h~"
@mv -f $(VERSION_H)~ $(VERSION_H) || true
dh_auto_clean

%:
dh $@ --no-automatic-dbgsym --parallel
dh $@ --no-automatic-dbgsym --parallel

override_dh_auto_install:
dh_auto_install
Loading