Skip to content

[ci] Publish package checksums #149#242

Open
shubhamk0205 wants to merge 6 commits intoopenwisp:masterfrom
shubhamk0205:issues/149-upload-package-checksums
Open

[ci] Publish package checksums #149#242
shubhamk0205 wants to merge 6 commits intoopenwisp:masterfrom
shubhamk0205:issues/149-upload-package-checksums

Conversation

@shubhamk0205
Copy link

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #149

Description of Changes

Implements package checksum publishing to enable package verification.

Changes:

  • Added make package/index in runbuild to generate Packages file with SHA256 checksums
  • Filtered to only include openwisp packages using awk
  • Saved as Packages.sha256.checksum following OpenWRT's standard format

Result:
Users can now verify downloaded packages using the published SHA256 checksums.

Note: No tests added as this is a build script change only.

Screenshot

N/A

Add make package/index to generate Packages file with SHA256 checksums.
Filter to only include openwisp packages and save as Packages.sha256.checksum
following OpenWRT's standard format.

Fixes openwisp#149
@shubhamk0205 shubhamk0205 force-pushed the issues/149-upload-package-checksums branch from 9ef2da4 to 32c5451 Compare December 28, 2025 18:35
@shubhamk0205 shubhamk0205 force-pushed the issues/149-upload-package-checksums branch from 4591a21 to 046744a Compare December 28, 2025 19:39
Ensure usign tool is compiled and installed before running make package/index.
This fixes the 'usign: No such file or directory' error when cache is used.

The usign tool is required for package signing during index generation.
Replace invalid tools/usign/compile target with proper tools/install.
This ensures all required host tools including usign are built before
running make package/index.
@shubhamk0205 shubhamk0205 force-pushed the issues/149-upload-package-checksums branch 4 times, most recently from e8daae4 to ed1f00f Compare December 30, 2025 22:30


Add check for usign binary existence before running make package/index.
If usign is missing from cache, build it using tools/usign/compile.

Also ensures output directory exists before writing checksum file
and uses improved awk filtering for better multi-package support.

Closes openwisp#149
@shubhamk0205 shubhamk0205 force-pushed the issues/149-upload-package-checksums branch from ed1f00f to 49366ad Compare December 30, 2025 23:27
@nemesifier
Copy link
Member

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

Walkthrough

The build script now ensures the usign signing tool exists (building it if missing), generates an unsigned OpenWrt package index (SIGNED_PACKAGES=), and creates an openwisp subdirectory for built packages. The Packages file is filtered to include only openwisp- packages and a Packages.sha256.checksum is produced via awk. Built openwrt/openwisp package output is moved into a versioned destination directory (VERSIONED_DIR), and the latest symlink is recreated to point to that version.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: publishing package checksums in the CI process, directly referencing issue #149.
Description check ✅ Passed The description covers required sections including issue reference, changes made, and results, though test cases section is marked as not applicable for build script changes.
Linked Issues check ✅ Passed The code changes fully implement the objectives from issue #149: generating and publishing SHA256 checksums for packages, enabling users to verify package authenticity.
Out of Scope Changes check ✅ Passed All changes in the runbuild script are directly aligned with implementing package checksum publishing as specified in issue #149; no out-of-scope modifications detected.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
runbuild (1)

64-70: Consider validating the filtered output.

The awk script correctly extracts package stanzas, but there's no verification that:

  1. The input Packages file exists and is readable
  2. Any openwisp packages were found and written to the checksum file

While the earlier make package/index should ensure the Packages file exists, adding validation would make the script more robust and help catch unexpected issues during CI runs.

🔎 Suggested validation
 ' "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/Packages" \
 	>"$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp/Packages.sha256.checksum"
+
+# Verify that checksums were generated
+if [ ! -s "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp/Packages.sha256.checksum" ]; then
+	echo "Error: No openwisp packages found in Packages file"
+	exit 1
+fi
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 746a34c and a848b45.

📒 Files selected for processing (1)
  • runbuild
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Upload Packages
🔇 Additional comments (1)
runbuild (1)

