summaryrefslogtreecommitdiff
path: root/bin/common-functions
blob: 2191d018db79bf80f0ab659ca504f7d1acb0c56c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

# contains functions used by more than one script

# find the PKGBUILD of a given package in a given repository
# TODO:
#  _properly_ include repository of package customizations

find_pkgbuild() {

  for prefix in "${repo_paths["packages"]}" "${repo_paths["community"]}"; do
    [ -d "${prefix}/$1" ] || continue
    ls "${prefix}/$1/repos/$2-"*"/PKGBUILD" 2> /dev/null && break
  done | \
    tr ' ' '\n' | \
    grep -v -- '-i686/PKGBUILD$' | \
    grep -v -- '-\(staging\|testing\)-[^/]\+/PKGBUILD$' | \
    sort | \
    tail -n1
}