1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

distros: Enhance build automation

This commit is contained in:
purian23
2025-12-12 22:41:51 -05:00
parent db2f68e35d
commit 66d22727e9
14 changed files with 715 additions and 590 deletions

View File

@@ -113,6 +113,8 @@ jobs:
name: Upload to OBS name: Upload to OBS
needs: check-updates needs: check-updates
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
if: | if: |
github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_dispatch' ||
needs.check-updates.outputs.has_updates == 'true' needs.check-updates.outputs.has_updates == 'true'
@@ -293,6 +295,35 @@ jobs:
bash distro/scripts/obs-upload.sh "$PACKAGES" "$MESSAGE" bash distro/scripts/obs-upload.sh "$PACKAGES" "$MESSAGE"
fi fi
- name: Commit changelog and spec updates
run: |
# Configure git user for commits
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Check if there are any changes to commit
if git diff --exit-code distro/debian/ distro/opensuse/ >/dev/null 2>&1; then
echo "📋 No changelog or spec changes to commit"
else
# Get list of changed packages for commit message
CHANGED_DEB=$(git diff --name-only distro/debian/ 2>/dev/null | grep 'debian/changelog' | xargs dirname 2>/dev/null | xargs dirname 2>/dev/null | xargs basename 2>/dev/null | tr '\n' ', ' | sed 's/, $//' || echo "")
CHANGED_SUSE=$(git diff --name-only distro/opensuse/ 2>/dev/null | grep '\.spec$' | sed 's|distro/opensuse/||' | sed 's/\.spec$//' | tr '\n' ', ' | sed 's/, $//' || echo "")
CHANGED=""
[ -n "$CHANGED_DEB" ] && CHANGED="Debian: $CHANGED_DEB"
[ -n "$CHANGED_SUSE" ] && [ -n "$CHANGED" ] && CHANGED="$CHANGED | "
[ -n "$CHANGED_SUSE" ] && CHANGED="${CHANGED}OpenSUSE: $CHANGED_SUSE"
PKGS=$(echo "$CHANGED_DEB,$CHANGED_SUSE" | tr ',' '\n' | grep -v '^$' | sort -u | tr '\n' ',' | sed 's/,$//')
echo "📋 Committing changelog and spec updates for: $PKGS"
git add distro/debian/ distro/opensuse/
git commit -m "ci: Auto-update OBS packages [$PKGS]" -m "🤖 Automated by GitHub Actions"
git push
fi
- name: Summary - name: Summary
run: | run: |
echo "### OBS Package Update Complete" >> $GITHUB_STEP_SUMMARY echo "### OBS Package Update Complete" >> $GITHUB_STEP_SUMMARY

View File

@@ -125,14 +125,14 @@ jobs:
fi fi
- name: Upload to PPA - name: Upload to PPA
env:
REBUILD_RELEASE: ${{ github.event.inputs.rebuild_release }}
run: | run: |
PACKAGES="${{ steps.packages.outputs.packages }}" PACKAGES="${{ steps.packages.outputs.packages }}"
REBUILD_RELEASE="${{ github.event.inputs.rebuild_release }}"
# Export to ensure it's available to subprocesses # Build command arguments
if [ -n "$REBUILD_RELEASE" ]; then BUILD_ARGS=()
export REBUILD_RELEASE if [[ -n "$REBUILD_RELEASE" ]]; then
BUILD_ARGS+=("$REBUILD_RELEASE")
echo "✓ Using rebuild release number: ppa$REBUILD_RELEASE" echo "✓ Using rebuild release number: ppa$REBUILD_RELEASE"
fi fi
@@ -143,25 +143,61 @@ jobs:
echo "🔄 Using rebuild release number: ppa$REBUILD_RELEASE" echo "🔄 Using rebuild release number: ppa$REBUILD_RELEASE"
fi fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
REBUILD_RELEASE="$REBUILD_RELEASE" bash distro/scripts/ppa-upload.sh "distro/ubuntu/dms" dms questing bash distro/scripts/ppa-upload.sh dms dms questing "${BUILD_ARGS[@]}"
echo "" echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Uploading dms-git to PPA..." echo "Uploading dms-git to PPA..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
REBUILD_RELEASE="$REBUILD_RELEASE" bash distro/scripts/ppa-upload.sh "distro/ubuntu/dms-git" dms-git questing bash distro/scripts/ppa-upload.sh dms-git dms-git questing "${BUILD_ARGS[@]}"
echo "" echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Uploading dms-greeter to PPA..." echo "Uploading dms-greeter to PPA..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
REBUILD_RELEASE="$REBUILD_RELEASE" bash distro/scripts/ppa-upload.sh "distro/ubuntu/dms-greeter" danklinux questing bash distro/scripts/ppa-upload.sh dms-greeter danklinux questing "${BUILD_ARGS[@]}"
else else
PPA_NAME="$PACKAGES" # Map package to PPA name
case "$PACKAGES" in
dms)
PPA_NAME="dms"
;;
dms-git)
PPA_NAME="dms-git"
;;
dms-greeter)
PPA_NAME="danklinux"
;;
*)
PPA_NAME="$PACKAGES"
;;
esac
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Uploading $PACKAGES to PPA..." echo "Uploading $PACKAGES to PPA..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
REBUILD_RELEASE="$REBUILD_RELEASE" bash distro/scripts/ppa-upload.sh "distro/ubuntu/$PACKAGES" "$PPA_NAME" questing bash distro/scripts/ppa-upload.sh "$PACKAGES" "$PPA_NAME" questing "${BUILD_ARGS[@]}"
fi
- name: Commit changelog updates
run: |
# Configure git user for commits
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Check if there are any changelog changes to commit
if git diff --exit-code distro/ubuntu/ >/dev/null 2>&1; then
echo "📋 No changelog changes to commit"
else
# Get list of changed packages for commit message
CHANGED=$(git diff --name-only distro/ubuntu/ | grep 'debian/changelog' | xargs dirname | xargs -I{} basename {} | tr '\n' ', ' | sed 's/,$//')
echo "📋 Committing changelog updates for: $CHANGED"
git add distro/ubuntu/
git commit -m "ci: Auto-update PPA packages [$CHANGED]" -m "🤖 Automated by GitHub Actions"
git push
fi fi
- name: Summary - name: Summary

6
.gitignore vendored
View File

@@ -104,12 +104,6 @@ go.work.sum
bin/ bin/
# Extracted source trees in Ubuntu package directories
distro/ubuntu/*/dms-git-repo/
distro/ubuntu/*/DankMaterialShell-*/
distro/ubuntu/danklinux/*/dsearch-*/
distro/ubuntu/danklinux/*/dgop-*/
# direnv # direnv
.envrc .envrc
.direnv/ .direnv/

View File

@@ -210,6 +210,7 @@ if [[ "$UPLOAD_OPENSUSE" == true ]] && [[ -f "distro/opensuse/$PACKAGE.spec" ]];
NEXT_RELEASE=$((BASE_RELEASE + 1)) NEXT_RELEASE=$((BASE_RELEASE + 1))
echo " - Detected rebuild of same version $NEW_VERSION (release $OLD_RELEASE -> $NEXT_RELEASE)" echo " - Detected rebuild of same version $NEW_VERSION (release $OLD_RELEASE -> $NEXT_RELEASE)"
sed -i "s/^Release:[[:space:]]*${NEW_RELEASE}%{?dist}/Release: ${NEXT_RELEASE}%{?dist}/" "$WORK_DIR/$PACKAGE.spec" sed -i "s/^Release:[[:space:]]*${NEW_RELEASE}%{?dist}/Release: ${NEXT_RELEASE}%{?dist}/" "$WORK_DIR/$PACKAGE.spec"
cp "$WORK_DIR/$PACKAGE.spec" "$REPO_ROOT/distro/opensuse/$PACKAGE.spec"
else else
echo " - Detected same version $NEW_VERSION (release $OLD_RELEASE). Not a manual run, skipping update." echo " - Detected same version $NEW_VERSION (release $OLD_RELEASE). Not a manual run, skipping update."
# For automated runs with no version change, we should stop here to avoid unnecessary rebuilds # For automated runs with no version change, we should stop here to avoid unnecessary rebuilds
@@ -223,6 +224,7 @@ if [[ "$UPLOAD_OPENSUSE" == true ]] && [[ -f "distro/opensuse/$PACKAGE.spec" ]];
fi fi
else else
echo " - New version detected: $OLD_VERSION -> $NEW_VERSION (keeping release $NEW_RELEASE)" echo " - New version detected: $OLD_VERSION -> $NEW_VERSION (keeping release $NEW_RELEASE)"
cp "$WORK_DIR/$PACKAGE.spec" "$REPO_ROOT/distro/opensuse/$PACKAGE.spec"
fi fi
else else
echo " - First upload to OBS (no previous spec found)" echo " - First upload to OBS (no previous spec found)"
@@ -768,6 +770,7 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ "$SOURCE_FORMAT" == *"native"* ]] && [[
fi fi
} >"$TEMP_CHANGELOG" } >"$TEMP_CHANGELOG"
cp "$TEMP_CHANGELOG" "$SOURCE_CHANGELOG" cp "$TEMP_CHANGELOG" "$SOURCE_CHANGELOG"
cp "$TEMP_CHANGELOG" "$REPO_CHANGELOG"
rm -f "$TEMP_CHANGELOG" rm -f "$TEMP_CHANGELOG"
CHANGELOG_VERSION="$NEW_VERSION" CHANGELOG_VERSION="$NEW_VERSION"
@@ -853,6 +856,7 @@ if [[ "$UPLOAD_DEBIAN" == true ]] && [[ "$SOURCE_FORMAT" == *"native"* ]] && [[
fi fi
} >"$TEMP_CHANGELOG" } >"$TEMP_CHANGELOG"
cp "$TEMP_CHANGELOG" "$EXPECTED_DIR/debian/changelog" cp "$TEMP_CHANGELOG" "$EXPECTED_DIR/debian/changelog"
cp "$TEMP_CHANGELOG" "$REPO_CHANGELOG"
rm -f "$TEMP_CHANGELOG" rm -f "$TEMP_CHANGELOG"
fi fi
fi fi

View File