61-61: Remove the SIGNED_PACKAGES= variable; set CONFIG_SIGNED_PACKAGES in .config instead.

The SIGNED_PACKAGES= make variable does not override the CONFIG_SIGNED_PACKAGES Kconfig symbol used by OpenWrt's build system. To generate unsigned package indexes, you must disable signing in the .config file before invoking make package/index, either by:

  • Setting # CONFIG_SIGNED_PACKAGES is not set in .config, or
  • Running make menuconfig and disabling "Signed packages"

The current syntax will not prevent Packages.sig generation if CONFIG_SIGNED_PACKAGES is enabled.

Likely an incorrect or invalid review comment.

- Build tools/install if usign binary is not present in staging_dir/host/bin
- Only builds tools when usign is actually missing (efficient check)
- Fixes 'usign: No such file or directory' error in CI
- Handles both CI_CACHE and non-cache scenarios

The error occurred because make package/index requires the usign binary
to exist even when SIGNED_PACKAGES= is set to skip signing. This is due
to OpenWRT's SHA-512 padding workaround in the Makefile that runs
unconditionally.

Using tools/install instead of tools/usign/compile ensures all tool
dependencies are properly built and avoids 'No rule to make target' errors.
@shubhamk0205 shubhamk0205 force-pushed the issues/149-upload-package-checksums branch from a848b45 to 3c69722 Compare January 4, 2026 11:11
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
runbuild (1)

65-72: Consider adding defensive checks for the Packages file and filtered output.

The awk filtering logic is correct—it captures entire package stanzas from "Package: openwisp-" until the blank line separator. However, consider adding checks to fail early with clear error messages:

  1. Verify the source Packages file exists before filtering
  2. Verify the filtered output is non-empty (at least one openwisp package found)
🔎 Proposed defensive checks
 # Filter Packages file to include only openwisp packages and save as checksum file
+PACKAGES_FILE="$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/Packages"
+if [ ! -f "$PACKAGES_FILE" ]; then
+	echo "ERROR: Packages file not found at $PACKAGES_FILE"
+	exit 1
+fi
+
 mkdir -p "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp"
+CHECKSUM_FILE="$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp/Packages.sha256.checksum"
+
 awk '
 	/^Package: openwisp-/ {flag=1}
 	flag {print}
 	/^$/ {flag=0}
-' "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/Packages" \
-	>"$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp/Packages.sha256.checksum"
+' "$PACKAGES_FILE" > "$CHECKSUM_FILE"
+
+if [ ! -s "$CHECKSUM_FILE" ]; then
+	echo "WARNING: No openwisp packages found in Packages file"
+	exit 1
+fi
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a848b45 and 3c69722.

📒 Files selected for processing (1)
  • runbuild
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: QA-Checks and Tests
🔇 Additional comments (3)
runbuild (3)

62-63: LGTM! Package index generation command is correct.

The make package/index SIGNED_PACKAGES= command correctly generates an unsigned package index. The empty SIGNED_PACKAGES= value explicitly requests unsigned index generation, which aligns with the PR objectives.


74-77: LGTM! Move and symlink operations are correct.

The operations correctly move the openwisp package directory (containing the checksum file) to the versioned directory and update the latest symlink to point to it. The || true on line 76 safely handles the case where the latest symlink doesn't exist yet.


55-60: Remove the usign build (lines 55–60)—the "SHA-512 padding workaround" claim contradicts both line 62 and OpenWrt documentation.

The comment on line 56 claims usign is required for a "SHA-512 padding workaround" even for unsigned package indices, but this contradicts the comment on line 62 which explicitly states "(unsigned - no usign needed)". OpenWrt documentation confirms that unsigned package index generation (with SIGNED_PACKAGES=) does not require usign; usign is only needed if you want to sign the index with a detached .sig file.

Since the index is generated unsigned and the comment on line 62 acknowledges no usign is needed, lines 55–60 waste build time. Either remove this unnecessary tool build, or clarify in the code comments why usign is actually required for your use case.

