diff --git a/.github/workflows/build-openwrt-packages.yml b/.github/workflows/build-openwrt-packages.yml index e75cffd3..b31c9efc 100644 --- a/.github/workflows/build-openwrt-packages.yml +++ b/.github/workflows/build-openwrt-packages.yml @@ -252,10 +252,26 @@ jobs: echo "โœ… Removed telephony and routing from feeds.conf.default" fi + # Determine correct branch based on OpenWrt version + VERSION="${{ env.OPENWRT_VERSION }}" + if [[ "$VERSION" == "SNAPSHOT" ]]; then + BRANCH="master" + elif [[ "$VERSION" =~ ^25\. ]]; then + BRANCH="openwrt-25.12" + elif [[ "$VERSION" =~ ^24\. ]]; then + BRANCH="openwrt-24.10" + elif [[ "$VERSION" =~ ^23\. ]]; then + BRANCH="openwrt-23.05" + else + BRANCH="openwrt-23.05" # fallback + fi + + echo "๐Ÿ“Œ Using branch: $BRANCH for OpenWrt $VERSION" + # Use GitHub mirrors - only essential feeds for SDK - cat > feeds.conf << 'FEEDS' - src-git packages https://github.com/openwrt/packages.git;openwrt-23.05 - src-git luci https://github.com/openwrt/luci.git;openwrt-23.05 + cat > feeds.conf << FEEDS + src-git packages https://github.com/openwrt/packages.git;$BRANCH + src-git luci https://github.com/openwrt/luci.git;$BRANCH FEEDS echo "๐Ÿ“‹ feeds.conf:" @@ -420,9 +436,20 @@ jobs: # OpenWrt package repository base URL VERSION="${{ env.OPENWRT_VERSION }}" ARCH="${{ matrix.arch }}" + PKG_EXT="${{ env.PKG_EXT }}" + + # Skip for RC versions as repos may not be stable + if [[ "$VERSION" =~ -rc ]]; then + echo "โš ๏ธ Skipping dependency download for RC version" + echo "Note: Our SecuBox packages are PKGARCH:=all (scripts only)" + echo "They will be built regardless of dependency availability" + exit 0 + fi + REPO_BASE="https://downloads.openwrt.org/releases/${VERSION}/packages/${ARCH}" echo "Repository: $REPO_BASE" + echo "Package format: .${PKG_EXT}" echo "" # Download problematic dependencies as binaries @@ -430,15 +457,17 @@ jobs: cd dl/luci-deps echo "Downloading LuCI core packages..." - # Try to download lucihttp and cgi-io - curl -sL "${REPO_BASE}/luci/Packages" > packages_luci.txt || true - curl -sL "${REPO_BASE}/packages/Packages" > packages_base.txt || true + # Try to download package index (format depends on version) + if [[ "$PKG_EXT" == "apk" ]]; then + curl -sL "${REPO_BASE}/luci/APKINDEX.tar.gz" > apkindex_luci.tar.gz || true + curl -sL "${REPO_BASE}/packages/APKINDEX.tar.gz" > apkindex_base.tar.gz || true + else + curl -sL "${REPO_BASE}/luci/Packages" > packages_luci.txt || true + curl -sL "${REPO_BASE}/packages/Packages" > packages_base.txt || true + fi - # Extract .ipk URLs (if available) and download - for pkg in lucihttp cgi-io luci-base rpcd; do - echo " Looking for $pkg..." - # This will fail gracefully if packages aren't available - done + # Note: Actual package download logic would go here + # For now, we just note that dependencies exist cd ../.. @@ -472,49 +501,63 @@ jobs: - name: Build packages run: | cd sdk - + + # Detect package format based on OpenWrt version + VERSION="${{ env.OPENWRT_VERSION }}" + if [[ "$VERSION" =~ ^25\. ]] || [[ "$VERSION" == "SNAPSHOT" ]]; then + PKG_EXT="apk" + echo "๐Ÿ“ฆ Building for OpenWrt $VERSION (apk format)" + else + PKG_EXT="ipk" + echo "๐Ÿ“ฆ Building for OpenWrt $VERSION (ipk format)" + fi + + # Export for later steps + echo "PKG_EXT=$PKG_EXT" >> $GITHUB_ENV + + echo "" echo "๐Ÿ”จ Building SecuBox packages..." echo "" - + BUILT=0 FAILED=0 BUILT_LIST="" FAILED_LIST="" - + for pkg in package/luci-app-*/; do [[ -d "$pkg" ]] || continue - + PKG_NAME=$(basename "$pkg") - + echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" echo "๐Ÿ“ฆ Building: $PKG_NAME" echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" - + # Show package contents for debugging echo "๐Ÿ“ Package contents:" ls -la "$pkg" - + # Verify Makefile syntax if ! grep -q "BuildPackage" "${pkg}Makefile"; then echo "โš ๏ธ WARNING: Makefile missing BuildPackage call" fi - + # Build with timeout (10 minutes per package) BUILD_LOG="/tmp/build-${PKG_NAME}.log" # Our packages are PKGARCH:=all (pure scripts), no compilation needed # Try regular build first, fallback to direct packaging if dependencies fail if timeout 600 make package/${PKG_NAME}/compile V=s -j1 > "$BUILD_LOG" 2>&1; then - # Build succeeded, check if .ipk was created - IPK_FILE=$(find bin -name "${PKG_NAME}*.ipk" 2>/dev/null | head -1) + # Build succeeded, check if package was created (.apk or .ipk) + PKG_FILE=$(find bin -name "${PKG_NAME}*.${PKG_EXT}" 2>/dev/null | head -1) - if [[ -n "$IPK_FILE" ]]; then + if [[ -n "$PKG_FILE" ]]; then echo "โœ… Built: $PKG_NAME" - echo " โ†’ $IPK_FILE" + echo " โ†’ $PKG_FILE" BUILT=$((BUILT + 1)) BUILT_LIST="${BUILT_LIST}${PKG_NAME}," else - echo "โš ๏ธ No .ipk generated for $PKG_NAME" + echo "โš ๏ธ No .${PKG_EXT} generated for $PKG_NAME" echo "๐Ÿ“‹ Last 50 lines of build log:" tail -50 "$BUILD_LOG" FAILED=$((FAILED + 1)) @@ -527,14 +570,14 @@ jobs: FAILED=$((FAILED + 1)) FAILED_LIST="${FAILED_LIST}${PKG_NAME}," fi - + echo "" done - + echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" echo "๐Ÿ“Š Build Summary" echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" - echo "โœ… Built: $BUILT packages" + echo "โœ… Built: $BUILT packages (.${PKG_EXT})" echo "โŒ Failed: $FAILED packages" echo "" echo "Built: $BUILT_LIST" @@ -546,31 +589,35 @@ jobs: id: collect run: | echo "๐Ÿ“ฆ Collecting artifacts..." - + + PKG_EXT="${{ env.PKG_EXT }}" + echo "๐Ÿ“ฆ Package format: .${PKG_EXT}" + mkdir -p artifacts/${{ matrix.target }} - - # Find and copy .ipk files - find sdk/bin -name "luci-app-*.ipk" -exec cp {} artifacts/${{ matrix.target }}/ \; 2>/dev/null || true - + + # Find and copy package files (.apk or .ipk) + find sdk/bin -name "luci-app-*.${PKG_EXT}" -exec cp {} artifacts/${{ matrix.target }}/ \; 2>/dev/null || true + # Also collect any SecuBox related packages - find sdk/bin -name "*secubox*.ipk" -exec cp {} artifacts/${{ matrix.target }}/ \; 2>/dev/null || true - - # Count - PKG_COUNT=$(find artifacts/${{ matrix.target }} -name "*.ipk" 2>/dev/null | wc -l) + find sdk/bin -name "*secubox*.${PKG_EXT}" -exec cp {} artifacts/${{ matrix.target }}/ \; 2>/dev/null || true + + # Count packages + PKG_COUNT=$(find artifacts/${{ matrix.target }} -name "*.${PKG_EXT}" 2>/dev/null | wc -l) echo "pkg_count=$PKG_COUNT" >> $GITHUB_OUTPUT - + echo "pkg_ext=$PKG_EXT" >> $GITHUB_OUTPUT + echo "" echo "๐Ÿ“‹ Built packages for ${{ matrix.target }}:" ls -la artifacts/${{ matrix.target }}/ 2>/dev/null || echo "No packages" - + # Create checksums if [[ $PKG_COUNT -gt 0 ]]; then cd artifacts/${{ matrix.target }} - sha256sum *.ipk > SHA256SUMS + sha256sum *.${PKG_EXT} > SHA256SUMS fi - + echo "" - echo "๐Ÿ“ฆ Total: $PKG_COUNT packages" + echo "๐Ÿ“ฆ Total: $PKG_COUNT packages (.${PKG_EXT})" - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -583,7 +630,8 @@ jobs: - name: Build Summary run: | PKG_COUNT="${{ steps.collect.outputs.pkg_count }}" - + PKG_EXT="${{ steps.collect.outputs.pkg_ext }}" + echo "## ๐Ÿ“ฆ Build Results: ${{ matrix.target }}" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY @@ -591,14 +639,16 @@ jobs: echo "| Target | ${{ matrix.description }} |" >> $GITHUB_STEP_SUMMARY echo "| Architecture | ${{ matrix.arch }} |" >> $GITHUB_STEP_SUMMARY echo "| SDK Path | ${{ matrix.sdk_path }} |" >> $GITHUB_STEP_SUMMARY + echo "| OpenWrt Version | ${{ env.OPENWRT_VERSION }} |" >> $GITHUB_STEP_SUMMARY + echo "| Package Format | .$PKG_EXT |" >> $GITHUB_STEP_SUMMARY echo "| Packages Built | $PKG_COUNT |" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - + if [[ "$PKG_COUNT" -gt 0 ]]; then echo "### Built Packages" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY - ls artifacts/${{ matrix.target }}/*.ipk 2>/dev/null | xargs -I{} basename {} | sort + ls artifacts/${{ matrix.target }}/*.$PKG_EXT 2>/dev/null | xargs -I{} basename {} | sort echo '```' >> $GITHUB_STEP_SUMMARY fi diff --git a/CLAUDE.md b/CLAUDE.md index ccb80547..96d09d20 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -144,11 +144,15 @@ Supported architectures: The script automatically: - Downloads and caches the OpenWrt SDK -- Configures feeds (packages, luci) +- Configures feeds (packages, luci) with correct branch for version - Copies your packages to the SDK -- Builds .ipk packages +- Builds packages (.apk for 25.12+, .ipk for older versions) - Collects artifacts in `build//` +**Package Format Support:** +- OpenWrt 25.12+ and SNAPSHOT: `.apk` format (new Alpine-based package manager) +- OpenWrt 24.10 and earlier: `.ipk` format (opkg package manager) + Environment variables: - `OPENWRT_VERSION` - OpenWrt version (default: 24.10.5, also supports: 25.12.0-rc1, 23.05.5, SNAPSHOT) - `SDK_DIR` - SDK directory (default: ./sdk) diff --git a/README.md b/README.md index 47d172f5..2f472396 100644 --- a/README.md +++ b/README.md @@ -496,14 +496,16 @@ packages-x86-64/ ## ๐Ÿ“Š OpenWrt Compatibility -| Version | Status | Notes | -|---------|--------|-------| -| 25.12.0-rc1 | ๐Ÿงช Testing | Latest RC, for testing only | -| 24.10.x | โœ… Supported | **Recommended** (latest stable) | -| 23.05.x | โœ… Supported | Previous stable | -| 22.03.x | โœ… Supported | LTS | -| 21.02.x | โš ๏ธ Partial | End of support | -| SNAPSHOT | โœ… Supported | Unstable, bleeding edge | +| Version | Status | Package Format | Notes | +|---------|--------|----------------|-------| +| 25.12.0-rc1 | ๐Ÿงช Testing | `.apk` | Latest RC, new apk package manager | +| 24.10.x | โœ… Supported | `.ipk` | **Recommended** (latest stable) | +| 23.05.x | โœ… Supported | `.ipk` | Previous stable | +| 22.03.x | โœ… Supported | `.ipk` | LTS | +| 21.02.x | โš ๏ธ Partial | `.ipk` | End of support | +| SNAPSHOT | โœ… Supported | `.apk` | Unstable, bleeding edge | + +**Note:** OpenWrt 25.12+ uses the new Alpine Package Manager (apk) instead of opkg. Our build workflows automatically detect the version and build the appropriate package format. --- diff --git a/secubox-tools/local-build.sh b/secubox-tools/local-build.sh index c737ab26..efc54797 100755 --- a/secubox-tools/local-build.sh +++ b/secubox-tools/local-build.sh @@ -381,10 +381,26 @@ setup_sdk_feeds() { local local_feed_dir="$(pwd)/../local-feed" mkdir -p "$local_feed_dir" + # Determine correct branch based on OpenWrt version + local branch + if [[ "$OPENWRT_VERSION" == "SNAPSHOT" ]]; then + branch="master" + elif [[ "$OPENWRT_VERSION" =~ ^25\. ]]; then + branch="openwrt-25.12" + elif [[ "$OPENWRT_VERSION" =~ ^24\. ]]; then + branch="openwrt-24.10" + elif [[ "$OPENWRT_VERSION" =~ ^23\. ]]; then + branch="openwrt-23.05" + else + branch="openwrt-23.05" # fallback + fi + + print_info "Using branch: $branch for OpenWrt $OPENWRT_VERSION" + # Use GitHub mirrors + local feed cat > feeds.conf << FEEDS -src-git packages https://github.com/openwrt/packages.git;openwrt-23.05 -src-git luci https://github.com/openwrt/luci.git;openwrt-23.05 +src-git packages https://github.com/openwrt/packages.git;$branch +src-git luci https://github.com/openwrt/luci.git;$branch src-link secubox $local_feed_dir FEEDS @@ -625,6 +641,19 @@ build_packages() { cd "$SDK_DIR" + # Detect package format based on OpenWrt version + local pkg_ext + if [[ "$OPENWRT_VERSION" =~ ^25\. ]] || [[ "$OPENWRT_VERSION" == "SNAPSHOT" ]]; then + pkg_ext="apk" + print_info "Building for OpenWrt $OPENWRT_VERSION (apk format)" + else + pkg_ext="ipk" + print_info "Building for OpenWrt $OPENWRT_VERSION (ipk format)" + fi + + # Export for later use + export PKG_EXT="$pkg_ext" + local built=0 local failed=0 local built_list="" @@ -663,16 +692,16 @@ build_packages() { # Build from feed (skip dependency checks for architecture-independent packages) # These packages are just JavaScript/shell scripts - no compilation needed if timeout 600 make "package/feeds/secubox/${pkg_name}/compile" V=s -j1 NO_DEPS=1 > "$build_log" 2>&1; then - # Check if .ipk was created - local ipk_file=$(find bin -name "${pkg_name}*.ipk" 2>/dev/null | head -1) + # Check if package was created (.apk or .ipk) + local pkg_file=$(find bin -name "${pkg_name}*.${pkg_ext}" 2>/dev/null | head -1) - if [[ -n "$ipk_file" ]]; then + if [[ -n "$pkg_file" ]]; then print_success "Built: $pkg_name" - echo " โ†’ $ipk_file" + echo " โ†’ $pkg_file" built=$((built + 1)) built_list="${built_list}${pkg_name}," else - print_warning "No .ipk generated for $pkg_name" + print_warning "No .${pkg_ext} generated for $pkg_name" echo "๐Ÿ“‹ Last 50 lines of build log:" tail -50 "$build_log" failed=$((failed + 1)) @@ -714,14 +743,18 @@ collect_artifacts() { mkdir -p "$BUILD_DIR/$ARCH" - # Find and copy .ipk files - find "$SDK_DIR/bin" -name "luci-app-*.ipk" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true + # Use package extension from build step + local pkg_ext="${PKG_EXT:-ipk}" + print_info "Package format: .${pkg_ext}" + + # Find and copy package files (.apk or .ipk) + find "$SDK_DIR/bin" -name "luci-app-*.${pkg_ext}" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true # Also collect any SecuBox related packages - find "$SDK_DIR/bin" -name "*secubox*.ipk" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true + find "$SDK_DIR/bin" -name "*secubox*.${pkg_ext}" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true # Count - local pkg_count=$(find "$BUILD_DIR/$ARCH" -name "*.ipk" 2>/dev/null | wc -l) + local pkg_count=$(find "$BUILD_DIR/$ARCH" -name "*.${pkg_ext}" 2>/dev/null | wc -l) echo "" print_info "Built packages for $ARCH:" @@ -730,7 +763,7 @@ collect_artifacts() { # Create checksums if [[ $pkg_count -gt 0 ]]; then cd "$BUILD_DIR/$ARCH" - sha256sum ./*.ipk > SHA256SUMS + sha256sum ./*.${pkg_ext} > SHA256SUMS cd - > /dev/null fi