@@ -36,7 +36,6 @@ fi
PACKAGE_DIR="$1" PACKAGE_DIR="$1"
UBUNTU_SERIES="${2:-noble}" UBUNTU_SERIES="${2:-noble}"
# Validate package directory
if [ ! -d "$PACKAGE_DIR" ]; then if [ ! -d "$PACKAGE_DIR" ]; then
error "Package directory not found: $PACKAGE_DIR" error "Package directory not found: $PACKAGE_DIR"
exit 1 exit 1
@@ -47,21 +46,28 @@ if [ ! -d "$PACKAGE_DIR/debian" ]; then
exit 1 exit 1
fi fi
# Get absolute path
PACKAGE_DIR=$(cd "$PACKAGE_DIR" && pwd) PACKAGE_DIR=$(cd "$PACKAGE_DIR" && pwd)
PACKAGE_NAME=$(basename "$PACKAGE_DIR") PACKAGE_NAME=$(basename "$PACKAGE_DIR")
PACKAGE_PARENT=$(dirname "$PACKAGE_DIR") PACKAGE_PARENT=$(dirname "$PACKAGE_DIR")
# Create temporary working directory (like OBS) # Choose temp directory: use /tmp in CI, ~/tmp locally (keeps artifacts out of repo)
TEMP_WORK_DIR=$(mktemp -d -t ppa_build_work_XXXXXX) if [[ -n "${GITHUB_ACTIONS:-}" ]] || [[ -n "${CI:-}" ]]; then
trap 'rm -rf "$TEMP_WORK_DIR"' EXIT TEMP_BASE="/tmp"
else
TEMP_BASE="$HOME/tmp"
mkdir -p "$TEMP_BASE"
fi
TEMP_WORK_DIR=$(mktemp -d "$TEMP_BASE/ppa_build_work_XXXXXX")
# Only auto-cleanup if not called from ppa-upload.sh (it will clean up after upload)
if [[ -z "${PPA_UPLOAD_SCRIPT:-}" ]]; then
trap 'rm -rf "$TEMP_WORK_DIR"' EXIT
fi
info "Building source package for: $PACKAGE_NAME" info "Building source package for: $PACKAGE_NAME"
info "Package directory: $PACKAGE_DIR" info "Package directory: $PACKAGE_DIR"
info "Working directory: $TEMP_WORK_DIR" info "Working directory: $TEMP_WORK_DIR"
info "Target Ubuntu series: $UBUNTU_SERIES" info "Target Ubuntu series: $UBUNTU_SERIES"
# Check for required files
REQUIRED_FILES=( REQUIRED_FILES=(
"debian/control" "debian/control"
"debian/rules" "debian/rules"
@@ -87,14 +93,12 @@ fi
success "GPG key found" success "GPG key found"
# Check if debuild is installed
if ! command -v debuild &>/dev/null; then if ! command -v debuild &>/dev/null; then
error "debuild not found. Install devscripts:" error "debuild not found. Install devscripts:"
error " sudo dnf install devscripts" error " sudo dnf install devscripts"
exit 1 exit 1
fi fi
# Extract package info from changelog
cd "$PACKAGE_DIR" cd "$PACKAGE_DIR"
CHANGELOG_VERSION=$(dpkg-parsechangelog -S Version) CHANGELOG_VERSION=$(dpkg-parsechangelog -S Version)
SOURCE_NAME=$(dpkg-parsechangelog -S Source) SOURCE_NAME=$(dpkg-parsechangelog -S Source)
@@ -102,7 +106,6 @@ SOURCE_NAME=$(dpkg-parsechangelog -S Source)
info "Source package: $SOURCE_NAME" info "Source package: $SOURCE_NAME"
info "Version: $CHANGELOG_VERSION" info "Version: $CHANGELOG_VERSION"
# Check if version targets correct Ubuntu series
CHANGELOG_SERIES=$(dpkg-parsechangelog -S Distribution) CHANGELOG_SERIES=$(dpkg-parsechangelog -S Distribution)
if [ "$CHANGELOG_SERIES" != "$UBUNTU_SERIES" ] && [ "$CHANGELOG_SERIES" != "UNRELEASED" ]; then if [ "$CHANGELOG_SERIES" != "$UBUNTU_SERIES" ] && [ "$CHANGELOG_SERIES" != "UNRELEASED" ]; then
warn "Changelog targets '$CHANGELOG_SERIES' but building for '$UBUNTU_SERIES'" warn "Changelog targets '$CHANGELOG_SERIES' but building for '$UBUNTU_SERIES'"
@@ -125,18 +128,18 @@ elif [[ -z "${GITHUB_ACTIONS:-}" ]] && [[ -z "${CI:-}" ]]; then
echo "==> Local/manual run detected (not in CI)" echo "==> Local/manual run detected (not in CI)"
fi fi
# Copy package to temp working directory
info "Copying package to working directory..." info "Copying package to working directory..."
cp -r "$PACKAGE_DIR" "$TEMP_WORK_DIR/" cp -r "$PACKAGE_DIR" "$TEMP_WORK_DIR/"
WORK_PACKAGE_DIR="$TEMP_WORK_DIR/$PACKAGE_NAME" WORK_PACKAGE_DIR="$TEMP_WORK_DIR/$PACKAGE_NAME"
# Detect package type and update version automatically if [ -f "$WORK_PACKAGE_DIR/debian/files" ]; then
cd "$WORK_PACKAGE_DIR" info "Removing old debian/files build artifact..."
rm -f "$WORK_PACKAGE_DIR/debian/files"
fi
# Function to get latest tag from GitHub cd "$WORK_PACKAGE_DIR"
get_latest_tag() { get_latest_tag() {
local repo="$1" local repo="$1"
# Try GitHub API first (faster)
if command -v curl &>/dev/null; then if command -v curl &>/dev/null; then
LATEST_TAG=$(curl -s "https://api.github.com/repos/$repo/releases/latest" 2>/dev/null | grep '"tag_name":' | sed 's/.*"tag_name": "\(.*\)".*/\1/' | head -1) LATEST_TAG=$(curl -s "https://api.github.com/repos/$repo/releases/latest" 2>/dev/null | grep '"tag_name":' | sed 's/.*"tag_name": "\(.*\)".*/\1/' | head -1)
if [ -n "$LATEST_TAG" ]; then if [ -n "$LATEST_TAG" ]; then
@@ -144,8 +147,7 @@ get_latest_tag() {
return return
fi fi
fi fi
# Fallback: clone and get latest tag TEMP_REPO=$(mktemp -d "$TEMP_BASE/ppa_tag_XXXXXX")
TEMP_REPO=$(mktemp -d)
if git clone --depth=1 --quiet "https://github.com/$repo.git" "$TEMP_REPO" 2>/dev/null; then if git clone --depth=1 --quiet "https://github.com/$repo.git" "$TEMP_REPO" 2>/dev/null; then
LATEST_TAG=$(cd "$TEMP_REPO" && git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "") LATEST_TAG=$(cd "$TEMP_REPO" && git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "")
rm -rf "$TEMP_REPO" rm -rf "$TEMP_REPO"
@@ -153,27 +155,21 @@ get_latest_tag() {
fi fi
} }
# Detect if package is git-based
IS_GIT_PACKAGE=false IS_GIT_PACKAGE=false
GIT_REPO="" GIT_REPO=""
SOURCE_DIR="" SOURCE_DIR=""
# Check package name for -git suffix
if [[ "$PACKAGE_NAME" == *"-git" ]]; then if [[ "$PACKAGE_NAME" == *"-git" ]]; then
IS_GIT_PACKAGE=true IS_GIT_PACKAGE=true
fi fi
# Check rules file for git clone patterns and extract repo
if grep -q "git clone" debian/rules 2>/dev/null; then if grep -q "git clone" debian/rules 2>/dev/null; then
IS_GIT_PACKAGE=true IS_GIT_PACKAGE=true
# Extract GitHub repo URL from rules
GIT_URL=$(grep -o "git clone.*https://github.com/[^/]*/[^/]*\.git" debian/rules 2>/dev/null | head -1 | sed 's/.*github\.com\///' | sed 's/\.git.*//' || echo "") GIT_URL=$(grep -o "git clone.*https://github.com/[^/]*/[^/]*\.git" debian/rules 2>/dev/null | head -1 | sed 's/.*github\.com\///' | sed 's/\.git.*//' || echo "")
if [ -n "$GIT_URL" ]; then if [ -n "$GIT_URL" ]; then
GIT_REPO="$GIT_URL" GIT_REPO="$GIT_URL"
fi fi
fi fi
# Special handling for known packages
case "$PACKAGE_NAME" in case "$PACKAGE_NAME" in
dms-git) dms-git)
IS_GIT_PACKAGE=true IS_GIT_PACKAGE=true
@@ -182,272 +178,27 @@ dms-git)
;; ;;
dms) dms)
GIT_REPO="AvengeMedia/DankMaterialShell" GIT_REPO="AvengeMedia/DankMaterialShell"
info "Downloading pre-built binaries and source for dms..."
# Get version from changelog (remove ppa suffix for both quilt and native formats)
# Native: 0.5.2ppa1 -> 0.5.2, Quilt: 0.5.2-1ppa1 -> 0.5.2
VERSION=$(dpkg-parsechangelog -S Version | sed 's/-[^-]*$//' | sed 's/ppa[0-9]*$//')
# Download amd64 binary (will be included in source package)
if [ ! -f "dms-distropkg-amd64.gz" ]; then
info "Downloading dms binary for amd64..."
if wget -O dms-distropkg-amd64.gz "https://github.com/AvengeMedia/DankMaterialShell/releases/download/v${VERSION}/dms-distropkg-amd64.gz"; then
success "amd64 binary downloaded"
else
error "Failed to download dms-distropkg-amd64.gz"
exit 1
fi
fi
# Download source tarball for QML files
if [ ! -f "dms-source.tar.gz" ]; then
info "Downloading dms source for QML files..."
if wget -O dms-source.tar.gz "https://github.com/AvengeMedia/DankMaterialShell/archive/refs/tags/v${VERSION}.tar.gz"; then
success "source tarball downloaded"
else
error "Failed to download dms-source.tar.gz"
exit 1
fi
fi
;; ;;
dms-greeter) dms-greeter)
GIT_REPO="AvengeMedia/DankMaterialShell" GIT_REPO="AvengeMedia/DankMaterialShell"
info "Downloading source for dms-greeter..."
VERSION=$(dpkg-parsechangelog -S Version | sed 's/-[^-]*$//' | sed 's/ppa[0-9]*$//')
if [ ! -f "dms-greeter-source.tar.gz" ]; then
info "Downloading dms-greeter source..."
if wget -O dms-greeter-source.tar.gz "https://github.com/AvengeMedia/DankMaterialShell/archive/refs/tags/v${VERSION}.tar.gz"; then
success "source tarball downloaded"
else
error "Failed to download dms-greeter-source.tar.gz"
exit 1
fi
fi
;; ;;
danksearch) danksearch)
# danksearch uses pre-built binary from releases
GIT_REPO="AvengeMedia/danksearch" GIT_REPO="AvengeMedia/danksearch"
;; ;;
dgop) dgop)
# dgop uses pre-built binary from releases
GIT_REPO="AvengeMedia/dgop" GIT_REPO="AvengeMedia/dgop"
;; ;;
esac esac
# Handle git packages # Handle stable packages - update changelog FIRST before downloads
if [ "$IS_GIT_PACKAGE" = true ] && [ -n "$GIT_REPO" ]; then if [ "$IS_GIT_PACKAGE" = false ] && [ -n "$GIT_REPO" ]; then
info "Detected git package: $PACKAGE_NAME"
# Determine source directory name
if [ -z "$SOURCE_DIR" ]; then
# Default: use package name without -git suffix + -source or -repo
BASE_NAME=$(echo "$PACKAGE_NAME" | sed 's/-git$//')
if [ -d "${BASE_NAME}-source" ] 2>/dev/null; then
SOURCE_DIR="${BASE_NAME}-source"
elif [ -d "${BASE_NAME}-repo" ] 2>/dev/null; then
SOURCE_DIR="${BASE_NAME}-repo"
elif [ -d "$BASE_NAME" ] 2>/dev/null; then
SOURCE_DIR="$BASE_NAME"
else
SOURCE_DIR="${BASE_NAME}-source"
fi
fi
# Always clone fresh source to get latest commit info
info "Cloning $GIT_REPO from GitHub (getting latest commit info)..."
TEMP_CLONE=$(mktemp -d)
if git clone "https://github.com/$GIT_REPO.git" "$TEMP_CLONE"; then
# Get git commit info from fresh clone
GIT_COMMIT_HASH=$(cd "$TEMP_CLONE" && git rev-parse --short HEAD)
GIT_COMMIT_COUNT=$(cd "$TEMP_CLONE" && git rev-list --count HEAD)
# Get upstream version from latest git tag (e.g., 0.2.1)
# Sort all tags by version and get the latest one (not just the one reachable from HEAD)
UPSTREAM_VERSION=$(cd "$TEMP_CLONE" && git tag -l "v*" | sed 's/^v//' | sort -V | tail -1)
if [ -z "$UPSTREAM_VERSION" ]; then
# Fallback: try without v prefix
UPSTREAM_VERSION=$(cd "$TEMP_CLONE" && git tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -1)
fi
if [ -z "$UPSTREAM_VERSION" ]; then
# Last resort: use git describe
UPSTREAM_VERSION=$(cd "$TEMP_CLONE" && git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.1")
fi
# Verify we got valid commit info
if [ -z "$GIT_COMMIT_COUNT" ] || [ "$GIT_COMMIT_COUNT" = "0" ]; then
error "Failed to get commit count from $GIT_REPO"
rm -rf "$TEMP_CLONE"
exit 1
fi
if [ -z "$GIT_COMMIT_HASH" ]; then
error "Failed to get commit hash from $GIT_REPO"
rm -rf "$TEMP_CLONE"
exit 1
fi
success "Got commit info: $GIT_COMMIT_COUNT ($GIT_COMMIT_HASH), upstream: $UPSTREAM_VERSION"
# Update changelog with git commit info
info "Updating changelog with git commit info..."
# Format: 0.2.1+git705.fdbb86appa1
# Check if we're rebuilding the same commit (increment PPA number if so)
BASE_VERSION="${UPSTREAM_VERSION}+git${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}"
CURRENT_VERSION=$(dpkg-parsechangelog -S Version 2>/dev/null || echo "")
# Use REBUILD_RELEASE if provided, otherwise auto-increment
if [[ -n "${REBUILD_RELEASE:-}" ]]; then
PPA_NUM=$REBUILD_RELEASE
info "Using REBUILD_RELEASE=$REBUILD_RELEASE for PPA number"
else
PPA_NUM=1
# If current version matches the base version, increment PPA number
# Escape special regex characters in BASE_VERSION for pattern matching
ESCAPED_BASE=$(echo "$BASE_VERSION" | sed 's/\./\\./g' | sed 's/+/\\+/g')
if [[ "$CURRENT_VERSION" =~ ^${ESCAPED_BASE}ppa([0-9]+)$ ]]; then
PPA_NUM=$((BASH_REMATCH[1] + 1))
if [[ "$IS_MANUAL" == true ]]; then
info "Detected rebuild of same commit (current: $CURRENT_VERSION), incrementing PPA number to $PPA_NUM"
else
info "Detected rebuild of same commit (current: $CURRENT_VERSION). Not a manual run, skipping."
success "No changes needed (commit matches)."
exit 0
fi
else
info "New commit or first build, using PPA number $PPA_NUM"
fi
fi
NEW_VERSION="${BASE_VERSION}ppa${PPA_NUM}"
# Use sed to update changelog (non-interactive, faster)
# Get current changelog content - find the next package header line (starts with package name)
# Skip the first entry entirely by finding the second occurrence of the package name at start of line
OLD_ENTRY_START=$(grep -n "^${SOURCE_NAME} (" debian/changelog | sed -n '2p' | cut -d: -f1)
if [ -n "$OLD_ENTRY_START" ]; then
# Found second entry, use everything from there
CHANGELOG_CONTENT=$(tail -n +"$OLD_ENTRY_START" debian/changelog)
else
# No second entry found, changelog will only have new entry
CHANGELOG_CONTENT=""
fi
# Create new changelog entry with proper format
CHANGELOG_ENTRY="${SOURCE_NAME} (${NEW_VERSION}) ${UBUNTU_SERIES}; urgency=medium
* Git snapshot (commit ${GIT_COMMIT_COUNT}: ${GIT_COMMIT_HASH})
-- Avenge Media <AvengeMedia.US@gmail.com> $(date -R)"
# Write new changelog (new entry, blank line, then old entries)
echo "$CHANGELOG_ENTRY" >debian/changelog
if [ -n "$CHANGELOG_CONTENT" ]; then
echo "" >>debian/changelog
echo "$CHANGELOG_CONTENT" >>debian/changelog
fi
success "Version updated to $NEW_VERSION"
# Now clone to source directory (without .git for inclusion in package)
rm -rf "$SOURCE_DIR"
cp -r "$TEMP_CLONE" "$SOURCE_DIR"
# Save version info for dms-git build process
if [ "$PACKAGE_NAME" = "dms-git" ]; then
info "Saving version info to .dms-version for build process..."
echo "VERSION=${UPSTREAM_VERSION}+git${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}" >"$SOURCE_DIR/.dms-version"
echo "COMMIT=${GIT_COMMIT_HASH}" >>"$SOURCE_DIR/.dms-version"
success "Version info saved: ${UPSTREAM_VERSION}+git${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}"
# Vendor Go dependencies (Launchpad has no internet access)
info "Vendoring Go dependencies for offline build..."
cd "$SOURCE_DIR/core"
# Create vendor directory with all dependencies
go mod vendor
if [ ! -d "vendor" ]; then
error "Failed to vendor Go dependencies"
exit 1
fi
success "Go dependencies vendored successfully"
cd "$PACKAGE_DIR"
fi
rm -rf "$SOURCE_DIR/.git"
rm -rf "$TEMP_CLONE"
# Vendor Rust dependencies for packages that need it
if false; then
# No current packages need Rust vendoring
if [ -f "$SOURCE_DIR/Cargo.toml" ]; then
info "Vendoring Rust dependencies (Launchpad has no internet access)..."
cd "$SOURCE_DIR"
# Clean up any existing vendor directory and .orig files
# (prevents cargo from including .orig files in checksums)
rm -rf vendor .cargo
find . -type f -name "*.orig" -exec rm -f {} + || true
# Download all dependencies (crates.io + git repos) to vendor/
# cargo vendor outputs the config to stderr, capture it
mkdir -p .cargo
cargo vendor 2>&1 | awk '
/^\[source\.crates-io\]/ { printing=1 }
printing { print }
/^directory = "vendor"$/ { exit }
' >.cargo/config.toml
# Verify vendor directory was created
if [ ! -d "vendor" ]; then
error "Failed to vendor dependencies"
exit 1
fi
# Verify config was created
if [ ! -s .cargo/config.toml ]; then
error "Failed to create cargo config"
exit 1
fi
# CRITICAL: Remove ALL .orig files from vendor directory
# These break cargo checksums when dh_clean tries to use them
info "Cleaning .orig files from vendor directory..."
find vendor -type f -name "*.orig" -exec rm -fv {} + || true
find vendor -type f -name "*.rej" -exec rm -fv {} + || true
# Verify no .orig files remain
ORIG_COUNT=$(find vendor -type f -name "*.orig" | wc -l)
if [ "$ORIG_COUNT" -gt 0 ]; then
warn "Found $ORIG_COUNT .orig files still in vendor directory"
fi
success "Rust dependencies vendored (including git dependencies)"
cd "$PACKAGE_DIR"
fi
fi
success "Source prepared for packaging"
else
error "Failed to clone $GIT_REPO"
rm -rf "$TEMP_CLONE"
exit 1
fi
# Handle stable packages - get latest tag
elif [ -n "$GIT_REPO" ]; then
info "Detected stable package: $PACKAGE_NAME" info "Detected stable package: $PACKAGE_NAME"
info "Fetching latest tag from $GIT_REPO..." info "Fetching latest tag from $GIT_REPO..."
LATEST_TAG=$(get_latest_tag "$GIT_REPO") LATEST_TAG=$(get_latest_tag "$GIT_REPO")
if [ -n "$LATEST_TAG" ]; then if [ -n "$LATEST_TAG" ]; then
# Check source format - native packages can't use dashes
SOURCE_FORMAT=$(head -1 debian/source/format 2>/dev/null || echo "3.0 (quilt)") SOURCE_FORMAT=$(head -1 debian/source/format 2>/dev/null || echo "3.0 (quilt)")
# Get current version to check if we need to increment PPA number
CURRENT_VERSION=$(dpkg-parsechangelog -S Version 2>/dev/null || echo "") CURRENT_VERSION=$(dpkg-parsechangelog -S Version 2>/dev/null || echo "")
# Use REBUILD_RELEASE if provided, otherwise auto-increment
if [[ -n "${REBUILD_RELEASE:-}" ]]; then if [[ -n "${REBUILD_RELEASE:-}" ]]; then
PPA_NUM=$REBUILD_RELEASE PPA_NUM=$REBUILD_RELEASE
info "Using REBUILD_RELEASE=$REBUILD_RELEASE for PPA number" info "Using REBUILD_RELEASE=$REBUILD_RELEASE for PPA number"
@@ -456,20 +207,22 @@ elif [ -n "$GIT_REPO" ]; then
fi fi
if [[ "$SOURCE_FORMAT" == *"native"* ]]; then if [[ "$SOURCE_FORMAT" == *"native"* ]]; then
# Native format: 0.2.1ppa1 (no dash, no revision)
BASE_VERSION="${LATEST_TAG}" BASE_VERSION="${LATEST_TAG}"
# Check if we're rebuilding the same version (increment PPA number if so)
if [[ -z "${REBUILD_RELEASE:-}" ]] && [[ "$CURRENT_VERSION" =~ ^${LATEST_TAG}ppa([0-9]+)$ ]]; then if [[ -z "${REBUILD_RELEASE:-}" ]] && [[ "$CURRENT_VERSION" =~ ^${LATEST_TAG}ppa([0-9]+)$ ]]; then
PPA_NUM=$((BASH_REMATCH[1] + 1)) PPA_NUM=$((BASH_REMATCH[1] + 1))
info "Detected rebuild of same version (current: $CURRENT_VERSION), incrementing PPA number to $PPA_NUM" if [[ "$IS_MANUAL" == true ]]; then
info "Detected rebuild of same version (current: $CURRENT_VERSION), incrementing PPA number to $PPA_NUM"
else
info "Detected rebuild of same version (current: $CURRENT_VERSION). Not a manual run, skipping."
success "No changes needed (version matches)."
exit 0
fi
elif [[ -z "${REBUILD_RELEASE:-}" ]]; then elif [[ -z "${REBUILD_RELEASE:-}" ]]; then
info "New version or first build, using PPA number $PPA_NUM" info "New version or first build, using PPA number $PPA_NUM"
fi fi
NEW_VERSION="${BASE_VERSION}ppa${PPA_NUM}" NEW_VERSION="${BASE_VERSION}ppa${PPA_NUM}"
else else
# Quilt format: 0.2.1-1ppa1 (with revision)
BASE_VERSION="${LATEST_TAG}-1" BASE_VERSION="${LATEST_TAG}-1"
# Check if we're rebuilding the same version (increment PPA number if so)
ESCAPED_BASE=$(echo "$BASE_VERSION" | sed 's/\./\\./g' | sed 's/-/\\-/g') ESCAPED_BASE=$(echo "$BASE_VERSION" | sed 's/\./\\./g' | sed 's/-/\\-/g')
if [[ -z "${REBUILD_RELEASE:-}" ]] && [[ "$CURRENT_VERSION" =~ ^${ESCAPED_BASE}ppa([0-9]+)$ ]]; then if [[ -z "${REBUILD_RELEASE:-}" ]] && [[ "$CURRENT_VERSION" =~ ^${ESCAPED_BASE}ppa([0-9]+)$ ]]; then
PPA_NUM=$((BASH_REMATCH[1] + 1)) PPA_NUM=$((BASH_REMATCH[1] + 1))
@@ -486,15 +239,13 @@ elif [ -n "$GIT_REPO" ]; then
NEW_VERSION="${BASE_VERSION}ppa${PPA_NUM}" NEW_VERSION="${BASE_VERSION}ppa${PPA_NUM}"
fi fi
# Check if version needs updating (either new version or PPA number changed) CHANGELOG_UPDATED=false
if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then
if [ "$PPA_NUM" -gt 1 ]; then if [ "$PPA_NUM" -gt 1 ]; then
info "Updating changelog for rebuild (PPA number incremented to $PPA_NUM)" info "Updating changelog for rebuild (PPA number incremented to $PPA_NUM)"
else else
info "Updating changelog to latest tag: $LATEST_TAG" info "Updating changelog to latest tag: $LATEST_TAG"
fi fi
# Use sed to update changelog (non-interactive)
# Get current changelog content - find the next package header line
OLD_ENTRY_START=$(grep -n "^${SOURCE_NAME} (" debian/changelog | sed -n '2p' | cut -d: -f1) OLD_ENTRY_START=$(grep -n "^${SOURCE_NAME} (" debian/changelog | sed -n '2p' | cut -d: -f1)
if [ -n "$OLD_ENTRY_START" ]; then if [ -n "$OLD_ENTRY_START" ]; then
CHANGELOG_CONTENT=$(tail -n +"$OLD_ENTRY_START" debian/changelog) CHANGELOG_CONTENT=$(tail -n +"$OLD_ENTRY_START" debian/changelog)
@@ -502,7 +253,6 @@ elif [ -n "$GIT_REPO" ]; then
CHANGELOG_CONTENT="" CHANGELOG_CONTENT=""
fi fi
# Create appropriate changelog message
if [ "$PPA_NUM" -gt 1 ]; then if [ "$PPA_NUM" -gt 1 ]; then
CHANGELOG_MSG="Rebuild for packaging fixes (ppa${PPA_NUM})" CHANGELOG_MSG="Rebuild for packaging fixes (ppa${PPA_NUM})"
else else
@@ -520,25 +270,194 @@ elif [ -n "$GIT_REPO" ]; then
echo "$CHANGELOG_CONTENT" >>debian/changelog echo "$CHANGELOG_CONTENT" >>debian/changelog
fi fi
success "Version updated to $NEW_VERSION" success "Version updated to $NEW_VERSION"
CHANGELOG_UPDATED=true
CHANGELOG_VERSION=$(dpkg-parsechangelog -S Version)
info "Writing updated changelog back to repository..."
cp debian/changelog "$PACKAGE_DIR/debian/changelog"
success "Changelog written back to $PACKAGE_DIR/debian/changelog"
else else
info "Version already at latest tag: $LATEST_TAG" info "Version already at latest tag: $LATEST_TAG"
fi fi
else else
warn "Could not determine latest tag for $GIT_REPO, using existing version" warn "Could not determine latest tag for $GIT_REPO, using existing version"
fi fi
# Download binaries/source using the updated version from changelog
VERSION=$(dpkg-parsechangelog -S Version | sed 's/-[^-]*$//' | sed 's/ppa[0-9]*$//')
case "$PACKAGE_NAME" in
dms)
info "Downloading pre-built binaries and source for dms..."
if [ ! -f "dms-distropkg-amd64.gz" ]; then
info "Downloading dms binary for amd64..."
if wget -O dms-distropkg-amd64.gz "https://github.com/AvengeMedia/DankMaterialShell/releases/download/v${VERSION}/dms-distropkg-amd64.gz"; then
success "amd64 binary downloaded"
else
error "Failed to download dms-distropkg-amd64.gz"
exit 1
fi
fi
if [ ! -f "dms-source.tar.gz" ]; then
info "Downloading dms source for QML files..."
if wget -O dms-source.tar.gz "https://github.com/AvengeMedia/DankMaterialShell/archive/refs/tags/v${VERSION}.tar.gz"; then
success "source tarball downloaded"
else
error "Failed to download dms-source.tar.gz"
exit 1
fi
fi
;;
dms-greeter)
info "Downloading source for dms-greeter..."
if [ ! -f "dms-greeter-source.tar.gz" ]; then
info "Downloading dms-greeter source..."
if wget -O dms-greeter-source.tar.gz "https://github.com/AvengeMedia/DankMaterialShell/archive/refs/tags/v${VERSION}.tar.gz"; then
success "source tarball downloaded"
else
error "Failed to download dms-greeter-source.tar.gz"
exit 1
fi
fi
;;
esac
fi
# Handle git packages
if [ "$IS_GIT_PACKAGE" = true ] && [ -n "$GIT_REPO" ]; then
info "Detected git package: $PACKAGE_NAME"
if [ -z "$SOURCE_DIR" ]; then
BASE_NAME=$(echo "$PACKAGE_NAME" | sed 's/-git$//')
if [ -d "${BASE_NAME}-source" ] 2>/dev/null; then
SOURCE_DIR="${BASE_NAME}-source"
elif [ -d "${BASE_NAME}-repo" ] 2>/dev/null; then
SOURCE_DIR="${BASE_NAME}-repo"
elif [ -d "$BASE_NAME" ] 2>/dev/null; then
SOURCE_DIR="$BASE_NAME"
else
SOURCE_DIR="${BASE_NAME}-source"
fi
fi
info "Cloning $GIT_REPO from GitHub (getting latest commit info)..."
TEMP_CLONE=$(mktemp -d "$TEMP_BASE/ppa_clone_XXXXXX")
if git clone "https://github.com/$GIT_REPO.git" "$TEMP_CLONE"; then
GIT_COMMIT_HASH=$(cd "$TEMP_CLONE" && git rev-parse --short HEAD)
GIT_COMMIT_COUNT=$(cd "$TEMP_CLONE" && git rev-list --count HEAD)
UPSTREAM_VERSION=$(cd "$TEMP_CLONE" && git tag -l "v*" | sed 's/^v//' | sort -V | tail -1)
if [ -z "$UPSTREAM_VERSION" ]; then
UPSTREAM_VERSION=$(cd "$TEMP_CLONE" && git tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -1)
fi
if [ -z "$UPSTREAM_VERSION" ]; then
UPSTREAM_VERSION=$(cd "$TEMP_CLONE" && git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.1")
fi
if [ -z "$GIT_COMMIT_COUNT" ] || [ "$GIT_COMMIT_COUNT" = "0" ]; then
error "Failed to get commit count from $GIT_REPO"
rm -rf "$TEMP_CLONE"
exit 1
fi
if [ -z "$GIT_COMMIT_HASH" ]; then
error "Failed to get commit hash from $GIT_REPO"
rm -rf "$TEMP_CLONE"
exit 1
fi
success "Got commit info: $GIT_COMMIT_COUNT ($GIT_COMMIT_HASH), upstream: $UPSTREAM_VERSION"
info "Updating changelog with git commit info..."
BASE_VERSION="${UPSTREAM_VERSION}+git${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}"
CURRENT_VERSION=$(dpkg-parsechangelog -S Version 2>/dev/null || echo "")
if [[ -n "${REBUILD_RELEASE:-}" ]]; then
PPA_NUM=$REBUILD_RELEASE
info "Using REBUILD_RELEASE=$REBUILD_RELEASE for PPA number"
else
PPA_NUM=1
ESCAPED_BASE=$(echo "$BASE_VERSION" | sed 's/\./\\./g' | sed 's/+/\\+/g')
if [[ "$CURRENT_VERSION" =~ ^${ESCAPED_BASE}ppa([0-9]+)$ ]]; then
PPA_NUM=$((BASH_REMATCH[1] + 1))
if [[ "$IS_MANUAL" == true ]]; then
info "Detected rebuild of same commit (current: $CURRENT_VERSION), incrementing PPA number to $PPA_NUM"
else
info "Detected rebuild of same commit (current: $CURRENT_VERSION). Not a manual run, skipping."
success "No changes needed (commit matches)."
exit 0
fi
else
info "New commit or first build, using PPA number $PPA_NUM"
fi
fi
NEW_VERSION="${BASE_VERSION}ppa${PPA_NUM}"
OLD_ENTRY_START=$(grep -n "^${SOURCE_NAME} (" debian/changelog | sed -n '2p' | cut -d: -f1)
if [ -n "$OLD_ENTRY_START" ]; then
CHANGELOG_CONTENT=$(tail -n +"$OLD_ENTRY_START" debian/changelog)
else
CHANGELOG_CONTENT=""
fi
CHANGELOG_ENTRY="${SOURCE_NAME} (${NEW_VERSION}) ${UBUNTU_SERIES}; urgency=medium
* Git snapshot (commit ${GIT_COMMIT_COUNT}: ${GIT_COMMIT_HASH})
-- Avenge Media <AvengeMedia.US@gmail.com> $(date -R)"
echo "$CHANGELOG_ENTRY" >debian/changelog
if [ -n "$CHANGELOG_CONTENT" ]; then
echo "" >>debian/changelog
echo "$CHANGELOG_CONTENT" >>debian/changelog
fi
success "Version updated to $NEW_VERSION"
CHANGELOG_VERSION=$(dpkg-parsechangelog -S Version)
info "Writing updated changelog back to repository..."
cp debian/changelog "$PACKAGE_DIR/debian/changelog"
success "Changelog written back to $PACKAGE_DIR/debian/changelog"
rm -rf "$SOURCE_DIR"
cp -r "$TEMP_CLONE" "$SOURCE_DIR"
if [ "$PACKAGE_NAME" = "dms-git" ]; then
info "Saving version info to .dms-version for build process..."
echo "VERSION=${UPSTREAM_VERSION}+git${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}" >"$SOURCE_DIR/.dms-version"
echo "COMMIT=${GIT_COMMIT_HASH}" >>"$SOURCE_DIR/.dms-version"
success "Version info saved: ${UPSTREAM_VERSION}+git${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}"
info "Vendoring Go dependencies for offline build..."
cd "$SOURCE_DIR/core"
go mod vendor
if [ ! -d "vendor" ]; then
error "Failed to vendor Go dependencies"
exit 1
fi
success "Go dependencies vendored successfully"
cd "$PACKAGE_DIR"
fi
rm -rf "$SOURCE_DIR/.git"
rm -rf "$TEMP_CLONE"
success "Source prepared for packaging"
else
error "Failed to clone $GIT_REPO"
rm -rf "$TEMP_CLONE"
exit 1
fi
fi fi
# Handle packages that need pre-built binaries downloaded # Handle packages that need pre-built binaries downloaded
cd "$PACKAGE_DIR" cd "$WORK_PACKAGE_DIR"
case "$PACKAGE_NAME" in case "$PACKAGE_NAME" in
danksearch) danksearch)
info "Downloading pre-built binaries for danksearch..." info "Downloading pre-built binaries for danksearch..."
# Get version from changelog (remove ppa suffix for both quilt and native formats)
# Native: 0.5.2ppa1 -> 0.5.2, Quilt: 0.5.2-1ppa1 -> 0.5.2
VERSION=$(dpkg-parsechangelog -S Version | sed 's/-[^-]*$//' | sed 's/ppa[0-9]*$//') VERSION=$(dpkg-parsechangelog -S Version | sed 's/-[^-]*$//' | sed 's/ppa[0-9]*$//')
# Download both amd64 and arm64 binaries (will be included in source package)
# Launchpad can't download during build, so we include both architectures
if [ ! -f "dsearch-amd64" ]; then if [ ! -f "dsearch-amd64" ]; then
info "Downloading dsearch binary for amd64..." info "Downloading dsearch binary for amd64..."
if wget -O dsearch-amd64.gz "https://github.com/AvengeMedia/danksearch/releases/download/v${VERSION}/dsearch-linux-amd64.gz"; then if wget -O dsearch-amd64.gz "https://github.com/AvengeMedia/danksearch/releases/download/v${VERSION}/dsearch-linux-amd64.gz"; then
@@ -564,16 +483,14 @@ danksearch)
fi fi
;; ;;
dgop) dgop)
# dgop binary should already be committed in the repo
if [ ! -f "dgop" ]; then if [ ! -f "dgop" ]; then
warn "dgop binary not found - should be committed to repo" warn "dgop binary not found - should be committed to repo"
fi fi
;; ;;
esac esac
cd - >/dev/null cd "$WORK_PACKAGE_DIR"
# Check if this version already exists on PPA (only in CI environment)
if command -v rmadison >/dev/null 2>&1; then if command -v rmadison >/dev/null 2>&1; then
info "Checking if version already exists on PPA..." info "Checking if version already exists on PPA..."
PPA_VERSION_CHECK=$(rmadison -u ppa:avengemedia/dms "$PACKAGE_NAME" 2>/dev/null | grep "$VERSION" || true) PPA_VERSION_CHECK=$(rmadison -u ppa:avengemedia/dms "$PACKAGE_NAME" 2>/dev/null | grep "$VERSION" || true)
@@ -583,7 +500,6 @@ if command -v rmadison >/dev/null 2>&1; then
echo echo
warn "Skipping upload to avoid duplicate. If this is a rebuild, increment the ppa number." warn "Skipping upload to avoid duplicate. If this is a rebuild, increment the ppa number."
cd "$PACKAGE_DIR" cd "$PACKAGE_DIR"
# Still clean up extracted sources
case "$PACKAGE_NAME" in case "$PACKAGE_NAME" in
dms-git) dms-git)
rm -rf DankMaterialShell-* rm -rf DankMaterialShell-*
@@ -594,16 +510,18 @@ if command -v rmadison >/dev/null 2>&1; then
fi fi
fi fi
# Build source package
info "Building source package..." info "Building source package..."
echo echo
# Determine if we need to include orig tarball (-sa) or just debian changes (-sd) SOURCE_FORMAT=$(head -1 "$WORK_PACKAGE_DIR/debian/source/format" 2>/dev/null || echo "3.0 (quilt)")
# Check if .orig.tar.xz already exists in real parent directory (previous build)
ORIG_TARBALL="${PACKAGE_NAME}_${VERSION%.ppa*}.orig.tar.xz" # Native format packages don't use orig tarballs - they include everything in one tarball
if [ -f "$PACKAGE_PARENT/$ORIG_TARBALL" ]; then if [[ "$SOURCE_FORMAT" == *"native"* ]]; then
info "Native format detected - including all source files (no orig tarball needed)"
DEBUILD_SOURCE_FLAG="-sa"
elif [ -f "$PACKAGE_PARENT/${PACKAGE_NAME}_${VERSION%.ppa*}.orig.tar.xz" ]; then
ORIG_TARBALL="${PACKAGE_NAME}_${VERSION%.ppa*}.orig.tar.xz"
info "Found existing orig tarball in $PACKAGE_PARENT, using -sd (debian changes only)" info "Found existing orig tarball in $PACKAGE_PARENT, using -sd (debian changes only)"
# Copy it to temp parent so debuild can find it
cp "$PACKAGE_PARENT/$ORIG_TARBALL" "$TEMP_WORK_DIR/" cp "$PACKAGE_PARENT/$ORIG_TARBALL" "$TEMP_WORK_DIR/"
DEBUILD_SOURCE_FLAG="-sd" DEBUILD_SOURCE_FLAG="-sd"
else else
@@ -611,20 +529,20 @@ else
DEBUILD_SOURCE_FLAG="-sa" DEBUILD_SOURCE_FLAG="-sa"
fi fi
# Use -S for source only, -sa/-sd for source inclusion
# -d skips dependency checking (we're building on Fedora, not Ubuntu) # -d skips dependency checking (we're building on Fedora, not Ubuntu)
# Pipe yes to automatically answer prompts (e.g., "continue anyway?")
if yes | DEBIAN_FRONTEND=noninteractive debuild -S $DEBUILD_SOURCE_FLAG -d; then if yes | DEBIAN_FRONTEND=noninteractive debuild -S $DEBUILD_SOURCE_FLAG -d; then
echo echo
success "Source package built successfully!" success "Source package built successfully!"
# Copy build artifacts back to parent directory TEMP_MARKER_FILE="$PACKAGE_PARENT/.ppa_build_temp_${PACKAGE_NAME}"
info "Copying build artifacts to $PACKAGE_PARENT..." echo "PPA_BUILD_TEMP_DIR=$TEMP_WORK_DIR" > "$TEMP_MARKER_FILE"
cp -v "$TEMP_WORK_DIR"/"${SOURCE_NAME}"_"${CHANGELOG_VERSION}"* "$PACKAGE_PARENT/" 2>/dev/null || true
if [[ -z "${PPA_UPLOAD_SCRIPT:-}" ]] && ! pgrep -f "ppa-upload.sh" >/dev/null 2>&1; then
# List generated files info "Copying build artifacts to $PACKAGE_PARENT (standalone build)..."
info "Generated files in $PACKAGE_PARENT:" cp -v "$TEMP_WORK_DIR"/"${SOURCE_NAME}"_"${CHANGELOG_VERSION}"* "$PACKAGE_PARENT/" 2>/dev/null || true
ls -lh "$PACKAGE_PARENT"/"${SOURCE_NAME}"_"${CHANGELOG_VERSION}"* 2>/dev/null || true info "Generated files in $PACKAGE_PARENT:"
ls -lh "$PACKAGE_PARENT"/"${SOURCE_NAME}"_"${CHANGELOG_VERSION}"* 2>/dev/null || true
fi
# Show what to do next # Show what to do next
echo echo

