forked from vieter-v/vieter
Merge pull request 'AUR tools' (#263) from Chewing_Bever/vieter:aur-tools into dev
Reviewed-on: vieter-v/vieter#263main
commit
8a2b121cc7
|
@ -27,3 +27,6 @@ gdb.txt
|
||||||
# Generated docs
|
# Generated docs
|
||||||
_docs/
|
_docs/
|
||||||
/man/
|
/man/
|
||||||
|
|
||||||
|
# VLS logs
|
||||||
|
vls.log
|
||||||
|
|
|
@ -7,7 +7,7 @@ platform: ${PLATFORM}
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
install-modules:
|
install-modules:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- export VMODULES=$PWD/.vmodules
|
- export VMODULES=$PWD/.vmodules
|
||||||
|
@ -16,7 +16,7 @@ pipeline:
|
||||||
event: [push, pull_request]
|
event: [push, pull_request]
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
commands:
|
commands:
|
||||||
- export VMODULES=$PWD/.vmodules
|
- export VMODULES=$PWD/.vmodules
|
||||||
- make
|
- make
|
||||||
|
@ -26,7 +26,7 @@ pipeline:
|
||||||
exclude: [main]
|
exclude: [main]
|
||||||
|
|
||||||
prod:
|
prod:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
environment:
|
environment:
|
||||||
- LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static
|
- LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static
|
||||||
commands:
|
commands:
|
||||||
|
@ -44,7 +44,7 @@ pipeline:
|
||||||
event: [push, pull_request]
|
event: [push, pull_request]
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
secrets: [ s3_username, s3_password ]
|
secrets: [ s3_username, s3_password ]
|
||||||
commands:
|
commands:
|
||||||
# https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f
|
# https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f
|
||||||
|
|
|
@ -11,7 +11,7 @@ pipeline:
|
||||||
- make docs
|
- make docs
|
||||||
|
|
||||||
api-docs:
|
api-docs:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
pull: true
|
pull: true
|
||||||
group: 'generate'
|
group: 'generate'
|
||||||
commands:
|
commands:
|
||||||
|
|
|
@ -8,7 +8,7 @@ skip_clone: true
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
prepare:
|
prepare:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
pull: true
|
pull: true
|
||||||
secrets: [ s3_username, s3_password ]
|
secrets: [ s3_username, s3_password ]
|
||||||
commands:
|
commands:
|
||||||
|
|
|
@ -5,7 +5,7 @@ platform: 'linux/amd64'
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
lint:
|
lint:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- make lint
|
- make lint
|
||||||
|
|
|
@ -9,7 +9,7 @@ skip_clone: true
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
generate:
|
generate:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- curl -o vieter -L "https://s3.rustybever.be/vieter/commits/$CI_COMMIT_SHA/vieter-linux-amd64"
|
- curl -o vieter -L "https://s3.rustybever.be/vieter/commits/$CI_COMMIT_SHA/vieter-linux-amd64"
|
||||||
|
|
|
@ -9,7 +9,7 @@ platform: ${PLATFORM}
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
install-modules:
|
install-modules:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- export VMODULES=$PWD/.vmodules
|
- export VMODULES=$PWD/.vmodules
|
||||||
|
@ -18,7 +18,7 @@ pipeline:
|
||||||
event: [pull_request]
|
event: [pull_request]
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:0.3'
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- export VMODULES=$PWD/.vmodules
|
- export VMODULES=$PWD/.vmodules
|
||||||
|
|
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
URL to a PKGBUILD
|
URL to a PKGBUILD
|
||||||
* Targets with kind 'url' can provide a direct URL to a PKGBUILD instead of
|
* Targets with kind 'url' can provide a direct URL to a PKGBUILD instead of
|
||||||
providing a Git repository
|
providing a Git repository
|
||||||
|
* CLI commands for searching the AUR & directly adding packages
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM chewingbever/vlang:latest AS builder
|
FROM chewingbever/vlang:0.3 AS builder
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG CI_COMMIT_SHA
|
ARG CI_COMMIT_SHA
|
||||||
|
|
4
PKGBUILD
4
PKGBUILD
|
@ -5,9 +5,9 @@ pkgbase='vieter'
|
||||||
pkgname='vieter'
|
pkgname='vieter'
|
||||||
pkgver='0.3.0'
|
pkgver='0.3.0'
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Vieter is a lightweight implementation of an Arch repository server."
|
pkgdesc="Lightweight Arch repository server & package build system"
|
||||||
depends=('glibc' 'openssl' 'libarchive' 'sqlite')
|
depends=('glibc' 'openssl' 'libarchive' 'sqlite')
|
||||||
makedepends=('git' 'vieter-v')
|
makedepends=('git' 'vlang')
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
url='https://git.rustybever.be/vieter-v/vieter'
|
url='https://git.rustybever.be/vieter-v/vieter'
|
||||||
license=('AGPL3')
|
license=('AGPL3')
|
||||||
|
|
|
@ -5,9 +5,9 @@ pkgbase='vieter-git'
|
||||||
pkgname='vieter-git'
|
pkgname='vieter-git'
|
||||||
pkgver=0.2.0.r25.g20112b8
|
pkgver=0.2.0.r25.g20112b8
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Vieter is a lightweight implementation of an Arch repository server."
|
pkgdesc="Lightweight Arch repository server & package build system (development version)"
|
||||||
depends=('glibc' 'openssl' 'libarchive' 'sqlite')
|
depends=('glibc' 'openssl' 'libarchive' 'sqlite')
|
||||||
makedepends=('git' 'vieter-v')
|
makedepends=('git' 'vlang')
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
url='https://git.rustybever.be/vieter-v/vieter'
|
url='https://git.rustybever.be/vieter-v/vieter'
|
||||||
license=('AGPL3')
|
license=('AGPL3')
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
module aur
|
||||||
|
|
||||||
|
import cli
|
||||||
|
import console
|
||||||
|
import client
|
||||||
|
import vieter_v.aur
|
||||||
|
import vieter_v.conf as vconf
|
||||||
|
|
||||||
|
struct Config {
|
||||||
|
address string [required]
|
||||||
|
api_key string [required]
|
||||||
|
}
|
||||||
|
|
||||||
|
// cmd returns the cli module for interacting with the AUR API.
|
||||||
|
pub fn cmd() cli.Command {
|
||||||
|
return cli.Command{
|
||||||
|
name: 'aur'
|
||||||
|
description: 'Interact with the AUR.'
|
||||||
|
commands: [
|
||||||
|
cli.Command{
|
||||||
|
name: 'search'
|
||||||
|
description: 'Search for packages.'
|
||||||
|
required_args: 1
|
||||||
|
execute: fn (cmd cli.Command) ? {
|
||||||
|
c := aur.new()
|
||||||
|
pkgs := c.search(cmd.args[0])?
|
||||||
|
data := pkgs.map([it.name, it.description])
|
||||||
|
|
||||||
|
println(console.pretty_table(['name', 'description'], data)?)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cli.Command{
|
||||||
|
name: 'add'
|
||||||
|
usage: 'repo pkg-name [pkg-name...]'
|
||||||
|
description: 'Add the given AUR package(s) to Vieter. Non-existent packages will be silently ignored.'
|
||||||
|
required_args: 2
|
||||||
|
execute: fn (cmd cli.Command) ? {
|
||||||
|
config_file := cmd.flags.get_string('config-file')?
|
||||||
|
conf := vconf.load<Config>(prefix: 'VIETER_', default_path: config_file)?
|
||||||
|
|
||||||
|
c := aur.new()
|
||||||
|
pkgs := c.info(cmd.args[1..])?
|
||||||
|
|
||||||
|
vc := client.new(conf.address, conf.api_key)
|
||||||
|
|
||||||
|
for pkg in pkgs {
|
||||||
|
vc.add_target(
|
||||||
|
kind: 'git'
|
||||||
|
url: 'https://aur.archlinux.org/$pkg.package_base' + '.git'
|
||||||
|
repo: cmd.args[0]
|
||||||
|
) or {
|
||||||
|
println('Failed to add $pkg.name: $err.msg()')
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
println('Added $pkg.name' + '.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import console.targets
|
||||||
import console.logs
|
import console.logs
|
||||||
import console.schedule
|
import console.schedule
|
||||||
import console.man
|
import console.man
|
||||||
|
import console.aur
|
||||||
import cron
|
import cron
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -31,6 +32,7 @@ fn main() {
|
||||||
logs.cmd(),
|
logs.cmd(),
|
||||||
schedule.cmd(),
|
schedule.cmd(),
|
||||||
man.cmd(),
|
man.cmd(),
|
||||||
|
aur.cmd(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
app.setup()
|
app.setup()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
Module {
|
Module {
|
||||||
dependencies: [
|
dependencies: [
|
||||||
'https://git.rustybever.be/vieter-v/conf',
|
'https://git.rustybever.be/vieter-v/conf',
|
||||||
'https://git.rustybever.be/vieter-v/docker'
|
'https://git.rustybever.be/vieter-v/docker',
|
||||||
|
'https://git.rustybever.be/vieter-v/aur'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue