From 0b7f2416caf28ee0b7d0c1b5687287e1f21e8b7b Mon Sep 17 00:00:00 2001 From: purian23 Date: Mon, 15 Dec 2025 23:10:24 -0500 Subject: [PATCH] distro: Bring up Stable --- .github/workflows/run-obs.yml | 47 ++++++++++++++++++++++++++++++--- core/cmd/dms/commands_common.go | 2 +- distro/scripts/obs-upload.sh | 42 +++++++++++++++++++++++++---- 3 files changed, 81 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-obs.yml b/.github/workflows/run-obs.yml index fea9a4a9..1d9bf104 100644 --- a/.github/workflows/run-obs.yml +++ b/.github/workflows/run-obs.yml @@ -7,6 +7,10 @@ on: description: "Package to update (dms, dms-git, or all)" required: false default: "all" + tag_version: + description: "Specific tag version for dms stable (e.g., v1.0.2). Leave empty to auto-detect latest release." + required: false + default: "" rebuild_release: description: "Release number for rebuilds (e.g., 2, 3, 4 to increment spec Release)" required: false @@ -161,16 +165,51 @@ jobs: id: packages run: | if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/tags/ ]]; then + # Tag push event - use the pushed tag echo "packages=dms" >> $GITHUB_OUTPUT VERSION="${GITHUB_REF#refs/tags/}" echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Triggered by tag: $VERSION" elif [[ "${{ github.event_name }}" == "schedule" ]]; then + # Scheduled run - dms-git only echo "packages=${{ needs.check-updates.outputs.packages }}" >> $GITHUB_OUTPUT echo "Triggered by schedule: updating git package" elif [[ -n "${{ github.event.inputs.package }}" ]]; then - # Use filtered packages from check-updates when package="all" and no rebuild requested - if [[ "${{ github.event.inputs.package }}" == "all" ]] && [[ -z "${{ github.event.inputs.rebuild_release }}" ]]; then + # Manual workflow dispatch + + # Determine version for dms stable + if [[ "${{ github.event.inputs.package }}" == "dms" ]]; then + # For explicit dms selection, require tag_version + if [[ -n "${{ github.event.inputs.tag_version }}" ]]; then + VERSION="${{ github.event.inputs.tag_version }}" + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Using specified tag: $VERSION" + else + echo "ERROR: tag_version is required when package=dms" + echo "Please specify a tag version (e.g., v1.0.2) or use package=all for auto-detection" + exit 1 + fi + elif [[ "${{ github.event.inputs.package }}" == "all" ]]; then + # For "all", auto-detect if tag_version not specified + if [[ -n "${{ github.event.inputs.tag_version }}" ]]; then + VERSION="${{ github.event.inputs.tag_version }}" + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Using specified tag: $VERSION" + else + # Auto-detect latest release for "all" + LATEST_TAG=$(curl -s https://api.github.com/repos/AvengeMedia/DankMaterialShell/releases/latest | grep '"tag_name"' | sed 's/.*"tag_name": "\([^"]*\)".*/\1/' || echo "") + if [[ -n "$LATEST_TAG" ]]; then + echo "version=$LATEST_TAG" >> $GITHUB_OUTPUT + echo "Auto-detected latest release: $LATEST_TAG" + else + echo "ERROR: Could not auto-detect latest release" + exit 1 + fi + fi + fi + + # Use filtered packages from check-updates when package="all" and no rebuild/tag specified + if [[ "${{ github.event.inputs.package }}" == "all" ]] && [[ -z "${{ github.event.inputs.rebuild_release }}" ]] && [[ -z "${{ github.event.inputs.tag_version }}" ]]; then echo "packages=${{ needs.check-updates.outputs.packages }}" >> $GITHUB_OUTPUT echo "Manual trigger: all (filtered to: ${{ needs.check-updates.outputs.packages }})" else @@ -186,7 +225,7 @@ jobs: run: | COMMIT_HASH=$(git rev-parse --short=8 HEAD) COMMIT_COUNT=$(git rev-list --count HEAD) - BASE_VERSION=$(grep -oP '^Version:\s+\K[0-9.]+' distro/opensuse/dms.spec | head -1 || echo "0.6.2") + BASE_VERSION=$(grep -oP '^Version:\s+\K[0-9.]+' distro/opensuse/dms.spec | head -1 || echo "1.0.2") NEW_VERSION="${BASE_VERSION}+git${COMMIT_COUNT}.${COMMIT_HASH}" echo "📦 Updating dms-git.spec to version: $NEW_VERSION" @@ -207,7 +246,7 @@ jobs: run: | COMMIT_HASH=$(git rev-parse --short=8 HEAD) COMMIT_COUNT=$(git rev-list --count HEAD) - BASE_VERSION=$(grep -oP '^Version:\s+\K[0-9.]+' distro/opensuse/dms.spec | head -1 || echo "0.6.2") + BASE_VERSION=$(grep -oP '^Version:\s+\K[0-9.]+' distro/opensuse/dms.spec | head -1 || echo "1.0.2") NEW_VERSION="${BASE_VERSION}+git${COMMIT_COUNT}.${COMMIT_HASH}" echo "📦 Updating Debian dms-git changelog to version: $NEW_VERSION" diff --git a/core/cmd/dms/commands_common.go b/core/cmd/dms/commands_common.go index 95ad59fd..ab77d44f 100644 --- a/core/cmd/dms/commands_common.go +++ b/core/cmd/dms/commands_common.go @@ -220,7 +220,7 @@ func getBaseVersion() string { } // Fallback - return "0.6.2" + return "1.0.2" } func startDebugServer() error { diff --git a/distro/scripts/obs-upload.sh b/distro/scripts/obs-upload.sh index a0c94c87..869b106e 100755 --- a/distro/scripts/obs-upload.sh +++ b/distro/scripts/obs-upload.sh @@ -511,7 +511,7 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ -d "distro/debian/$PACKAGE/debian" ]]; t if [[ -n "$URL_PROTOCOL" && -n "$URL_HOST" && -n "$URL_PATH" ]]; then SOURCE_URL="${URL_PROTOCOL}://${URL_HOST}${URL_PATH}" - echo " Downloading source from: $SOURCE_URL" + echo "==> Downloading source from: $SOURCE_URL" if wget -q -O "$TEMP_DIR/source-archive" "$SOURCE_URL" 2>/dev/null || curl -L -f -s -o "$TEMP_DIR/source-archive" "$SOURCE_URL" 2>/dev/null; then @@ -534,9 +534,17 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ -d "distro/debian/$PACKAGE/debian" ]]; t fi SOURCE_DIR=$(cd "$SOURCE_DIR" && pwd) cd "$REPO_ROOT" + if [[ "$(pwd)" != "$REPO_ROOT" ]]; then + echo "ERROR: Failed to return to REPO_ROOT. Expected: $REPO_ROOT, Got: $(pwd)" + exit 1 + fi else - echo "Error: Failed to download source from $SOURCE_URL" - echo "Tried both wget and curl. Please check the URL and network connectivity." + echo "ERROR: Failed to download source from $SOURCE_URL" + echo "Attempted both wget and curl" + echo "Please check:" + echo " 1. URL is accessible: $SOURCE_URL" + echo " 2. _service file has correct version" + echo " 3. GitHub releases are available" exit 1 fi fi @@ -553,7 +561,7 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ -d "distro/debian/$PACKAGE/debian" ]]; t exit 1 fi - echo " Found source directory: $SOURCE_DIR" + echo "==> Found source directory: $SOURCE_DIR" # Vendor Go dependencies for dms-git if [[ "$PACKAGE" == "dms-git" ]] && [[ -d "$SOURCE_DIR/core" ]]; then @@ -712,6 +720,10 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ -d "distro/debian/$PACKAGE/debian" ]]; t TARBALL_BASE=$(basename "$SOURCE_DIR") tar --sort=name --mtime='2000-01-01 00:00:00' --owner=0 --group=0 -czf "$WORK_DIR/$COMBINED_TARBALL" "$TARBALL_BASE" cd "$REPO_ROOT" + if [[ "$(pwd)" != "$REPO_ROOT" ]]; then + echo "ERROR: Failed to return to REPO_ROOT after tarball creation" + exit 1 + fi if [[ "$PACKAGE" == "dms" ]]; then TARBALL_DIR=$(tar -tzf "$WORK_DIR/$COMBINED_TARBALL" 2>/dev/null | head -1 | cut -d'/' -f1) @@ -723,6 +735,10 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ -d "distro/debian/$PACKAGE/debian" ]]; t rm -f "$WORK_DIR/$COMBINED_TARBALL" tar --sort=name --mtime='2000-01-01 00:00:00' --owner=0 --group=0 -czf "$WORK_DIR/$COMBINED_TARBALL" "$TARBALL_BASE" cd "$REPO_ROOT" + if [[ "$(pwd)" != "$REPO_ROOT" ]]; then + echo "ERROR: Failed to return to REPO_ROOT after tarball recreation" + exit 1 + fi fi fi @@ -796,7 +812,14 @@ EOF fi fi -cd "$WORK_DIR" +echo "==> Ensuring we're in the OSC working directory" +cd "$WORK_DIR" || { + echo "ERROR: Cannot cd to WORK_DIR: $WORK_DIR" + echo "DEBUG: Current directory: $(pwd)" + echo "DEBUG: WORK_DIR exists: $(test -d "$WORK_DIR" && echo "yes" || echo "no")" + exit 1 +} +echo "DEBUG: Successfully entered WORK_DIR: $(pwd)" # Server-side cleanup via API echo "==> Cleaning old tarballs from OBS server (prevents downloading 100+ old versions)" @@ -881,6 +904,15 @@ elif [[ "$UPLOAD_OPENSUSE" == true ]]; then fi echo "" +if [[ "$(pwd)" != "$WORK_DIR" ]]; then + echo "ERROR: Lost directory context. Expected: $WORK_DIR, Got: $(pwd)" + cd "$WORK_DIR" || { + echo "FATAL: Cannot recover - unable to cd to WORK_DIR" + exit 1 + } + echo "WARNING: Recovered directory context" +fi + osc addremove 2>&1 | grep -v "Git SCM package" || true SOURCE_TARBALL="${PACKAGE}-source.tar.gz"