summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ac4d5a0580a73458a7846606077d1e964583195e (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Maintainer: Firstpick firstpick1992@proton.me
pkgname=pacsea-git
pkgver=0.8.1.r7.g9d02b92
pkgrel=2
pkgdesc="Fast TUI for searching, inspecting, and queueing pacman/AUR packages written in Rust (git version)"
arch=('x86_64')
url="https://github.com/Firstp1ck/Pacsea"
license=('MIT')
depends=('pacman' 'curl' 'bash' 'sudo' 'coreutils' 'grep' 'xdg-utils')
optdepends=(
    'paru: AUR package installation'
    'yay: alternative AUR helper'
    'wl-clipboard: clipboard support on Wayland'
    'xclip: clipboard support on X11'
    'reflector: update Arch mirrors'
    'pacman-mirrors: Manjaro mirrorlist'
    'rate-mirrors: Artix mirror rating'
    'alacritty: run external commands in a terminal'
    'kitty: run external commands in a terminal'
    'ghostty: run external commands in a terminal'
    'xterm: run external commands in a terminal'
    'gnome-terminal: run external commands in a terminal'
    'konsole: run external commands in a terminal'
    'xfce4-terminal: run external commands in a terminal'
    'tilix: run external commands in a terminal'
    'mate-terminal: run external commands in a terminal'
    'neovim: external editor'
    'vim: external editor'
    'emacs: external editor'
    'helix: external editor'
    'nano: external editor'
    'klipper: clipboard manager on X11'
    'clamav: malware scanning of files'
    'trivy: vulnerability scanning'
    'semgrep-bin: static analysis checks'
    'shellcheck: lint shell scripts'
    'downgrade: Downgrade of Packages'
    'pacman-contrib: Used as a fallback for update checking'    
)

makedepends=('cargo' 'git')
conflicts=('pacsea' 'pacsea-bin')
provides=('pacsea')
# Empty source array - using custom source() function for sparse checkout
source=()
sha256sums=()

# Custom source function to clone with sparse checkout, excluding Images/ and Release-docs/
source() {
  cd "$srcdir" || exit 1
  if [ ! -d Pacsea ]; then
    git clone --filter=blob:none --sparse https://github.com/Firstp1ck/Pacsea.git Pacsea
  fi
  cd Pacsea || exit 1
  git sparse-checkout init --no-cone
  git sparse-checkout set '/*' \
  '!/Images' '!/Release-docs' \
  '!/AGENTS.md' '!/CLAUDE.md' '!/CODE_OF_CONDUCT.md' \
  '!/CONTRIBUTING.md' '!/Makefile' '!/deny.toml' \
  '!/rustfmt.toml' '!/clippy.toml' '!/.gitleaks.toml' \
  '!/pacsea.code-workspace'
  git checkout 2>/dev/null || true
}

pkgver() {
  if [ ! -d "$srcdir/Pacsea" ]; then
    source >/dev/null 2>&1
  fi
  cd "$srcdir/Pacsea" || exit 1
  git describe --tags --long --always \
    | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  if [ ! -d "$srcdir/Pacsea" ]; then
    source
  fi
  cd "$srcdir/Pacsea" || exit 1
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "$srcdir/Pacsea" || exit 1
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release --all-features
}

check() {
  cd "$srcdir/Pacsea" || exit 1
  export RUSTUP_TOOLCHAIN=stable
  cargo test --frozen --release --all-features -- --test-threads=1
}

package() {
  cd "$srcdir/Pacsea" || exit 1
  install -Dm755 "target/release/pacsea" "$pkgdir/usr/bin/pacsea"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
  
  # Install i18n configuration
  install -Dm644 "config/i18n.yml" "$pkgdir/usr/share/pacsea/config/i18n.yml"
  
  # Install locale files
  install -d "$pkgdir/usr/share/pacsea/locales"
  install -m644 config/locales/*.yml "$pkgdir/usr/share/pacsea/locales/"
}