firmware/build_patches/openwrt/0022-rules-fix-COMMITCOUNT-...

35 lines
1.3 KiB
Diff
Raw Normal View History

treewide: set PKG_RELEASE automatically Backport support for COMMITCOUNT and AUTORELEASE from OpenWrt. COMMITCOUNT allows to have the PKG_RELEASE calculated automatically based on the number of commits for the package folder. AUTORELEASE will count the number of commits since the last upstream bump. This is relevant for packages with PKG_VERSION or PKG_SOURCE_DATE set, but will not work for us since it assumes the use of certain identifiers in commit titles. COMMITCOUNT works fine for most of our packages, with the following exceptions: * fff-nodewatcher would yield a commit count of 55, while the current PKG_RELEASE is 61. Thus, we do not touch it for now. * Packages that have been renamed will start counting from 1 after the rename, since folder renames are not tracked by git. This will result in descreasing PKG_RELEASE after the change for these packages. However, since moving essentially creates a new package anyway, counting from 1 makes sense conceptually, and PKG_RELEASE is still replaced for these packages. * alfred-json and fff-macnock use upstream code and thus would normally require AUTORELEASE. As discussed above, this will not work for us, so just leave these two untouched. Note that all this is quite irrelevant for the way we use packages currently, as without opkg PKG_RELEASE does not matter to us anyway. So, let's just be happy about not having to bump PKG_RELEASE anymore, while keeping the basic functionality intact. The only package where the PKG_RELEASE is actually used for something is fff-nodewatcher, where the version will be displayed in the Monitoring. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-26 21:42:00 +01:00
From: Paul Spooren <mail@aparcar.org>
Date: Tue, 26 Jan 2021 17:16:36 -1000
Subject: rules: fix COMMITCOUNT logic
The newly added $(COMMITCOUNT) variable was wrongly increased by plus
one. The addition should have been only added to $(AUTORELEASE) as
OpenWrt traditionally starts counting at one rather than zero.
$(AUTORELEASE) counts the commits since the last bump, which is zero on
the version bump commit itself.
This commit increases $(AUTORELEASE) by one while leaving $(COMMITCOUNT)
as is.
The base-files package is the only package using $(COMMITCOUNT) so far
and requires a pseudo commit to keep the PKG_RELEASE correct. A non
functional change (Copyright bump) is done in the next commit.
Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 513f7171a3e509bba54ecc2af2d6259c7cbff221)
diff --git a/rules.mk b/rules.mk
index 7c1f39ccf4023601a7647f4eaf648b6392f480b9..8bfc67fb2cd43e3ce4330fd28b398722858d3493 100644
--- a/rules.mk
+++ b/rules.mk
@@ -417,7 +417,7 @@ $(shell \
if [ -n "$$last_bump" ]; then \
echo -n $$(($$(git rev-list --count "$$last_bump..HEAD" .) + 1)); \
else \
- echo -n $$(($$(git rev-list --count HEAD .) + 1)); \
+ git rev-list --count HEAD .; \
fi; \
else \
secs="$$(($(SOURCE_DATE_EPOCH) % 86400))"; \