Fix release package version compatibility
This commit is contained in:
@@ -35,67 +35,26 @@ jobs:
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build:
|
||||
name: Builder for ${{ matrix.package_type }} Podkop Plus packages
|
||||
name: Build Podkop Plus release packages
|
||||
runs-on: ubuntu-latest
|
||||
needs: preparation
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { package_type: ipk }
|
||||
- { package_type: apk }
|
||||
steps:
|
||||
- uses: actions/checkout@v5.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build ${{ matrix.package_type }}
|
||||
uses: docker/build-push-action@v6.18.0
|
||||
with:
|
||||
file: ./Dockerfile-${{ matrix.package_type }}
|
||||
context: .
|
||||
tags: podkop-plus:ci-${{ matrix.package_type }}
|
||||
build-args: |
|
||||
PODKOP_VERSION=${{ needs.preparation.outputs.version }}
|
||||
|
||||
- name: Create ${{ matrix.package_type }} Docker container
|
||||
run: docker create --name ${{ matrix.package_type }} podkop-plus:ci-${{ matrix.package_type }}
|
||||
|
||||
- name: Copy files from ${{ matrix.package_type }} Docker container
|
||||
run: |
|
||||
mkdir -p ./bin/${{ matrix.package_type }}
|
||||
docker cp ${{ matrix.package_type }}:/builder/bin/packages/x86_64/utilities/. ./bin/${{ matrix.package_type }}/
|
||||
docker cp ${{ matrix.package_type }}:/builder/bin/packages/x86_64/luci/. ./bin/${{ matrix.package_type }}/
|
||||
|
||||
# IPK uses underscore `_` in filenames, while APK uses only dash `-`.
|
||||
- name: Fix naming difference between build for packages
|
||||
if: matrix.package_type == 'ipk'
|
||||
shell: bash
|
||||
run: |
|
||||
for f in ./bin/${{ matrix.package_type }}/*.${{ matrix.package_type }}; do
|
||||
[ -e "$f" ] || continue
|
||||
base=$(basename "$f")
|
||||
newname=$(echo "$base" | sed 's/_/-/g')
|
||||
mv "$f" "./bin/${{ matrix.package_type }}/$newname"
|
||||
done
|
||||
|
||||
- name: Filter files
|
||||
- name: Build release artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION="${{ needs.preparation.outputs.version }}"
|
||||
|
||||
mkdir -p ./filtered-bin/${{ matrix.package_type }}
|
||||
cp ./bin/${{ matrix.package_type }}/luci-i18n-podkop-plus-ru-*.${{ matrix.package_type }} "./filtered-bin/${{ matrix.package_type }}/luci-i18n-podkop-plus-ru-${VERSION}.${{ matrix.package_type }}"
|
||||
cp ./bin/${{ matrix.package_type }}/podkop-plus-*.${{ matrix.package_type }} ./filtered-bin/${{ matrix.package_type }}/
|
||||
cp ./bin/${{ matrix.package_type }}/luci-app-podkop-plus-*.${{ matrix.package_type }} ./filtered-bin/${{ matrix.package_type }}/
|
||||
|
||||
- name: Remove Docker container
|
||||
run: docker rm ${{ matrix.package_type }}
|
||||
bash ./scripts/build-openwrt-packages-wsl.sh "$VERSION" "$PWD/filtered-bin/release"
|
||||
ls -la "$PWD/filtered-bin/release"
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4.6.2
|
||||
with:
|
||||
name: release-files-${{ needs.preparation.outputs.version }}-${{ matrix.package_type }}
|
||||
path: ./filtered-bin/${{ matrix.package_type }}/*.${{ matrix.package_type }}
|
||||
name: release-files-${{ needs.preparation.outputs.version }}
|
||||
path: ./filtered-bin/release/*
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -110,16 +69,10 @@ jobs:
|
||||
- name: Create release dir
|
||||
run: mkdir -p ./filtered-bin/release
|
||||
|
||||
- name: Download ipk artifacts
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-files-${{ needs.preparation.outputs.version }}-ipk
|
||||
path: ./filtered-bin/release
|
||||
|
||||
- name: Download apk artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-files-${{ needs.preparation.outputs.version }}-apk
|
||||
name: release-files-${{ needs.preparation.outputs.version }}
|
||||
path: ./filtered-bin/release
|
||||
|
||||
- name: Release
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
export type ReleaseVersionCompareResult = -1 | 0 | 1 | null;
|
||||
|
||||
function normalizeReleaseVersion(version: string) {
|
||||
return version.trim().replace(/^v/i, '');
|
||||
return version
|
||||
.trim()
|
||||
.replace(/^v/i, '')
|
||||
.replace(/-r(\d+)$/i, '-$1');
|
||||
}
|
||||
|
||||
function parseReleaseVersion(version: string): number[] | null {
|
||||
|
||||
@@ -3,5 +3,5 @@ export function normalizeCompiledVersion(version: string) {
|
||||
return 'dev';
|
||||
}
|
||||
|
||||
return version;
|
||||
return version.replace(/^(\d+(?:\.\d+)*)-r(\d+)$/i, '$1-$2');
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ describe('compareReleaseVersions', () => {
|
||||
expect(compareReleaseVersions('0.7.14-3', 'v0.7.14-3')).toBe(0);
|
||||
});
|
||||
|
||||
it('treats OpenWrt package release suffix as the same fork release', () => {
|
||||
expect(compareReleaseVersions('0.7.17-4', '0.7.17-r4')).toBe(0);
|
||||
expect(compareReleaseVersions('0.7.17-r4', '0.7.17-4')).toBe(0);
|
||||
});
|
||||
|
||||
it('detects outdated versions', () => {
|
||||
expect(compareReleaseVersions('0.7.14-2', '0.7.14-3')).toBe(-1);
|
||||
});
|
||||
|
||||
@@ -38,6 +38,42 @@ describe('getPodkopVersionRow', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns Latest when latest uses OpenWrt package release suffix', () => {
|
||||
const row = getPodkopVersionRow(
|
||||
makeDiagnosticsSystemInfo({
|
||||
podkop_version: '0.7.17-4',
|
||||
podkop_latest_version: '0.7.17-r4',
|
||||
}),
|
||||
);
|
||||
|
||||
expect(row).toEqual({
|
||||
key: 'Podkop Plus',
|
||||
value: '0.7.17-4',
|
||||
tag: {
|
||||
label: 'Latest',
|
||||
kind: 'success',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('normalizes OpenWrt package release suffix for display', () => {
|
||||
const row = getPodkopVersionRow(
|
||||
makeDiagnosticsSystemInfo({
|
||||
podkop_version: '0.7.17-r4',
|
||||
podkop_latest_version: '0.7.17-4',
|
||||
}),
|
||||
);
|
||||
|
||||
expect(row).toEqual({
|
||||
key: 'Podkop Plus',
|
||||
value: '0.7.17-4',
|
||||
tag: {
|
||||
label: 'Latest',
|
||||
kind: 'success',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('returns Outdated when the current fork release is older', () => {
|
||||
const row = getPodkopVersionRow(
|
||||
makeDiagnosticsSystemInfo({
|
||||
|
||||
+18
-3
@@ -403,12 +403,24 @@ extract_package_version() {
|
||||
podkop-plus_*.apk)
|
||||
printf '%s\n' "$package_name" | sed 's/^podkop-plus_//;s/\.apk$//'
|
||||
;;
|
||||
podkop-plus-*.ipk)
|
||||
printf '%s\n' "$package_name" | sed 's/^podkop-plus-//;s/-[^-]*\.ipk$//'
|
||||
;;
|
||||
podkop-plus-*.apk)
|
||||
printf '%s\n' "$package_name" | sed 's/^podkop-plus-//;s/\.apk$//'
|
||||
;;
|
||||
luci-app-podkop-plus_*.ipk)
|
||||
printf '%s\n' "$package_name" | sed 's/^luci-app-podkop-plus_//;s/_[^_]*\.ipk$//'
|
||||
;;
|
||||
luci-app-podkop-plus_*.apk)
|
||||
printf '%s\n' "$package_name" | sed 's/^luci-app-podkop-plus_//;s/\.apk$//'
|
||||
;;
|
||||
luci-app-podkop-plus-*.ipk)
|
||||
printf '%s\n' "$package_name" | sed 's/^luci-app-podkop-plus-//;s/-[^-]*\.ipk$//'
|
||||
;;
|
||||
luci-app-podkop-plus-*.apk)
|
||||
printf '%s\n' "$package_name" | sed 's/^luci-app-podkop-plus-//;s/\.apk$//'
|
||||
;;
|
||||
zapret_*.ipk)
|
||||
printf '%s\n' "$package_name" | sed 's/^zapret_//;s/_[^_]*\.ipk$//'
|
||||
;;
|
||||
@@ -455,10 +467,10 @@ resolve_podkop_plus_release() {
|
||||
PODKOP_PLUS_RELEASE_TAG="$(printf '%s' "$PODKOP_PLUS_RELEASE_JSON" | jq -r '.tag_name // empty')"
|
||||
[ -n "$PODKOP_PLUS_RELEASE_TAG" ] || fail "Failed to detect the Podkop Plus release tag"
|
||||
|
||||
PODKOP_PLUS_BACKEND_URL="$(printf '%s' "$PODKOP_PLUS_RELEASE_JSON" | jq -r --arg ext "$asset_ext" '.assets[] | select((.name | startswith("podkop-plus_")) and (.name | endswith("." + $ext))) | .browser_download_url' | sed -n '1p')"
|
||||
PODKOP_PLUS_BACKEND_URL="$(printf '%s' "$PODKOP_PLUS_RELEASE_JSON" | jq -r --arg ext "$asset_ext" '.assets[] | select(((.name | startswith("podkop-plus_")) or (.name | startswith("podkop-plus-"))) and (.name | endswith("." + $ext))) | .browser_download_url' | sed -n '1p')"
|
||||
[ -n "$PODKOP_PLUS_BACKEND_URL" ] || fail "The Podkop Plus release does not contain a podkop-plus .$asset_ext package"
|
||||
|
||||
PODKOP_PLUS_APP_URL="$(printf '%s' "$PODKOP_PLUS_RELEASE_JSON" | jq -r --arg ext "$asset_ext" '.assets[] | select((.name | startswith("luci-app-podkop-plus_")) and (.name | endswith("." + $ext))) | .browser_download_url' | sed -n '1p')"
|
||||
PODKOP_PLUS_APP_URL="$(printf '%s' "$PODKOP_PLUS_RELEASE_JSON" | jq -r --arg ext "$asset_ext" '.assets[] | select(((.name | startswith("luci-app-podkop-plus_")) or (.name | startswith("luci-app-podkop-plus-"))) and (.name | endswith("." + $ext))) | .browser_download_url' | sed -n '1p')"
|
||||
[ -n "$PODKOP_PLUS_APP_URL" ] || fail "The Podkop Plus release does not contain a luci-app-podkop-plus .$asset_ext package"
|
||||
|
||||
PODKOP_PLUS_BACKEND_NAME="$(basename "$PODKOP_PLUS_BACKEND_URL")"
|
||||
@@ -469,7 +481,7 @@ resolve_podkop_plus_release() {
|
||||
PODKOP_PLUS_I18N_NAME=""
|
||||
|
||||
if [ "$PODKOP_PLUS_I18N_REQUESTED" -eq 1 ]; then
|
||||
PODKOP_PLUS_I18N_URL="$(printf '%s' "$PODKOP_PLUS_RELEASE_JSON" | jq -r --arg ext "$asset_ext" '.assets[] | select((.name | startswith("luci-i18n-podkop-plus-ru_")) and (.name | endswith("." + $ext))) | .browser_download_url' | sed -n '1p')"
|
||||
PODKOP_PLUS_I18N_URL="$(printf '%s' "$PODKOP_PLUS_RELEASE_JSON" | jq -r --arg ext "$asset_ext" '.assets[] | select(((.name | startswith("luci-i18n-podkop-plus-ru_")) or (.name | startswith("luci-i18n-podkop-plus-ru-"))) and (.name | endswith("." + $ext))) | .browser_download_url' | sed -n '1p')"
|
||||
[ -n "$PODKOP_PLUS_I18N_URL" ] || fail "The Podkop Plus release does not contain a luci-i18n-podkop-plus-ru .$asset_ext package"
|
||||
PODKOP_PLUS_I18N_NAME="$(basename "$PODKOP_PLUS_I18N_URL")"
|
||||
fi
|
||||
@@ -961,6 +973,9 @@ disable_installed_zapret_service() {
|
||||
|
||||
post_install() {
|
||||
rm -f /var/luci-indexcache* /tmp/luci-indexcache*
|
||||
rm -f /tmp/podkop-plus.latest-version.cache
|
||||
rm -f /var/run/podkop-plus/system-info.json
|
||||
rm -f /tmp/podkop-plus/system-info.json
|
||||
[ -x /etc/init.d/rpcd ] && /etc/init.d/rpcd reload >/dev/null 2>&1 || true
|
||||
|
||||
if [ "$PODKOP_WAS_ENABLED" -eq 1 ] && [ -x /etc/init.d/podkop-plus ]; then
|
||||
|
||||
@@ -8,9 +8,11 @@ PODKOP_FORK_RELEASE:=$(or $(PODKOP_FORK_RELEASE),$(word 2,$(subst -, ,$(PODKOP_R
|
||||
PODKOP_COMPILED_VERSION:=$(PODKOP_BASE_VERSION)-$(PODKOP_FORK_RELEASE)
|
||||
PODKOP_APK_VERSION:=$(PODKOP_BASE_VERSION)-r$(PODKOP_FORK_RELEASE)
|
||||
PODKOP_PO_VERSION:=$(if $(filter apk,$(PODKOP_PACKAGE_FORMAT)),$(PODKOP_APK_VERSION),$(PODKOP_COMPILED_VERSION))
|
||||
PODKOP_SDK_VERSION:=$(if $(filter apk,$(PODKOP_PACKAGE_FORMAT)),$(PODKOP_BASE_VERSION),$(PODKOP_COMPILED_VERSION))
|
||||
PODKOP_SDK_RELEASE:=$(if $(filter apk,$(PODKOP_PACKAGE_FORMAT)),$(PODKOP_FORK_RELEASE),)
|
||||
|
||||
PKG_VERSION:=$(PODKOP_BASE_VERSION)
|
||||
PKG_RELEASE:=$(PODKOP_FORK_RELEASE)
|
||||
PKG_VERSION:=$(PODKOP_SDK_VERSION)
|
||||
PKG_RELEASE:=$(PODKOP_SDK_RELEASE)
|
||||
PKG_PO_VERSION:=$(PODKOP_PO_VERSION)
|
||||
|
||||
LUCI_TITLE:=LuCI Podkop Plus app
|
||||
|
||||
@@ -4807,7 +4807,7 @@ function normalizeCompiledVersion(version) {
|
||||
if (version.includes("COMPILED")) {
|
||||
return "dev";
|
||||
}
|
||||
return version;
|
||||
return version.replace(/^(\d+(?:\.\d+)*)-r(\d+)$/i, "$1-$2");
|
||||
}
|
||||
|
||||
// src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts
|
||||
@@ -4946,7 +4946,7 @@ async function runSectionsCheck() {
|
||||
|
||||
// src/helpers/compareReleaseVersions.ts
|
||||
function normalizeReleaseVersion(version) {
|
||||
return version.trim().replace(/^v/i, "");
|
||||
return version.trim().replace(/^v/i, "").replace(/-r(\d+)$/i, "-$1");
|
||||
}
|
||||
function parseReleaseVersion(version) {
|
||||
const normalized = normalizeReleaseVersion(version);
|
||||
|
||||
+4
-2
@@ -6,9 +6,11 @@ PODKOP_RELEASE_VERSION:=$(or $(PODKOP_PACKAGE_VERSION),$(PODKOP_VERSION),0.7.17-
|
||||
PODKOP_BASE_VERSION:=$(or $(PODKOP_BASE_VERSION),$(word 1,$(subst -, ,$(PODKOP_RELEASE_VERSION))))
|
||||
PODKOP_FORK_RELEASE:=$(or $(PODKOP_FORK_RELEASE),$(word 2,$(subst -, ,$(PODKOP_RELEASE_VERSION))),4)
|
||||
PODKOP_COMPILED_VERSION:=$(PODKOP_BASE_VERSION)-$(PODKOP_FORK_RELEASE)
|
||||
PODKOP_SDK_VERSION:=$(if $(filter apk,$(PODKOP_PACKAGE_FORMAT)),$(PODKOP_BASE_VERSION),$(PODKOP_COMPILED_VERSION))
|
||||
PODKOP_SDK_RELEASE:=$(if $(filter apk,$(PODKOP_PACKAGE_FORMAT)),$(PODKOP_FORK_RELEASE),)
|
||||
|
||||
PKG_VERSION:=$(PODKOP_BASE_VERSION)
|
||||
PKG_RELEASE:=$(PODKOP_FORK_RELEASE)
|
||||
PKG_VERSION:=$(PODKOP_SDK_VERSION)
|
||||
PKG_RELEASE:=$(PODKOP_SDK_RELEASE)
|
||||
|
||||
PKG_MAINTAINER:=ushan0v <ushan0v@users.noreply.github.com>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
@@ -5859,6 +5859,30 @@ fetch_latest_podkop_version() {
|
||||
head -n 1
|
||||
}
|
||||
|
||||
normalize_podkop_release_version() {
|
||||
printf '%s\n' "$1" | sed 's/^v//;s/-r\([0-9][0-9]*\)$/-\1/'
|
||||
}
|
||||
|
||||
is_podkop_release_version() {
|
||||
normalize_podkop_release_version "$1" | grep -Eq '^[0-9]+([.][0-9]+)*(-[0-9]+)?$'
|
||||
}
|
||||
|
||||
podkop_latest_version_is_older_than_current() {
|
||||
local latest_version="$1"
|
||||
local latest_normalized current_normalized lowest
|
||||
|
||||
is_podkop_release_version "$latest_version" || return 1
|
||||
is_podkop_release_version "$PODKOP_VERSION" || return 1
|
||||
|
||||
latest_normalized="$(normalize_podkop_release_version "$latest_version")"
|
||||
current_normalized="$(normalize_podkop_release_version "$PODKOP_VERSION")"
|
||||
|
||||
[ "$latest_normalized" != "$current_normalized" ] || return 1
|
||||
|
||||
lowest="$(printf '%s\n%s\n' "$latest_normalized" "$current_normalized" | sort -V | head -n 1)"
|
||||
[ "$lowest" = "$latest_normalized" ]
|
||||
}
|
||||
|
||||
write_podkop_latest_version_cache() {
|
||||
local value="$1"
|
||||
local timestamp="$2"
|
||||
@@ -5909,7 +5933,7 @@ get_podkop_latest_version() {
|
||||
cache_is_recent=1
|
||||
fi
|
||||
|
||||
if [ "$cache_is_recent" -eq 1 ]; then
|
||||
if [ "$cache_is_recent" -eq 1 ] && ! podkop_latest_version_is_older_than_current "$cache_value"; then
|
||||
echo "$cache_value"
|
||||
return 0
|
||||
fi
|
||||
@@ -5926,7 +5950,7 @@ get_podkop_latest_version() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -n "$cache_value" ]; then
|
||||
if [ -n "$cache_value" ] && ! podkop_latest_version_is_older_than_current "$cache_value"; then
|
||||
echo "$cache_value"
|
||||
return 0
|
||||
fi
|
||||
@@ -5973,6 +5997,7 @@ system_info_cache_is_valid() {
|
||||
|
||||
cached_latest="$(jq -r '.podkop_latest_version // "unknown"' "$PODKOP_SYSTEM_INFO_CACHE_FILE" 2>/dev/null)"
|
||||
[ "$cached_latest" = "unknown" ] && return 1
|
||||
podkop_latest_version_is_older_than_current "$cached_latest" && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -800,8 +800,21 @@ verify_apk_metadata() {
|
||||
}
|
||||
|
||||
cleanup_work_dir() {
|
||||
rm -rf "$WORK_DIR/manual"
|
||||
rm -f "$WORK_DIR/ipk-build.log"
|
||||
rm -rf "$WORK_DIR/manual" 2>/dev/null || {
|
||||
if have_passwordless_sudo; then
|
||||
sudo rm -rf "$WORK_DIR/manual"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
rm -f "$WORK_DIR/ipk-build.log" 2>/dev/null || {
|
||||
if have_passwordless_sudo; then
|
||||
sudo rm -f "$WORK_DIR/ipk-build.log"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
sync_artifacts_to_windows() {
|
||||
|
||||
Reference in New Issue
Block a user