From 1978e674010fc2b41f6c96e0a340342587b84f23 Mon Sep 17 00:00:00 2001 From: purian23 Date: Wed, 26 Nov 2025 23:27:33 -0500 Subject: [PATCH] Update dms-cli for OBS packages --- .github/workflows/run-obs.yml | 13 ++- distro/debian/dms-git/_service | 5 +- distro/debian/dms-git/debian/changelog | 8 +- distro/debian/dms-git/debian/control | 3 +- distro/debian/dms-git/debian/rules | 63 ++++++++----- .../dms-git/debian/source/include-binaries | 2 +- distro/opensuse/_service | 9 +- distro/opensuse/dms-git.spec | 45 +++++++--- distro/scripts/obs-upload.sh | 89 ++++++++++++++----- 9 files changed, 173 insertions(+), 64 deletions(-) diff --git a/.github/workflows/run-obs.yml b/.github/workflows/run-obs.yml index 733e2c42..64504d93 100644 --- a/.github/workflows/run-obs.yml +++ b/.github/workflows/run-obs.yml @@ -188,23 +188,28 @@ jobs: sed -i "s|v[0-9.]*|$VERSION|" "$service" fi done - + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + - name: Install OSC run: | sudo apt-get update sudo apt-get install -y osc - + mkdir -p ~/.config/osc cat > ~/.config/osc/oscrc << EOF [general] apiurl = https://api.opensuse.org - + [https://api.opensuse.org] user = ${{ secrets.OBS_USERNAME }} pass = ${{ secrets.OBS_PASSWORD }} EOF chmod 600 ~/.config/osc/oscrc - + - name: Upload to OBS env: FORCE_REBUILD: ${{ github.event_name == 'workflow_dispatch' && 'true' || '' }} diff --git a/distro/debian/dms-git/_service b/distro/debian/dms-git/_service index 3d6a6791..c4d11c90 100644 --- a/distro/debian/dms-git/_service +++ b/distro/debian/dms-git/_service @@ -1,5 +1,5 @@ - + git https://github.com/AvengeMedia/DankMaterialShell.git @@ -10,7 +10,7 @@ *.tar gz - + diff --git a/distro/debian/dms-git/debian/changelog b/distro/debian/dms-git/debian/changelog index 7579c3a8..14f4ba31 100644 --- a/distro/debian/dms-git/debian/changelog +++ b/distro/debian/dms-git/debian/changelog @@ -1,8 +1,12 @@ -dms-git (0.6.2+git) nightly; urgency=medium +dms-git (0.6.2+git5) nightly; urgency=medium + * Fix debian/rules to use source at root level (native format) + * Remove incorrect dms-git-source subdirectory references + * Fix Build-Depends parsing path issue in obs-upload.sh auto-increment + * Fix Build-Depends parsing in obs-upload.sh for proper dependency extraction * Build dms binary from source for true git version strings * Match Fedora COPR git build behavior * Now shows proper git version (e.g., v0.6.2-11-g12e91534) * Add golang-go and make as build dependencies - -- Avenge Media Fri, 22 Nov 2025 00:00:00 -0500 + -- Avenge Media Wed, 27 Nov 2025 04:15:00 -0500 diff --git a/distro/debian/dms-git/debian/control b/distro/debian/dms-git/debian/control index 197c8360..acd04ee6 100644 --- a/distro/debian/dms-git/debian/control +++ b/distro/debian/dms-git/debian/control @@ -2,7 +2,8 @@ Source: dms-git Section: x11 Priority: optional Maintainer: Avenge Media -Build-Depends: debhelper-compat (= 13) +Build-Depends: debhelper-compat (= 13), + golang-go | golang (>= 2:1.22~) | golang-any Standards-Version: 4.6.2 Homepage: https://github.com/AvengeMedia/DankMaterialShell Vcs-Browser: https://github.com/AvengeMedia/DankMaterialShell diff --git a/distro/debian/dms-git/debian/rules b/distro/debian/dms-git/debian/rules index 3d5cf6fc..c9e61b28 100755 --- a/distro/debian/dms-git/debian/rules +++ b/distro/debian/dms-git/debian/rules @@ -1,31 +1,55 @@ #!/usr/bin/make -f +export DH_VERBOSE = 1 + +# Version info from changelog DEB_VERSION := $(shell dpkg-parsechangelog -S Version) UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed 's/-[^-]*$$//') DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +# Go needs writable directories for cache +export HOME := $(CURDIR)/debian/tmp-home +export GOCACHE := $(CURDIR)/debian/tmp-home/go-cache +export GOMODCACHE := $(CURDIR)/debian/tmp-home/go-mod + +export GOTOOLCHAIN := local + %: dh $@ override_dh_auto_build: + # Create Go cache directories + mkdir -p $(HOME) $(GOCACHE) $(GOMODCACHE) + + # Verify core directory exists (native package format has source at root) + test -d core || (echo "ERROR: core directory not found!" && exit 1) + + # Patch go.mod to use Go 1.24 base version (Debian 13 has 1.23.x, may vary) + sed -i 's/^go 1\.24\.[0-9]*/go 1.24/' core/go.mod + + # Extract version info for embedding + VERSION="$(UPSTREAM_VERSION)" + COMMIT=$$(echo "$(UPSTREAM_VERSION)" | grep -oP '(?<=git)[0-9]+\.[a-f0-9]+' | cut -d. -f2 | head -c8 || echo "unknown") + + # Build dms-cli from source using vendored dependencies + # Architecture mapping: Debian amd64/arm64 -> Makefile amd64/arm64 if [ "$(DEB_HOST_ARCH)" = "amd64" ]; then \ - if [ -f dms-distropkg-amd64.gz ]; then \ - gunzip -c dms-distropkg-amd64.gz > dms; \ - elif [ -f ../SOURCES/dms-distropkg-amd64.gz ]; then \ - gunzip -c ../SOURCES/dms-distropkg-amd64.gz > dms; \ - else \ - echo "ERROR: dms-distropkg-amd64.gz not found!" && exit 1; \ - fi \ + MAKE_ARCH=amd64; \ + BINARY_NAME=dms-linux-amd64; \ elif [ "$(DEB_HOST_ARCH)" = "arm64" ]; then \ - if [ -f dms-distropkg-arm64.gz ]; then \ - gunzip -c dms-distropkg-arm64.gz > dms; \ - elif [ -f ../SOURCES/dms-distropkg-arm64.gz ]; then \ - gunzip -c ../SOURCES/dms-distropkg-arm64.gz > dms; \ - else \ - echo "ERROR: dms-distropkg-arm64.gz not found!" && exit 1; \ - fi \ + MAKE_ARCH=arm64; \ + BINARY_NAME=dms-linux-arm64; \ else \ - echo "Unsupported architecture: $(DEB_HOST_ARCH)" && exit 1; \ + echo "ERROR: Unsupported architecture: $(DEB_HOST_ARCH)" && exit 1; \ + fi; \ + echo "Building with VERSION=$$VERSION COMMIT=$$COMMIT ARCH=$$MAKE_ARCH"; \ + cd core && $(MAKE) GOFLAGS="-mod=vendor" dist ARCH=$$MAKE_ARCH VERSION="$$VERSION" COMMIT="$$COMMIT" + + # Copy binary to expected location + if [ "$(DEB_HOST_ARCH)" = "amd64" ]; then \ + cp core/bin/dms-linux-amd64 dms; \ + elif [ "$(DEB_HOST_ARCH)" = "arm64" ]; then \ + cp core/bin/dms-linux-arm64 dms; \ fi chmod +x dms @@ -36,11 +60,8 @@ override_dh_auto_install: if [ -d quickshell ]; then \ cp -r quickshell/* debian/dms-git/usr/share/quickshell/dms/; \ install -Dm644 quickshell/assets/systemd/dms.service debian/dms-git/usr/lib/systemd/user/dms.service; \ - elif [ -d dms-git-source/quickshell ]; then \ - cp -r dms-git-source/quickshell/* debian/dms-git/usr/share/quickshell/dms/; \ - install -Dm644 dms-git-source/quickshell/assets/systemd/dms.service debian/dms-git/usr/lib/systemd/user/dms.service; \ else \ - echo "ERROR: quickshell directory not found (checked root and dms-git-source/)!" && \ + echo "ERROR: quickshell directory not found!" && \ echo "Contents of current directory:" && ls -la && \ exit 1; \ fi @@ -49,6 +70,8 @@ override_dh_auto_install: debian/dms-git/usr/share/quickshell/dms/distro override_dh_auto_clean: + # Clean up build artifacts rm -f dms - [ ! -d dms-git-source ] || rm -rf dms-git-source + rm -rf core/bin + rm -rf debian/tmp-home dh_auto_clean diff --git a/distro/debian/dms-git/debian/source/include-binaries b/distro/debian/dms-git/debian/source/include-binaries index 77d7423a..c29b655c 100644 --- a/distro/debian/dms-git/debian/source/include-binaries +++ b/distro/debian/dms-git/debian/source/include-binaries @@ -1 +1 @@ -dms-distropkg-amd64.gz +# dms-cli is built from source diff --git a/distro/opensuse/_service b/distro/opensuse/_service index 47192af1..fbafa613 100644 --- a/distro/opensuse/_service +++ b/distro/opensuse/_service @@ -1,16 +1,16 @@ - - + + git https://github.com/AvengeMedia/DankMaterialShell.git master dms-git-source - + *.tar gz - + diff --git a/distro/opensuse/dms-git.spec b/distro/opensuse/dms-git.spec index 629c929f..4002b882 100644 --- a/distro/opensuse/dms-git.spec +++ b/distro/opensuse/dms-git.spec @@ -9,10 +9,10 @@ Summary: DankMaterialShell - Material 3 inspired shell (git nightly) License: MIT URL: https://github.com/AvengeMedia/DankMaterialShell Source0: dms-git-source.tar.gz -Source1: dms-distropkg-amd64.gz -Source2: dms-distropkg-arm64.gz -BuildRequires: gzip +BuildRequires: golang >= 1.22 +BuildRequires: golang-packaging +BuildRequires: git-core BuildRequires: systemd-rpm-macros Requires: (quickshell-git or quickshell) @@ -44,15 +44,40 @@ and fixes. Includes pre-built dms CLI binary and QML shell files. %prep %setup -q -n dms-git-source -%ifarch x86_64 -gunzip -c %{SOURCE1} > dms -%endif -%ifarch aarch64 -gunzip -c %{SOURCE2} > dms -%endif -chmod +x dms +# Verify vendored Go dependencies exist (vendored by obs-upload.sh before packaging) +# OBS build environment has no network access +test -d core/vendor || (echo "ERROR: Go vendor directory missing!" && exit 1) %build +# Create Go cache directories (OBS build env may have restricted HOME) +export HOME=%{_builddir}/go-home +export GOCACHE=%{_builddir}/go-cache +export GOMODCACHE=%{_builddir}/go-mod +mkdir -p $HOME $GOCACHE $GOMODCACHE + +# OBS has no network access, so use local toolchain only +export GOTOOLCHAIN=local + +# Patch go.mod to use base Go version (e.g., go 1.24 instead of go 1.24.6) +sed -i 's/^go 1\.24\.[0-9]*/go 1.24/' core/go.mod + +# Extract version info for embedding in binary +VERSION="%{version}" +COMMIT=$(echo "%{version}" | grep -oP '(?<=git)[0-9]+\.[a-f0-9]+' | cut -d. -f2 | head -c8 || echo "unknown") + +# Build dms-cli from source using vendored dependencies +# Architecture mapping: RPM x86_64/aarch64 -> Makefile amd64/arm64 +cd core +%ifarch x86_64 +make GOFLAGS="-mod=vendor" dist ARCH=amd64 VERSION="$VERSION" COMMIT="$COMMIT" +mv bin/dms-linux-amd64 ../dms +%endif +%ifarch aarch64 +make GOFLAGS="-mod=vendor" dist ARCH=arm64 VERSION="$VERSION" COMMIT="$COMMIT" +mv bin/dms-linux-arm64 ../dms +%endif +cd .. +chmod +x dms %install install -Dm755 dms %{buildroot}%{_bindir}/dms diff --git a/distro/scripts/obs-upload.sh b/distro/scripts/obs-upload.sh index 63f567ea..96547825 100755 --- a/distro/scripts/obs-upload.sh +++ b/distro/scripts/obs-upload.sh @@ -400,9 +400,32 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ -d "distro/debian/$PACKAGE/debian" ]]; t fi echo " Found source directory: $SOURCE_DIR" - + + # Vendor Go dependencies for dms-git + if [[ "$PACKAGE" == "dms-git" ]] && [[ -d "$SOURCE_DIR/core" ]]; then + echo " - Vendoring Go dependencies for offline OBS build..." + cd "$SOURCE_DIR/core" + + if ! command -v go &> /dev/null; then + echo "ERROR: Go not found. Install Go to vendor dependencies." + echo " Install: sudo apt-get install golang-go (Debian/Ubuntu)" + echo " or: sudo dnf install golang (Fedora)" + exit 1 + fi + + # Vendor dependencies + go mod vendor + if [ ! -d "vendor" ]; then + echo "ERROR: Failed to vendor Go dependencies" + exit 1 + fi + + VENDOR_SIZE=$(du -sh vendor | cut -f1) + echo " ✓ Go dependencies vendored ($VENDOR_SIZE)" + cd "$REPO_ROOT" + fi + # Create OpenSUSE-compatible source tarballs BEFORE adding debian/ directory - # (OpenSUSE doesn't need debian/ directory) if [[ "$UPLOAD_OPENSUSE" == true ]] && [[ -f "distro/opensuse/$PACKAGE.spec" ]]; then echo " - Creating OpenSUSE-compatible source tarballs" @@ -518,16 +541,29 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ -d "distro/debian/$PACKAGE/debian" ]]; t TARBALL_SIZE=$(stat -c%s "$WORK_DIR/$COMBINED_TARBALL" 2>/dev/null || stat -f%z "$WORK_DIR/$COMBINED_TARBALL" 2>/dev/null) TARBALL_MD5=$(md5sum "$WORK_DIR/$COMBINED_TARBALL" | cut -d' ' -f1) - BUILD_DEPS="debhelper-compat (= 13)" - if [[ -f "distro/debian/$PACKAGE/debian/control" ]]; then - CONTROL_DEPS=$(sed -n '/^Build-Depends:/,/^[A-Z]/p' "distro/debian/$PACKAGE/debian/control" | \ - sed '/^Build-Depends:/s/^Build-Depends: *//' | \ - sed '/^[A-Z]/d' | \ - tr '\n' ' ' | \ - sed 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[[:space:]]\+/ /g') - if [[ -n "$CONTROL_DEPS" && "$CONTROL_DEPS" != "" ]]; then - BUILD_DEPS="$CONTROL_DEPS" + # Extract Build-Depends from debian/control using awk for proper multi-line parsing + if [[ -f "$REPO_ROOT/distro/debian/$PACKAGE/debian/control" ]]; then + BUILD_DEPS=$(awk ' + /^Build-Depends:/ { + in_build_deps=1; + sub(/^Build-Depends:[[:space:]]*/, ""); + printf "%s", $0; + next; + } + in_build_deps && /^[[:space:]]/ { + sub(/^[[:space:]]+/, " "); + printf "%s", $0; + next; + } + in_build_deps { exit; } + ' "$REPO_ROOT/distro/debian/$PACKAGE/debian/control" | sed 's/[[:space:]]\+/ /g; s/^[[:space:]]*//; s/[[:space:]]*$//') + + # If extraction failed or is empty, use default fallback + if [[ -z "$BUILD_DEPS" ]]; then + BUILD_DEPS="debhelper-compat (= 13)" fi + else + BUILD_DEPS="debhelper-compat (= 13)" fi cat > "$WORK_DIR/$PACKAGE.dsc" << EOF @@ -774,16 +810,29 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ "$SOURCE_FORMAT" == *"native"* ]] && [[ TARBALL_SIZE=$(stat -c%s "$WORK_DIR/$COMBINED_TARBALL" 2>/dev/null || stat -f%z "$WORK_DIR/$COMBINED_TARBALL" 2>/dev/null) TARBALL_MD5=$(md5sum "$WORK_DIR/$COMBINED_TARBALL" | cut -d' ' -f1) - BUILD_DEPS="debhelper-compat (= 13)" - if [[ -f "distro/debian/$PACKAGE/debian/control" ]]; then - CONTROL_DEPS=$(sed -n '/^Build-Depends:/,/^[A-Z]/p' "distro/debian/$PACKAGE/debian/control" | \ - sed '/^Build-Depends:/s/^Build-Depends: *//' | \ - sed '/^[A-Z]/d' | \ - tr '\n' ' ' | \ - sed 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[[:space:]]\+/ /g') - if [[ -n "$CONTROL_DEPS" && "$CONTROL_DEPS" != "" ]]; then - BUILD_DEPS="$CONTROL_DEPS" + # Extract Build-Depends from debian/control using awk for proper multi-line parsing + if [[ -f "$REPO_ROOT/distro/debian/$PACKAGE/debian/control" ]]; then + BUILD_DEPS=$(awk ' + /^Build-Depends:/ { + in_build_deps=1; + sub(/^Build-Depends:[[:space:]]*/, ""); + printf "%s", $0; + next; + } + in_build_deps && /^[[:space:]]/ { + sub(/^[[:space:]]+/, " "); + printf "%s", $0; + next; + } + in_build_deps { exit; } + ' "$REPO_ROOT/distro/debian/$PACKAGE/debian/control" | sed 's/[[:space:]]\+/ /g; s/^[[:space:]]*//; s/[[:space:]]*$//') + + # If extraction failed or is empty, use default fallback + if [[ -z "$BUILD_DEPS" ]]; then + BUILD_DEPS="debhelper-compat (= 13)" fi + else + BUILD_DEPS="debhelper-compat (= 13)" fi cat > "$WORK_DIR/$PACKAGE.dsc" << EOF