Likely an incorrect or invalid review comment.

@nemesifier
Copy link
Member

I like the approach, I think this is the right way to do it, but I am not sure why unsign is not available and can't get around to finding the time to test this as there's many other more urgent PRs open waiting to be merged. I hope somebody can help us with this.

Viscous106

This comment was marked as duplicate.

Copy link
Contributor

@Viscous106 Viscous106 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubhamk0205 Overall aproach is good , LGTM. But there are some changes that can help the pr progress I have mentioned them Have a look and tell me what do you think

Comment on lines +55 to +72
# Ensure usign tool is available (required for package index generation)
# Even when generating unsigned indexes, OpenWRT's Makefile needs usign for SHA-512 padding workaround
if [ ! -f staging_dir/host/bin/usign ]; then
echo "usign not found, building tools..."
make -j"$CORES" tools/install || make -j1 V=s tools/install
fi

# Generate package index with checksums (unsigned - no usign needed)
make package/index SIGNED_PACKAGES= V=s

# Filter Packages file to include only openwisp packages and save as checksum file
mkdir -p "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp"
awk '
/^Package: openwisp-/ {flag=1}
flag {print}
/^$/ {flag=0}
' "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/Packages" \
>"$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp/Packages.sha256.checksum"
Copy link
Contributor

@Viscous106 Viscous106 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire usign block and SIGNED_PACKAGES= can be removed once
the CONFIG_SIGNED_PACKAGES fix (that was mentioned in the next one comment by me) is applied.
Also adding defensive checks as suggested by CodeRabbit:

Suggested change
# Ensure usign tool is available (required for package index generation)
# Even when generating unsigned indexes, OpenWRT's Makefile needs usign for SHA-512 padding workaround
if [ ! -f staging_dir/host/bin/usign ]; then
echo "usign not found, building tools..."
make -j"$CORES" tools/install || make -j1 V=s tools/install
fi
# Generate package index with checksums (unsigned - no usign needed)
make package/index SIGNED_PACKAGES= V=s
# Filter Packages file to include only openwisp packages and save as checksum file
mkdir -p "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp"
awk '
/^Package: openwisp-/ {flag=1}
flag {print}
/^$/ {flag=0}
' "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/Packages" \
>"$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp/Packages.sha256.checksum"
# Generate package index with checksums (unsigned)
make package/index V=s
# Filter Packages file to include only openwisp packages
PACKAGES_FILE="$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/Packages"
if [ ! -f "$PACKAGES_FILE" ]; then
echo "ERROR: Packages file not found at $PACKAGES_FILE"
exit 1
fi
mkdir -p "$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp"
CHECKSUM_FILE="$BUILD_DIR/openwrt/bin/packages/$COMPILE_TARGET/openwisp/Packages.sha256.checksum"
awk '
/^Package: openwisp-/ {flag=1}
flag {print}
/^$/ {flag=0}
' "$PACKAGES_FILE" > "$CHECKSUM_FILE"
if [ ! -s "$CHECKSUM_FILE" ]; then
echo "ERROR: No openwisp packages found in Packages file"
exit 1
fi

sed -i '/routing/d' feeds.conf
./scripts/feeds update -a
./scripts/feeds install -a
echo "CONFIG_PACKAGE_openwisp-config=y" >>.config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at this , SIGNED_PACKAGES= on line 63 does not disable signing "make defconfig" sets the CONFIG_SIGNED_PACKAGES=y ,and the openwrt modules checks that value however that is not being changed by your changes . So signing is always triggered regardless of the runbuild changes.What i want to suggest is try using this

Suggested change
echo "CONFIG_PACKAGE_openwisp-config=y" >>.config
echo "# CONFIG_SIGNED_PACKAGES is not set" >> .config
Image

@shubhamk0205
Copy link
Author

@shubhamk0205 Overall aproach is good , LGTM. But there are some changes that can help the pr progress I have mentioned them Have a look and tell me what do you think

Sure , let me see and get back to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci] Upload checksum value for packages

3 participants