View File

@@ -1,204 +0,0 @@
#!/bin/bash
# Ubuntu PPA uploader for DMS packages
# Usage: ./upload-ppa.sh <changes-file> <ppa-name>
#
# Example:
# ./upload-ppa.sh ../dms_0.5.2ppa1_source.changes dms
# ./upload-ppa.sh ../dms_0.5.2+git705.fdbb86appa1_source.changes dms-git
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
info() { echo -e "${BLUE}[INFO]${NC} $1"; }
success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
error() { echo -e "${RED}[ERROR]${NC} $1"; }
if [ $# -lt 2 ]; then
error "Usage: $0 <changes-file> <ppa-name>"
echo
echo "Arguments:"
echo " changes-file : Path to .changes file (e.g., ../dms_0.5.2ppa1_source.changes)"
echo " ppa-name : PPA to upload to (dms or dms-git)"
echo
echo "Examples:"
echo " $0 ../dms_0.5.2ppa1_source.changes dms"
echo " $0 ../dms_0.5.2+git705.fdbb86appa1_source.changes dms-git"
exit 1
fi
CHANGES_FILE="$1"
PPA_NAME="$2"
# Validate changes file
if [ ! -f "$CHANGES_FILE" ]; then
error "Changes file not found: $CHANGES_FILE"
exit 1
fi
if [[ ! "$CHANGES_FILE" =~ \.changes$ ]]; then
error "File must be a .changes file"
exit 1
fi
# Validate PPA name
if [ "$PPA_NAME" != "dms" ] && [ "$PPA_NAME" != "dms-git" ] && [ "$PPA_NAME" != "danklinux" ]; then
error "PPA name must be 'dms', 'dms-git', or 'danklinux'"
exit 1
fi
# Get absolute path
CHANGES_FILE=$(realpath "$CHANGES_FILE")
info "Uploading to PPA: ppa:avengemedia/$PPA_NAME"
info "Changes file: $CHANGES_FILE"
# Check if dput is installed
if command -v dput &>/dev/null; then
info "dput found"
else
error "dput not found. Install with:"
error " sudo dnf install dput-ng"
exit 1
fi
# Check if ~/.dput.cf exists
if [ ! -f "$HOME/.dput.cf" ]; then
error "$HOME/.dput.cf not found!"
echo
info "Create it from template:"
echo " cp $(dirname "$0")/../dput.cf.template ~/.dput.cf"
echo
info "Or create it manually with:"
cat <<'EOF'
[ppa:avengemedia/dms]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~avengemedia/ubuntu/dms/
login = anonymous
allow_unsigned_uploads = 0
[ppa:avengemedia/dms-git]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~avengemedia/ubuntu/dms-git/
login = anonymous
allow_unsigned_uploads = 0
EOF
exit 1
fi
# Check if PPA is configured in dput.cf
if ! grep -q "^\[ppa:avengemedia/$PPA_NAME\]" "$HOME/.dput.cf"; then
error "PPA 'ppa:avengemedia/$PPA_NAME' not found in ~/.dput.cf"
echo
info "Add this to ~/.dput.cf:"
cat <<EOF
[ppa:avengemedia/$PPA_NAME]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~avengemedia/ubuntu/$PPA_NAME/
login = anonymous
allow_unsigned_uploads = 0
EOF
exit 1
fi
# Extract package info from changes file
PACKAGE_NAME=$(grep "^Source:" "$CHANGES_FILE" | awk '{print $2}')
VERSION=$(grep "^Version:" "$CHANGES_FILE" | awk '{print $2}')
info "Package: $PACKAGE_NAME"
info "Version: $VERSION"
# Show files that will be uploaded
echo
info "Files to be uploaded:"
grep "^ [a-f0-9]" "$CHANGES_FILE" | awk '{print " - " $5}' || true
# Verify GPG signature
info "Verifying GPG signature..."
if gpg --verify "$CHANGES_FILE" 2>/dev/null; then
success "GPG signature valid"
else
error "GPG signature verification failed!"
error "The .changes file must be signed with your GPG key"
exit 1
fi
# Ask for confirmation
echo
warn "About to upload to: ppa:avengemedia/$PPA_NAME"
read -p "Continue? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
info "Upload cancelled"
exit 0
fi
# Upload to PPA
info "Uploading to Launchpad..."
echo
UPLOAD_SUCCESS=false
if [ "$UPLOAD_METHOD" = "dput" ]; then
if dput "ppa:avengemedia/$PPA_NAME" "$CHANGES_FILE"; then
UPLOAD_SUCCESS=true
fi
elif [ "$UPLOAD_METHOD" = "lftp" ]; then
# Use lftp to upload to Launchpad PPA
CHANGES_DIR=$(dirname "$CHANGES_FILE")
CHANGES_BASENAME=$(basename "$CHANGES_FILE")
# Extract files to upload from .changes file
FILES_TO_UPLOAD=("$CHANGES_BASENAME")
while IFS= read -r line; do
if [[ "$line" =~ ^\ [a-f0-9]+\ [0-9]+\ [^\ ]+\ [^\ ]+\ (.+)$ ]]; then
FILES_TO_UPLOAD+=("${BASH_REMATCH[1]}")
fi
done < "$CHANGES_FILE"
# Build lftp command to upload all files
LFTP_COMMANDS="set ftp:ssl-allow no; open ftp://ppa.launchpad.net; user anonymous ''; cd ~avengemedia/ubuntu/$PPA_NAME/;"
for file in "${FILES_TO_UPLOAD[@]}"; do
LFTP_COMMANDS="$LFTP_COMMANDS put '$CHANGES_DIR/$file';"
done
LFTP_COMMANDS="$LFTP_COMMANDS bye"
if echo "$LFTP_COMMANDS" | lftp; then
UPLOAD_SUCCESS=true
fi
fi
if [ "$UPLOAD_SUCCESS" = true ]; then
echo
success "Upload successful!"
echo
info "Monitor build progress at:"
echo " https://launchpad.net/~avengemedia/+archive/ubuntu/$PPA_NAME/+packages"
echo
info "Builds typically take 5-30 minutes depending on:"
echo " - Build queue length"
echo " - Package complexity"
echo " - Number of target Ubuntu series"
echo
info "Once built, users can install with:"
echo " sudo add-apt-repository ppa:avengemedia/$PPA_NAME"
echo " sudo apt update"
echo " sudo apt install $PACKAGE_NAME"
else
error "Upload failed!"
echo
info "Common issues:"
echo " - GPG key not verified on Launchpad (check https://launchpad.net/~/+editpgpkeys)"
echo " - Version already uploaded (must increment version number)"
echo " - Network/firewall blocking FTP (try HTTPS method in dput.cf)"
echo " - Email in changelog doesn't match GPG key email"
exit 1
fi

218
distro/scripts/ppa-status.sh Executable file
View File

@@ -0,0 +1,218 @@
#!/bin/bash
# Unified PPA status checker for DMS packages
# Checks build status for packages across multiple PPAs via Launchpad API
# Usage: ./distro/scripts/ppa-status.sh [package-name] [ppa-name]
#
# Examples:
# ./distro/scripts/ppa-status.sh # Check all packages in all PPAs
# ./distro/scripts/ppa-status.sh dms # Check dms package
# ./distro/scripts/ppa-status.sh all dms-git # Check all packages in dms-git PPA
PPA_OWNER="avengemedia"
LAUNCHPAD_API="https://api.launchpad.net/1.0"
DISTRO_SERIES="questing"
# Define packages (sync with ppa-upload.sh)
ALL_PACKAGES=(dms dms-git dms-greeter)
# Function to get PPA name for a package
get_ppa_name() {
local pkg="$1"
case "$pkg" in
dms) echo "dms" ;;
dms-git) echo "dms-git" ;;
dms-greeter) echo "danklinux" ;;
*) echo "" ;;
esac
}
# Check for required tools
if ! command -v curl &> /dev/null; then
echo "Error: curl is required but not installed"
exit 1
fi
if ! command -v jq &> /dev/null; then
echo "Error: jq is required but not installed"
exit 1
fi
# Parse arguments
PACKAGE_INPUT="${1:-}"
PPA_INPUT="${2:-}"
# Determine packages and PPAs to check
if [[ -n "$PACKAGE_INPUT" ]] && [[ "$PACKAGE_INPUT" != "all" ]]; then
# Check specific package
VALID_PACKAGE=false
for pkg in "${ALL_PACKAGES[@]}"; do
if [[ "$PACKAGE_INPUT" == "$pkg" ]]; then
VALID_PACKAGE=true
break
fi
done
if [[ "$VALID_PACKAGE" != "true" ]]; then
echo "Error: Unknown package: $PACKAGE_INPUT"
echo "Available packages: ${ALL_PACKAGES[*]}"
exit 1
fi
PACKAGES=("$PACKAGE_INPUT")
if [[ -n "$PPA_INPUT" ]]; then
PPAS=("$PPA_INPUT")
else
PPAS=("$(get_ppa_name "$PACKAGE_INPUT")")
fi
elif [[ -n "$PPA_INPUT" ]]; then
# Check all packages in specific PPA
PACKAGES=("${ALL_PACKAGES[@]}")
PPAS=("$PPA_INPUT")
else
# Check all packages in all PPAs
PACKAGES=("${ALL_PACKAGES[@]}")
PPAS=("dms" "dms-git" "danklinux")
fi
# Function to get build status color and symbol
get_status_display() {
local status="$1"
case "$status" in
"Successfully built")
echo -e "✅ \033[0;32m$status\033[0m"
;;
"Failed to build")
echo -e "❌ \033[0;31m$status\033[0m"
;;
"Needs building"|"Currently building")
echo -e "⏳ \033[0;33m$status\033[0m"
;;
"Dependency wait")
echo -e "⚠️ \033[0;33m$status\033[0m"
;;
"Chroot problem")
echo -e "🔧 \033[0;31m$status\033[0m"
;;
"Uploading build")
echo -e "📤 \033[0;36m$status\033[0m"
;;
*)
echo -e "❓ \033[0;37m$status\033[0m"
;;
esac
}
# Check each PPA
for PPA_NAME in "${PPAS[@]}"; do
PPA_ARCHIVE="${LAUNCHPAD_API}/~${PPA_OWNER}/+archive/ubuntu/${PPA_NAME}"
echo "=========================================="
echo "=== PPA: ${PPA_OWNER}/${PPA_NAME} ==="
echo "=========================================="
echo "Distribution: Ubuntu $DISTRO_SERIES"
echo ""
for pkg in "${PACKAGES[@]}"; do
# Only check packages that belong to this PPA
PKG_PPA=$(get_ppa_name "$pkg")
if [[ "$PKG_PPA" != "$PPA_NAME" ]]; then
continue
fi
echo "----------------------------------------"
echo "--- $pkg ---"
echo "----------------------------------------"
# Get published sources for this package
SOURCES_URL="${PPA_ARCHIVE}?ws.op=getPublishedSources&source_name=${pkg}&distro_series=${LAUNCHPAD_API}/ubuntu/${DISTRO_SERIES}&status=Published"
SOURCES=$(curl -s "$SOURCES_URL" 2>/dev/null)
if [[ -z "$SOURCES" ]] || [[ "$SOURCES" == "null" ]]; then
echo " ⚠️ No published sources found"
echo ""
continue
fi
# Get the latest source
TOTAL=$(echo "$SOURCES" | jq '.total_size // 0')
if [[ "$TOTAL" == "0" ]]; then
echo " ⚠️ No published sources found for $DISTRO_SERIES"
echo ""
continue
fi
# Get most recent entry
ENTRY=$(echo "$SOURCES" | jq '.entries[0]')
if [[ "$ENTRY" == "null" ]]; then
echo " ⚠️ No source entries found"
echo ""
continue
fi
# Extract source info
VERSION=$(echo "$ENTRY" | jq -r '.source_package_version // "unknown"')
STATUS=$(echo "$ENTRY" | jq -r '.status // "unknown"')
DATE_PUBLISHED=$(echo "$ENTRY" | jq -r '.date_published // "unknown"')
SELF_LINK=$(echo "$ENTRY" | jq -r '.self_link // ""')
echo " 📦 Version: $VERSION"
echo " 📅 Published: ${DATE_PUBLISHED%T*}"
echo " 📋 Source Status: $STATUS"
echo ""
# Get builds for this source
if [[ -n "$SELF_LINK" && "$SELF_LINK" != "null" ]]; then
BUILDS_URL="${SELF_LINK}?ws.op=getBuilds"
BUILDS=$(curl -s "$BUILDS_URL" 2>/dev/null)
if [[ -n "$BUILDS" && "$BUILDS" != "null" ]]; then
BUILD_COUNT=$(echo "$BUILDS" | jq '.total_size // 0')
if [[ "$BUILD_COUNT" -gt 0 ]]; then
echo " Builds:"
echo "$BUILDS" | jq -r '.entries[] | "\(.arch_tag) \(.buildstate)"' 2>/dev/null | while read -r line; do
ARCH=$(echo "$line" | awk '{print $1}')
BUILD_STATUS=$(echo "$line" | cut -d' ' -f2-)
DISPLAY=$(get_status_display "$BUILD_STATUS")
echo " $ARCH: $DISPLAY"
done
fi
fi
fi
# Alternative: Get build records directly from archive
BUILD_RECORDS_URL="${PPA_ARCHIVE}?ws.op=getBuildRecords&source_name=${pkg}"
BUILD_RECORDS=$(curl -s "$BUILD_RECORDS_URL" 2>/dev/null)
if [[ -n "$BUILD_RECORDS" && "$BUILD_RECORDS" != "null" ]]; then
RECORD_COUNT=$(echo "$BUILD_RECORDS" | jq '.total_size // 0')
if [[ "$RECORD_COUNT" -gt 0 ]]; then
echo ""
echo " Recent build history:"
# Get unique version+arch combinations
echo "$BUILD_RECORDS" | jq -r '.entries[:6][] | "\(.source_package_version) \(.arch_tag) \(.buildstate)"' 2>/dev/null | while read -r line; do
VER=$(echo "$line" | awk '{print $1}')
ARCH=$(echo "$line" | awk '{print $2}')
BUILD_STATUS=$(echo "$line" | cut -d' ' -f3-)
DISPLAY=$(get_status_display "$BUILD_STATUS")
echo " $VER ($ARCH): $DISPLAY"
done
fi
fi
echo ""
done
echo "View full PPA at: https://launchpad.net/~${PPA_OWNER}/+archive/ubuntu/${PPA_NAME}"
echo ""
done
echo "=========================================="
echo "Status check complete!"
echo ""

