Add make sync-version to keep changelog and main.go Version the same. Update docs. Cut 1.1.2-1

This commit is contained in:
Pim van Pelt
2025-06-23 20:56:59 +02:00
parent 686bbe46b0
commit 0d19d50d62
4 changed files with 79 additions and 2 deletions

View File

@ -1,6 +1,6 @@
PROG = govpp-snmp-agentx
.PHONY: build test clean pkg-deb
.PHONY: build test clean pkg-deb sync-version
# Build the binary
build:
@ -17,6 +17,13 @@ clean:
rm -rf debian/.debhelper debian/.gocache debian/go debian/$(PROG) debian/files debian/*.substvars debian/debhelper-build-stamp
rm -f ../$(PROG)_*.deb ../$(PROG)_*.changes ../$(PROG)_*.buildinfo
# Sync version from debian/changelog to main.go
sync-version:
@echo "Syncing version from debian/changelog to main.go..."
@VERSION=$$(head -1 debian/changelog | sed -n 's/.*(\([^)]*\)).*/\1/p'); \
sed -i 's/^const Version = ".*"/const Version = "'"$$VERSION"'"/' src/main.go; \
echo "Updated Version const to: $$VERSION"
# Build Debian package
pkg-deb:
pkg-deb: sync-version
fakeroot dpkg-buildpackage -us -uc -b