Skip to content

Commit b51c623

Browse files
committed
feat: include module version in package version (like RPM)
When building nginx modules with version.yml, the package version now includes both the nginx version and module version: nginx_version+module_version (e.g., 1.29.4+2.5.5) This matches the RPM versioning scheme and ensures that module updates are correctly detected even when the nginx version hasn't changed. The debian/control VERSION placeholder still uses just the nginx version for dependencies like nginx-rVERSION. Also removes debug logging added during troubleshooting.
1 parent 5affb82 commit b51c623

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

assets/build

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ OUTPUT=${OUTPUT-${SOURCES}}
1515
# If a GitHub token is provided, configure netrc/curl for private source access
1616
# Prefer GITHUB_TOKEN, then GITHUB_API_TOKEN, then LASTVERSION_GITHUB_API_TOKEN
1717
GH_TOK="${GITHUB_TOKEN:-${GITHUB_API_TOKEN:-${LASTVERSION_GITHUB_API_TOKEN}}}"
18-
echo "GitHub token detection: GITHUB_TOKEN=${GITHUB_TOKEN:+set} GITHUB_API_TOKEN=${GITHUB_API_TOKEN:+set} LASTVERSION_GITHUB_API_TOKEN=${LASTVERSION_GITHUB_API_TOKEN:+set} GH_TOK=${GH_TOK:+set}"
1918
if [ -n "${GH_TOK}" ]; then
20-
echo "Configuring .netrc for GitHub private repo access..."
2119
# use restrictive umask only for writing secrets, then restore
2220
__OLD_UMASK=$(umask)
2321
umask 077
@@ -369,6 +367,8 @@ build_package() {
369367

370368
cd "${BUILD_ROOT}"
371369

370+
# Track module version separately for combined versioning (like RPM's nginx_version+module_version)
371+
MODULE_VERSION=""
372372
if [[ -f "version.yml" ]]; then
373373
echo "Found version.yml; fetching external module source..."
374374
# shellcheck disable=SC2015
@@ -383,6 +383,7 @@ build_package() {
383383
tar -xzf module.tgz
384384
rm -f module.tgz || true
385385
TAG_NOPREFIX="${TAG#v}"
386+
MODULE_VERSION="${TAG_NOPREFIX}"
386387
if [[ -d "${NAME}-${TAG}" ]] && [[ "${TAG}" != "${TAG_NOPREFIX}" ]] && [[ ! -d "${NAME}-${TAG_NOPREFIX}" ]]; then
387388
mv "${NAME}-${TAG}" "${NAME}-${TAG_NOPREFIX}"
388389
fi
@@ -471,19 +472,26 @@ build_package() {
471472
} > debian/changelog
472473
fi
473474

475+
# Compute package version: nginx_version+module_version (like RPM) when module exists
476+
PACKAGE_VERSION="${UPSTREAM_VERSION}"
477+
if [[ -n "${MODULE_VERSION}" ]]; then
478+
PACKAGE_VERSION="${UPSTREAM_VERSION}+${MODULE_VERSION}"
479+
echo "Module version detected: using combined version ${PACKAGE_VERSION}"
480+
fi
481+
474482
STAMPED=false
475483
if grep -qE 'VERSION|REVISION|SUITE_CODENAME' debian/changelog; then
476-
[[ -n "${UPSTREAM_VERSION}" ]] && sed -i "s/VERSION/${UPSTREAM_VERSION}/g" debian/changelog
484+
[[ -n "${PACKAGE_VERSION}" ]] && sed -i "s/VERSION/${PACKAGE_VERSION}/g" debian/changelog
477485
sed -i "s/REVISION/${REVISION}/g" debian/changelog
478486
sed -i "s/SUITE_CODENAME/${SUITE_CODENAME}/g" debian/changelog
479-
echo "Stamped debian/changelog with VERSION=${UPSTREAM_VERSION}, REVISION=${REVISION}, SUITE_CODENAME=${SUITE_CODENAME}"
487+
echo "Stamped debian/changelog with VERSION=${PACKAGE_VERSION}, REVISION=${REVISION}, SUITE_CODENAME=${SUITE_CODENAME}"
480488
STAMPED=true
481489
fi
482490

483491
# If debian/control uses VERSION as a placeholder anywhere
484492
# (e.g. Provides: nginx-rVERSION, Depends: foo-VERSION, etc.),
485-
# stamp it to the resolved upstream version so this logic is
486-
# reusable beyond nginx-specific packages.
493+
# stamp it to the resolved upstream version (NOT combined version,
494+
# as dependencies like nginx-rVERSION need just the nginx version).
487495
if [[ -n "${UPSTREAM_VERSION}" ]] && [[ -f "debian/control" ]] && grep -q "VERSION" debian/control; then
488496
sed -i "s/VERSION/${UPSTREAM_VERSION}/g" debian/control
489497
echo "Stamped debian/control with VERSION=${UPSTREAM_VERSION}"

0 commit comments

Comments
 (0)