fix(aur): address PR review comments for PKGBUILD and tests
- commit
- b46110783ea12345a76c23450750565a796093d7
- author
- bnema · · 2025-12-30 21:47 UTC
- parent
- 9712982
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +20 -19
M .github/workflows/aur.yml +6 -2
| @@ -1,5 +1,9 @@ | |||
| 1 | 1 | name: AUR Publish | |
| 2 | 2 | ||
| 3 | + | # This workflow only publishes the dumber-browser-bin package to AUR. | |
| 4 | + | # The dumber-browser-git package does not need automated updates since it | |
| 5 | + | # always builds from the latest source using `git+https://` in its PKGBUILD. | |
| 6 | + | ||
| 3 | 7 | on: | |
| 4 | 8 | workflow_run: | |
| 5 | 9 | workflows: ["Flatpak"] | |
| @@ -96,11 +100,11 @@ jobs: | |||
| 96 | 100 | " 'SKIP')" \ | |
| 97 | 101 | '' \ | |
| 98 | 102 | 'package() {' \ | |
| 99 | - | ' cd "dumber_${pkgver}"' \ | |
| 103 | + | ' cd "${srcdir}"' \ | |
| 100 | 104 | ' install -Dm755 dumber "${pkgdir}/usr/bin/dumber"' \ | |
| 101 | 105 | ' install -Dm644 "${srcdir}/dev.bnema.Dumber.desktop" "${pkgdir}/usr/share/applications/dev.bnema.Dumber.desktop"' \ | |
| 102 | 106 | ' install -Dm644 "${srcdir}/logo-512.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dev.bnema.Dumber.png"' \ | |
| 103 | - | ' install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"' \ | |
| 107 | + | ' install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"' \ | |
| 104 | 108 | '}' \ | |
| 105 | 109 | > pkgbuild/dumber-browser-bin/PKGBUILD | |
| 106 | 110 | ||
| @@ -1,5 +1,9 @@ | |||||
| 1 | name: AUR Publish | 1 | name: AUR Publish | ||
| 2 | 2 | ||||
| 3 | + | # This workflow only publishes the dumber-browser-bin package to AUR. | |||
| 4 | + | # The dumber-browser-git package does not need automated updates since it | |||
| 5 | + | # always builds from the latest source using `git+https://` in its PKGBUILD. | |||
| 6 | + | ||||
| 3 | on: | 7 | on: | ||
| 4 | workflow_run: | 8 | workflow_run: | ||
| 5 | workflows: ["Flatpak"] | 9 | workflows: ["Flatpak"] | ||
| @@ -96,11 +100,11 @@ jobs: | |||||
| 96 | " 'SKIP')" \ | 100 | " 'SKIP')" \ | ||
| 97 | '' \ | 101 | '' \ | ||
| 98 | 'package() {' \ | 102 | 'package() {' \ | ||
| 99 | - | ' cd "dumber_${pkgver}"' \ | 103 | + | ' cd "${srcdir}"' \ |
| 100 | ' install -Dm755 dumber "${pkgdir}/usr/bin/dumber"' \ | 104 | ' install -Dm755 dumber "${pkgdir}/usr/bin/dumber"' \ | ||
| 101 | ' install -Dm644 "${srcdir}/dev.bnema.Dumber.desktop" "${pkgdir}/usr/share/applications/dev.bnema.Dumber.desktop"' \ | 105 | ' install -Dm644 "${srcdir}/dev.bnema.Dumber.desktop" "${pkgdir}/usr/share/applications/dev.bnema.Dumber.desktop"' \ | ||
| 102 | ' install -Dm644 "${srcdir}/logo-512.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dev.bnema.Dumber.png"' \ | 106 | ' install -Dm644 "${srcdir}/logo-512.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dev.bnema.Dumber.png"' \ | ||
| 103 | - | ' install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"' \ | 107 | + | ' install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"' \ |
| 104 | '}' \ | 108 | '}' \ | ||
| 105 | > pkgbuild/dumber-browser-bin/PKGBUILD | 109 | > pkgbuild/dumber-browser-bin/PKGBUILD | ||
| 106 | 110 | ||||
M aur/dumber-browser-bin/PKGBUILD +2 -2
| @@ -26,9 +26,9 @@ sha256sums=('c8230e3a5258333fed401439b08c6ef7b0681dd14f4e97a7e837dfc2c4cc83a0' | |||
| 26 | 26 | 'SKIP') | |
| 27 | 27 | ||
| 28 | 28 | package() { | |
| 29 | - | cd "dumber_${pkgver}" | |
| 29 | + | cd "${srcdir}" | |
| 30 | 30 | install -Dm755 dumber "${pkgdir}/usr/bin/dumber" | |
| 31 | 31 | install -Dm644 "${srcdir}/dev.bnema.Dumber.desktop" "${pkgdir}/usr/share/applications/dev.bnema.Dumber.desktop" | |
| 32 | 32 | install -Dm644 "${srcdir}/logo-512.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dev.bnema.Dumber.png" | |
| 33 | - | install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" | |
| 33 | + | install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" | |
| 34 | 34 | } | |
| @@ -26,9 +26,9 @@ sha256sums=('c8230e3a5258333fed401439b08c6ef7b0681dd14f4e97a7e837dfc2c4cc83a0' | |||||
| 26 | 'SKIP') | 26 | 'SKIP') | ||
| 27 | 27 | ||||
| 28 | package() { | 28 | package() { | ||
| 29 | - | cd "dumber_${pkgver}" | 29 | + | cd "${srcdir}" |
| 30 | install -Dm755 dumber "${pkgdir}/usr/bin/dumber" | 30 | install -Dm755 dumber "${pkgdir}/usr/bin/dumber" | ||
| 31 | install -Dm644 "${srcdir}/dev.bnema.Dumber.desktop" "${pkgdir}/usr/share/applications/dev.bnema.Dumber.desktop" | 31 | install -Dm644 "${srcdir}/dev.bnema.Dumber.desktop" "${pkgdir}/usr/share/applications/dev.bnema.Dumber.desktop" | ||
| 32 | install -Dm644 "${srcdir}/logo-512.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dev.bnema.Dumber.png" | 32 | install -Dm644 "${srcdir}/logo-512.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dev.bnema.Dumber.png" | ||
| 33 | - | install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" | 33 | + | install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" |
| 34 | } | 34 | } | ||
M internal/infrastructure/env/manager_test.go +12 -15
| @@ -183,6 +183,11 @@ func TestIsFlatpak(t *testing.T) { | |||
| 183 | 183 | } | |
| 184 | 184 | ||
| 185 | 185 | func TestIsPacman(t *testing.T) { | |
| 186 | + | // Only run these tests on Arch-based systems with pacman | |
| 187 | + | if _, err := os.Stat("/usr/bin/pacman"); os.IsNotExist(err) { | |
| 188 | + | t.Skip("pacman not found, skipping Arch-specific tests") | |
| 189 | + | } | |
| 190 | + | ||
| 186 | 191 | tests := []struct { | |
| 187 | 192 | name string | |
| 188 | 193 | binary string | |
| @@ -200,24 +205,16 @@ func TestIsPacman(t *testing.T) { | |||
| 200 | 205 | }, | |
| 201 | 206 | } | |
| 202 | 207 | ||
| 203 | - | // Only run these tests on Arch-based systems with pacman | |
| 204 | - | if _, err := os.Stat("/usr/bin/pacman"); os.IsNotExist(err) { | |
| 205 | - | t.Skip("pacman not found, skipping Arch-specific tests") | |
| 206 | - | } | |
| 207 | - | ||
| 208 | 208 | for _, tt := range tests { | |
| 209 | 209 | t.Run(tt.name, func(t *testing.T) { | |
| 210 | 210 | // We can't easily test IsPacman directly since it uses os.Executable() | |
| 211 | - | // but we can test the underlying logic with exec.Command | |
| 212 | - | if tt.binary == "/usr/bin/bash" { | |
| 213 | - | // Verify pacman -Qo works for a known system binary | |
| 214 | - | cmd := exec.Command("pacman", "-Qo", tt.binary) | |
| 215 | - | err := cmd.Run() | |
| 216 | - | if tt.expected { | |
| 217 | - | assert.NoError(t, err, "pacman should own %s", tt.binary) | |
| 218 | - | } else { | |
| 219 | - | assert.Error(t, err, "pacman should not own %s", tt.binary) | |
| 220 | - | } | |
| 211 | + | // but we can test the underlying pacman -Qo logic with exec.Command | |
| 212 | + | cmd := exec.Command("pacman", "-Qo", tt.binary) | |
| 213 | + | err := cmd.Run() | |
| 214 | + | if tt.expected { | |
| 215 | + | assert.NoError(t, err, "pacman should own %s", tt.binary) | |
| 216 | + | } else { | |
| 217 | + | assert.Error(t, err, "pacman should not own %s", tt.binary) | |
| 221 | 218 | } | |
| 222 | 219 | }) | |
| 223 | 220 | } | |
| @@ -183,6 +183,11 @@ func TestIsFlatpak(t *testing.T) { | |||||
| 183 | } | 183 | } | ||
| 184 | 184 | ||||
| 185 | func TestIsPacman(t *testing.T) { | 185 | func TestIsPacman(t *testing.T) { | ||
| 186 | + | // Only run these tests on Arch-based systems with pacman | |||
| 187 | + | if _, err := os.Stat("/usr/bin/pacman"); os.IsNotExist(err) { | |||
| 188 | + | t.Skip("pacman not found, skipping Arch-specific tests") | |||
| 189 | + | } | |||
| 190 | + | ||||
| 186 | tests := []struct { | 191 | tests := []struct { | ||
| 187 | name string | 192 | name string | ||
| 188 | binary string | 193 | binary string | ||
| @@ -200,24 +205,16 @@ func TestIsPacman(t *testing.T) { | |||||
| 200 | }, | 205 | }, | ||
| 201 | } | 206 | } | ||
| 202 | 207 | ||||
| 203 | - | // Only run these tests on Arch-based systems with pacman | |||
| 204 | - | if _, err := os.Stat("/usr/bin/pacman"); os.IsNotExist(err) { | |||
| 205 | - | t.Skip("pacman not found, skipping Arch-specific tests") | |||
| 206 | - | } | |||
| 207 | - | ||||
| 208 | for _, tt := range tests { | 208 | for _, tt := range tests { | ||
| 209 | t.Run(tt.name, func(t *testing.T) { | 209 | t.Run(tt.name, func(t *testing.T) { | ||
| 210 | // We can't easily test IsPacman directly since it uses os.Executable() | 210 | // We can't easily test IsPacman directly since it uses os.Executable() | ||
| 211 | - | // but we can test the underlying logic with exec.Command | 211 | + | // but we can test the underlying pacman -Qo logic with exec.Command |
| 212 | - | if tt.binary == "/usr/bin/bash" { | 212 | + | cmd := exec.Command("pacman", "-Qo", tt.binary) |
| 213 | - | // Verify pacman -Qo works for a known system binary | 213 | + | err := cmd.Run() |
| 214 | - | cmd := exec.Command("pacman", "-Qo", tt.binary) | 214 | + | if tt.expected { |
| 215 | - | err := cmd.Run() | 215 | + | assert.NoError(t, err, "pacman should own %s", tt.binary) |
| 216 | - | if tt.expected { | 216 | + | } else { |
| 217 | - | assert.NoError(t, err, "pacman should own %s", tt.binary) | 217 | + | assert.Error(t, err, "pacman should not own %s", tt.binary) |
| 218 | - | } else { | |||
| 219 | - | assert.Error(t, err, "pacman should not own %s", tt.binary) | |||
| 220 | - | } | |||
| 221 | } | 218 | } | ||
| 222 | }) | 219 | }) | ||
| 223 | } | 220 | } | ||