summarylogtreecommitdiffstats
path: root/update-aur.sh
blob: c2c981e20b1e91fa35b0749ed394c14035618398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Script to update the AUR package after a new release
# Usage: ./update-aur.sh [version]
# If version is not provided, uses the latest git tag from the main repo

set -e

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
MAIN_REPO="${SCRIPT_DIR}/../inventory-system"

# Get version
if [ -n "$1" ]; then
    VERSION="$1"
else
    # Get latest tag from main repo
    VERSION=$(git -C "$MAIN_REPO" describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
    if [ -z "$VERSION" ]; then
        echo "Error: No version specified and no git tags found in $MAIN_REPO"
        exit 1
    fi
fi

echo "Updating AUR package to version $VERSION"

# Download tarball and compute checksum
TARBALL_URL="https://github.com/tobixen/inventory-md/archive/refs/tags/v${VERSION}.tar.gz"
echo "Downloading $TARBALL_URL ..."
TMPFILE=$(mktemp)
if ! curl -sL "$TARBALL_URL" -o "$TMPFILE"; then
    echo "Error: Failed to download tarball. Is v${VERSION} tagged and pushed?"
    rm -f "$TMPFILE"
    exit 1
fi

SHA256=$(sha256sum "$TMPFILE" | cut -d' ' -f1)
rm -f "$TMPFILE"
echo "SHA256: $SHA256"

# Update PKGBUILD
cd "$SCRIPT_DIR"

cat > PKGBUILD << EOF
# Maintainer: Tobias Brox <t-arch@tobixen.no>
pkgname=inventory-md
pkgver=${VERSION}
pkgrel=1
pkgdesc="A flexible markdown-based inventory management system"
url="https://github.com/tobixen/inventory-md"
arch=('any')
license=('GPL-3.0-or-later')
depends=('python' 'python-pillow')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-hatchling' 'python-hatch-vcs')
optdepends=(
    'python-fastapi: API server and chat functionality'
    'python-uvicorn: API server'
    'python-anthropic: Claude AI chat integration'
    'python-pyzbar: Barcode scanning'
    'python-easyocr: OCR text extraction'
)
source=("\${pkgname}-\${pkgver}.tar.gz::https://github.com/tobixen/inventory-md/archive/refs/tags/v\${pkgver}.tar.gz")
sha256sums=('${SHA256}')

build() {
    cd "\${pkgname}-\${pkgver}"
    export SETUPTOOLS_SCM_PRETEND_VERSION="\${pkgver}"
    python -m build --wheel --no-isolation
}

package() {
    cd "\${pkgname}-\${pkgver}"
    python -m installer --destdir="\$pkgdir" dist/*.whl
}
EOF

echo "PKGBUILD updated"

# Regenerate .SRCINFO
makepkg --printsrcinfo > .SRCINFO
echo ".SRCINFO regenerated"

# Show status
echo ""
echo "Files updated. To publish to AUR:"
echo "  cd $SCRIPT_DIR"
echo "  git add PKGBUILD .SRCINFO"
echo "  git commit -m 'Update to $VERSION'"
echo "  git push"