View File

@@ -1,10 +1,16 @@
#!/bin/bash #!/bin/bash
# Build and upload PPA package with automatic cleanup # Build and upload PPA package with automatic cleanup
# Usage: ./create-and-upload.sh <package-dir> <ppa-name> [ubuntu-series] [--keep-builds] # Usage: ./ppa-upload.sh [package-name] [ppa-name] [ubuntu-series] [rebuild-number] [--keep-builds] [--rebuild=N]
# #
# Example: # Examples:
# ./create-and-upload.sh ../dms dms questing # ./ppa-upload.sh dms # Single package (auto-detects PPA)
# ./create-and-upload.sh ../danklinux/dgop danklinux questing --keep-builds # ./ppa-upload.sh dms 2 # Rebuild with ppa2 (simple syntax)
# ./ppa-upload.sh dms --rebuild=2 # Rebuild with ppa2 (flag syntax)
# ./ppa-upload.sh dms-git # Single package
# ./ppa-upload.sh all # All packages
# ./ppa-upload.sh dms dms questing # Explicit PPA and series
# ./ppa-upload.sh dms dms questing 2 # Explicit PPA, series, and rebuild number
# ./ppa-upload.sh distro/ubuntu/dms dms # Path-style (backward compatible)
set -e set -e
@@ -19,72 +25,205 @@ success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
error() { echo -e "${RED}[ERROR]${NC} $1"; } error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Parse arguments AVAILABLE_PACKAGES=(dms dms-git dms-greeter)
KEEP_BUILDS=false KEEP_BUILDS=false
ARGS=() REBUILD_RELEASE=""
POSITIONAL_ARGS=()
for arg in "$@"; do for arg in "$@"; do
if [ "$arg" = "--keep-builds" ]; then case "$arg" in
KEEP_BUILDS=true --keep-builds) KEEP_BUILDS=true ;;
else --rebuild=*)
ARGS+=("$arg") REBUILD_RELEASE="${arg#*=}"
fi ;;
-r|--rebuild)
REBUILD_NEXT=true
;;
*)
if [[ -n "${REBUILD_NEXT:-}" ]]; then
REBUILD_RELEASE="$arg"
REBUILD_NEXT=false
else
POSITIONAL_ARGS+=("$arg")
fi
;;
esac
done done
if [ ${#ARGS[@]} -lt 2 ]; then PACKAGE_INPUT="${POSITIONAL_ARGS[0]:-}"
error "Usage: $0 <package-dir> <ppa-name> [ubuntu-series] [--keep-builds]" PPA_NAME_INPUT="${POSITIONAL_ARGS[1]:-}"
echo UBUNTU_SERIES="${POSITIONAL_ARGS[2]:-questing}"
echo "Arguments:"
echo " package-dir : Path to package directory (e.g., ../dms, ../danklinux/dgop)" if [[ ${#POSITIONAL_ARGS[@]} -gt 0 ]]; then
echo " ppa-name : PPA name (danklinux, dms, dms-git)" LAST_INDEX=$((${#POSITIONAL_ARGS[@]} - 1))
echo " ubuntu-series : Ubuntu series (optional, default: questing)" LAST_ARG="${POSITIONAL_ARGS[$LAST_INDEX]}"
echo " Supported: questing (25.10) and newer only" if [[ "$LAST_ARG" =~ ^[0-9]+$ ]] && [[ -z "$REBUILD_RELEASE" ]]; then
echo " Note: Requires Qt 6.6+ (quickshell requirement)" # Last argument is a number and no --rebuild flag was used
echo " --keep-builds : Keep build artifacts after upload (optional)" # Use it as rebuild release and remove from positional args
echo REBUILD_RELEASE="$LAST_ARG"
echo "Examples:" POSITIONAL_ARGS=("${POSITIONAL_ARGS[@]:0:$LAST_INDEX}")
echo " $0 ../dms dms questing" PACKAGE_INPUT="${POSITIONAL_ARGS[0]:-}"
echo " $0 ../danklinux/dgop danklinux questing --keep-builds" PPA_NAME_INPUT="${POSITIONAL_ARGS[1]:-}"
echo " $0 ../dms-git dms-git # Defaults to questing" UBUNTU_SERIES="${POSITIONAL_ARGS[2]:-questing}"
exit 1 fi
fi fi
PACKAGE_DIR="${ARGS[0]}"
PPA_NAME="${ARGS[1]}"
UBUNTU_SERIES="${ARGS[2]:-questing}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
BUILD_SCRIPT="$SCRIPT_DIR/ppa-build.sh" BUILD_SCRIPT="$SCRIPT_DIR/ppa-build.sh"
UPLOAD_SCRIPT="$SCRIPT_DIR/ppa-dput.sh"
# Validate scripts exist
if [ ! -f "$BUILD_SCRIPT" ]; then if [ ! -f "$BUILD_SCRIPT" ]; then
error "Build script not found: $BUILD_SCRIPT" error "Build script not found: $BUILD_SCRIPT"
exit 1 exit 1
fi fi
# Get absolute path get_ppa_name() {
local pkg="$1"
case "$pkg" in
dms) echo "dms" ;;
dms-git) echo "dms-git" ;;
dms-greeter) echo "danklinux" ;;
*) echo "" ;;
esac
}
# Support both path-style and name-style arguments
PACKAGE_DIR=""
PACKAGE_NAME=""
PPA_NAME=""
if [[ -n "$PACKAGE_INPUT" ]] && [[ "$PACKAGE_INPUT" == *"/"* ]]; then
# Path-style argument (backward compatibility)
if [[ -d "$PACKAGE_INPUT" ]]; then
PACKAGE_DIR="$(cd "$PACKAGE_INPUT" && pwd)"
elif [[ -d "$REPO_ROOT/$PACKAGE_INPUT" ]]; then
PACKAGE_DIR="$(cd "$REPO_ROOT/$PACKAGE_INPUT" && pwd)"
else
error "Package directory not found: $PACKAGE_INPUT"
exit 1
fi
PACKAGE_NAME=$(basename "$PACKAGE_DIR")
PPA_NAME="${PPA_NAME_INPUT:-$(get_ppa_name "$PACKAGE_NAME")}"
if [[ -z "$PPA_NAME" ]]; then
error "Could not determine PPA name for package: $PACKAGE_NAME"
error "Please specify PPA name as second argument"
exit 1
fi
info "Using path-style argument: $PACKAGE_DIR"
elif [[ -n "$PACKAGE_INPUT" ]] && [[ "$PACKAGE_INPUT" == "all" ]]; then
echo ""
info "Building and uploading all packages..."
FAILED_PACKAGES=()
for pkg in "${AVAILABLE_PACKAGES[@]}"; do
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
info "Processing $pkg..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
BUILD_ARGS=("$pkg" "$PPA_NAME_INPUT" "$UBUNTU_SERIES")
[[ "$KEEP_BUILDS" == "true" ]] && BUILD_ARGS+=("--keep-builds")
if ! "$0" "${BUILD_ARGS[@]}"; then
FAILED_PACKAGES+=("$pkg")
error "$pkg failed to upload"
fi
done
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
if [[ ${#FAILED_PACKAGES[@]} -eq 0 ]]; then
success "All packages uploaded successfully!"
else
error "Some packages failed: ${FAILED_PACKAGES[*]}"
exit 1
fi
exit 0
elif [[ -n "$PACKAGE_INPUT" ]]; then
VALID_PACKAGE=false
for pkg in "${AVAILABLE_PACKAGES[@]}"; do
if [[ "$PACKAGE_INPUT" == "$pkg" ]]; then
VALID_PACKAGE=true
break
fi
done
if [[ "$VALID_PACKAGE" != "true" ]]; then
error "Unknown package: $PACKAGE_INPUT"
echo "Available packages: ${AVAILABLE_PACKAGES[*]}"
exit 1
fi
PACKAGE_NAME="$PACKAGE_INPUT"
PACKAGE_DIR="$REPO_ROOT/distro/ubuntu/$PACKAGE_NAME"
PPA_NAME="${PPA_NAME_INPUT:-$(get_ppa_name "$PACKAGE_NAME")}"
else
echo "Available packages:"
echo ""
for i in "${!AVAILABLE_PACKAGES[@]}"; do
echo " $((i+1)). ${AVAILABLE_PACKAGES[$i]}"
done
echo " a. all"
echo ""
read -p "Select package (1-${#AVAILABLE_PACKAGES[@]}, a): " selection
if [[ "$selection" == "a" ]] || [[ "$selection" == "all" ]]; then
PACKAGE_INPUT="all"
BUILD_ARGS=("all" "$PPA_NAME_INPUT" "$UBUNTU_SERIES")
[[ "$KEEP_BUILDS" == "true" ]] && BUILD_ARGS+=("--keep-builds")
exec "$0" "${BUILD_ARGS[@]}"
elif [[ "$selection" =~ ^[0-9]+$ ]] && [[ "$selection" -ge 1 ]] && [[ "$selection" -le ${#AVAILABLE_PACKAGES[@]} ]]; then
PACKAGE_NAME="${AVAILABLE_PACKAGES[$((selection-1))]}"
PACKAGE_DIR="$REPO_ROOT/distro/ubuntu/$PACKAGE_NAME"
PPA_NAME="${PPA_NAME_INPUT:-$(get_ppa_name "$PACKAGE_NAME")}"
else
error "Invalid selection"
exit 1
fi
fi
if [ ! -d "$PACKAGE_DIR" ]; then
error "Package directory not found: $PACKAGE_DIR"
exit 1
fi
if [ ! -d "$PACKAGE_DIR/debian" ]; then
error "No debian/ directory found in $PACKAGE_DIR"
exit 1
fi
PACKAGE_DIR=$(cd "$PACKAGE_DIR" && pwd) PACKAGE_DIR=$(cd "$PACKAGE_DIR" && pwd)
PACKAGE_NAME=$(basename "$PACKAGE_DIR")
PARENT_DIR=$(dirname "$PACKAGE_DIR") PARENT_DIR=$(dirname "$PACKAGE_DIR")
info "Building and uploading: $PACKAGE_NAME" info "Building and uploading: $PACKAGE_NAME"
info "Package directory: $PACKAGE_DIR" info "Package directory: $PACKAGE_DIR"
info "PPA: ppa:avengemedia/$PPA_NAME" info "PPA: ppa:avengemedia/$PPA_NAME"
info "Ubuntu series: $UBUNTU_SERIES" info "Ubuntu series: $UBUNTU_SERIES"
if [[ -n "$REBUILD_RELEASE" ]]; then
info "Rebuild release number: ppa$REBUILD_RELEASE"
fi
echo echo
# Step 1: Build source package
info "Step 1: Building source package..." info "Step 1: Building source package..."
if [[ -n "$REBUILD_RELEASE" ]]; then
export REBUILD_RELEASE
fi
export PPA_UPLOAD_SCRIPT=1
if ! "$BUILD_SCRIPT" "$PACKAGE_DIR" "$UBUNTU_SERIES"; then if ! "$BUILD_SCRIPT" "$PACKAGE_DIR" "$UBUNTU_SERIES"; then
error "Build failed!" error "Build failed!"
exit 1 exit 1
fi fi
# Find the changes file TEMP_DIR_FILE="$PARENT_DIR/.ppa_build_temp_${PACKAGE_NAME}"
CHANGES_FILE=$(find "$PARENT_DIR" -maxdepth 1 -name "${PACKAGE_NAME}_*_source.changes" -type f | sort -V | tail -1) if [ -f "$TEMP_DIR_FILE" ]; then
source "$TEMP_DIR_FILE"
BUILD_TEMP_DIR="$PPA_BUILD_TEMP_DIR"
rm -f "$TEMP_DIR_FILE"
info "Using build artifacts from temp directory: $BUILD_TEMP_DIR"
CHANGES_FILE=$(find "$BUILD_TEMP_DIR" -maxdepth 1 -name "${PACKAGE_NAME}_*_source.changes" -type f 2>/dev/null | sort -V | tail -1)
else
BUILD_TEMP_DIR="$PARENT_DIR"
CHANGES_FILE=$(find "$PARENT_DIR" -maxdepth 1 -name "${PACKAGE_NAME}_*_source.changes" -type f | sort -V | tail -1)
fi
if [ -z "$CHANGES_FILE" ]; then if [ -z "$CHANGES_FILE" ]; then
warn "Changes file not found in $PARENT_DIR" warn "Changes file not found in $BUILD_TEMP_DIR"
warn "Assuming build was skipped (no changes needed) and exiting successfully." warn "Assuming build was skipped (no changes needed) and exiting successfully."
exit 0 exit 0
fi fi
@@ -92,14 +231,11 @@ fi
info "Found changes file: $CHANGES_FILE" info "Found changes file: $CHANGES_FILE"
echo echo
# Step 2: Upload to PPA
info "Step 2: Uploading to PPA..." info "Step 2: Uploading to PPA..."
# Check if using lftp (for all PPAs) or dput
if [ "$PPA_NAME" = "danklinux" ] || [ "$PPA_NAME" = "dms" ] || [ "$PPA_NAME" = "dms-git" ]; then if [ "$PPA_NAME" = "danklinux" ] || [ "$PPA_NAME" = "dms" ] || [ "$PPA_NAME" = "dms-git" ]; then
warn "Using lftp for upload" warn "Using lftp for upload"
# Find all files to upload
BUILD_DIR=$(dirname "$CHANGES_FILE") BUILD_DIR=$(dirname "$CHANGES_FILE")
CHANGES_BASENAME=$(basename "$CHANGES_FILE") CHANGES_BASENAME=$(basename "$CHANGES_FILE")
DSC_FILE="${CHANGES_BASENAME/_source.changes/.dsc}" DSC_FILE="${CHANGES_BASENAME/_source.changes/.dsc}"
@@ -127,7 +263,6 @@ if [ "$PPA_NAME" = "danklinux" ] || [ "$PPA_NAME" = "dms" ] || [ "$PPA_NAME" = "
info " - $BUILDINFO" info " - $BUILDINFO"
echo echo
# lftp build dir change
LFTP_SCRIPT=$(mktemp) LFTP_SCRIPT=$(mktemp)
cat >"$LFTP_SCRIPT" <<EOF cat >"$LFTP_SCRIPT" <<EOF
cd ~avengemedia/ubuntu/$PPA_NAME/ cd ~avengemedia/ubuntu/$PPA_NAME/
@@ -148,17 +283,11 @@ EOF
exit 1 exit 1
fi fi
else else
# Use dput for other PPAs # This branch should not be reached for DMS packages
if [ ! -f "$UPLOAD_SCRIPT" ]; then # All DMS packages (dms, dms-git, dms-greeter) use lftp
error "Upload script not found: $UPLOAD_SCRIPT" error "Unknown PPA: $PPA_NAME"
exit 1 error "DMS packages use lftp for upload. Supported PPAs: dms, dms-git, danklinux"
fi exit 1
# Auto-confirm upload (pipe 'y' to the confirmation prompt)
if ! echo "y" | "$UPLOAD_SCRIPT" "$CHANGES_FILE" "$PPA_NAME"; then
error "Upload failed!"
exit 1
fi
fi fi
echo echo
@@ -167,11 +296,17 @@ info "Monitor build progress at:"
echo " https://launchpad.net/~avengemedia/+archive/ubuntu/$PPA_NAME/+packages" echo " https://launchpad.net/~avengemedia/+archive/ubuntu/$PPA_NAME/+packages"
echo echo
# Step 3: Cleanup (unless --keep-builds is specified)
if [ "$KEEP_BUILDS" = "false" ]; then if [ "$KEEP_BUILDS" = "false" ]; then
info "Step 3: Cleaning up build artifacts..." info "Step 3: Cleaning up build artifacts..."
# Find all build artifacts in parent directory if [ -n "${BUILD_TEMP_DIR:-}" ] && [ "$BUILD_TEMP_DIR" != "$PARENT_DIR" ]; then
if [ -d "$BUILD_TEMP_DIR" ]; then
info "Removing temp build directory: $BUILD_TEMP_DIR"
rm -rf "$BUILD_TEMP_DIR"
fi
fi
rm -f "$PARENT_DIR/.ppa_build_temp_${PACKAGE_NAME}"
ARTIFACTS=( ARTIFACTS=(
"${PACKAGE_NAME}_*.dsc" "${PACKAGE_NAME}_*.dsc"
"${PACKAGE_NAME}_*.tar.xz" "${PACKAGE_NAME}_*.tar.xz"
@@ -191,7 +326,6 @@ if [ "$KEEP_BUILDS" = "false" ]; then
done done
done done
# Clean up downloaded binaries in package directory
case "$PACKAGE_NAME" in case "$PACKAGE_NAME" in
danksearch) danksearch)
if [ -f "$PACKAGE_DIR/dsearch-amd64" ]; then if [ -f "$PACKAGE_DIR/dsearch-amd64" ]; then
@@ -204,7 +338,6 @@ if [ "$KEEP_BUILDS" = "false" ]; then
fi fi
;; ;;
dms) dms)
# Remove downloaded binaries and source
if [ -f "$PACKAGE_DIR/dms-distropkg-amd64.gz" ]; then if [ -f "$PACKAGE_DIR/dms-distropkg-amd64.gz" ]; then
rm -f "$PACKAGE_DIR/dms-distropkg-amd64.gz" rm -f "$PACKAGE_DIR/dms-distropkg-amd64.gz"
REMOVED=$((REMOVED + 1)) REMOVED=$((REMOVED + 1))

View File

@@ -1 +0,0 @@
danksearch_0.0.7ppa3_source.buildinfo utils optional

View File

@@ -1 +0,0 @@
dgop_0.1.11ppa2_source.buildinfo utils optional

View File

@@ -1,6 +1,5 @@
dms-git (0.6.2+git2419.993f14a3) questing; urgency=medium dms-git (1.0.2+git2491.db2f68e3ppa4) questing; urgency=medium
* widgets: make dank icon picker a popup * Git snapshot (commit 2491: db2f68e3)
* Previous updates included in build
-- Avenge Media <AvengeMedia.US@gmail.com> Mon, 09 Dec 2025 14:00:00 +0000 -- Avenge Media <AvengeMedia.US@gmail.com> Fri, 12 Dec 2025 22:11:26 -0500

View File

@@ -1 +1 @@
dms-git_0.6.2+git2169.f7f1bbbdppa10_source.buildinfo x11 optional dms-git_1.0.2+git2491.db2f68e3ppa4_source.buildinfo x11 optional

View File

@@ -1 +0,0 @@
dms-greeter_0.6.2ppa3_source.buildinfo x11 optional

View File

@@ -1 +0,0 @@
dms_1.0.0ppa4_source.buildinfo x11 optional