feat(targets): add pkg-pacman target (Arch Linux AUR / PKGBUILD)#486
feat(targets): add pkg-pacman target (Arch Linux AUR / PKGBUILD)#486forgou37 wants to merge 5 commits into
Conversation
Greptile SummaryAdds a new
Confidence Score: 3/5The build path (file generation) works and is well-tested, but the ship() function claims success without executing any AUR push, and .SRCINFO output will contain an unresolved shell variable in the source URL. The .SRCINFO source URL bug means every generated metadata file will have a literal packages/targets/pkg-pacman/src/index.ts — the renderSRCINFO function and the ship() non-dry-run path both need fixes before this adapter produces valid output. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant sh1pt
participant PkgPacmanAdapter
participant AUR
User->>sh1pt: sh1pt promote build (pkg-pacman)
sh1pt->>PkgPacmanAdapter: build(ctx, config)
PkgPacmanAdapter->>PkgPacmanAdapter: renderPKGBUILD(config, version)
PkgPacmanAdapter->>PkgPacmanAdapter: renderSRCINFO(config, version)
PkgPacmanAdapter-->>sh1pt: artifact: PKGBUILD
User->>sh1pt: sh1pt promote ship (pkg-pacman)
sh1pt->>PkgPacmanAdapter: ship(ctx, config)
alt dry-run
PkgPacmanAdapter-->>sh1pt: id: dry-run
else non-dry-run (NOT IMPLEMENTED)
Note over PkgPacmanAdapter,AUR: TODO: git clone AUR repo, commit PKGBUILD+.SRCINFO, push via SSH
PkgPacmanAdapter-->>sh1pt: silently returns success without pushing
end
User->>sh1pt: sh1pt status (pkg-pacman)
sh1pt->>PkgPacmanAdapter: status(id)
PkgPacmanAdapter-->>sh1pt: state: live, url
Reviews (1): Last reviewed commit: "feat(targets): add pkg-pacman tests" | Re-trigger Greptile |
| `\turl = ${config.url ?? 'https://sh1pt.com'}`, | ||
| `\tarch = ${arch}`, | ||
| `\tlicense = ${config.license ?? 'MIT'}`, | ||
| `\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replace('$pkgver', version)}`, |
There was a problem hiding this comment.
.SRCINFO source URL has only the first $pkgver substituted because String.replace(string, replacement) replaces only the first match. The default URL template contains two occurrences — one in the path segment (v$pkgver) and one in the filename (myapp-$pkgver-x86_64.tar.gz) — so the generated .SRCINFO will contain a literal $pkgver in the filename part, producing an invalid source URL that makepkg cannot download.
| `\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replace('$pkgver', version)}`, | |
| `\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replace(/\$pkgver/g, version)}`, |
| async ship(ctx, config) { | ||
| const version = ctx.version.replace(/^v/, ''); | ||
| ctx.log(`push ${config.pkgname} v${version} to AUR`); | ||
|
|
||
| if (ctx.dryRun) return { id: 'dry-run' }; | ||
|
|
||
| // TODO: push updated PKGBUILD + .SRCINFO to the AUR git remote | ||
| // AUR URL: ssh://aur@aur.archlinux.org/<pkgname>.git | ||
| // Requires AUR_SSH_KEY from ctx.secret('AUR_SSH_KEY') | ||
| return { | ||
| id: `${config.pkgname}@${version}`, | ||
| url: `https://aur.archlinux.org/packages/${config.pkgname}`, | ||
| }; | ||
| }, |
There was a problem hiding this comment.
ship() silently returns success without doing anything
The non-dry-run path falls through to return { id, url } as if the package was published, but no actual git operations are performed — the AUR push is entirely unimplemented (the TODO comment confirms this). Any caller or CI pipeline will receive a successful result and believe the package is live on AUR when nothing was pushed. At minimum the stub should throw a NotImplementedError or log a clear warning so users are not silently misled into thinking a release happened.
| 'package() {', | ||
| ` install -Dm755 "${name}" "\${pkgdir}/usr/bin/${name}"`, | ||
| ` install -Dm644 LICENSE "\${pkgdir}/usr/share/licenses/${name}/LICENSE" 2>/dev/null || true`, | ||
| '}', |
There was a problem hiding this comment.
install -Dm755 "${name}" looks for the binary in the current directory at the time package() runs. makepkg changes into $srcdir before calling package(), and most GitHub Release tarballs extract into a subdirectory (e.g. myapp-3.0.1/). Without a cd step the binary won't be found and makepkg will fail. Referencing $srcdir/<name>-$pkgver/$name (or better, searching within $srcdir) is the standard pattern.
| 'package() {', | |
| ` install -Dm755 "${name}" "\${pkgdir}/usr/bin/${name}"`, | |
| ` install -Dm644 LICENSE "\${pkgdir}/usr/share/licenses/${name}/LICENSE" 2>/dev/null || true`, | |
| '}', | |
| 'package() {', | |
| ` cd "\${srcdir}/${name}-\${pkgver}"`, | |
| ` install -Dm755 "${name}" "\${pkgdir}/usr/bin/${name}"`, | |
| ` install -Dm644 LICENSE "\${pkgdir}/usr/share/licenses/${name}/LICENSE" 2>/dev/null || true`, | |
| '}', |
Closes #477
Adds the
pkg-pacmantarget adapter for generating Arch Linux PKGBUILD and .SRCINFO files and publishing to the AUR.What
PKGBUILDwith correct variable quoting and array syntax.SRCINFOmetadata file (required by AUR)depends, buildmakedepends,provides,conflictsreleaseRepoconfigship()pushes to AUR via SSH (requiresAUR_SSH_KEYsecret)manualSetupguide for AUR account and SSH key setupRelated
Part of #133 — implements sh1pt target sub-commands.