summaryrefslogtreecommitdiff
path: root/toru-path
blob: b82dbb2ba934f3ff8d63b4cde153cc55faaad948 (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
#!/bin/bash

source $(dirname $(command -v $0))/toru-utils

LASTSYNCFILE=${TORUPATH}/lastsync.paths

# TODO pass other paths via flags
pkgbuilds=($(get_pkgbuilds ${ABSROOT}))
paths=()

msg "Updating path cache"
msg2 "${#pkgbuilds[@]} PKGBUILDs to update"
for _pkgbuild in ${pkgbuilds[@]}; do
  $DEBUG && plain "$_pkgbuild"
  source ${_pkgbuild} || {
    error "${_pkgbuild} contains errors, skipping"
    continue
  }

  fullpath=$(dirname $(readlink -f ${_pkgbuild}))

  for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do
    paths+=(${_pkg/[<>=]*}:${fullpath})
  done

  unset pkgname provides
done
  
# TODO remove old paths
echo ${paths[@]} | tr ' ' "\n" | sort >> ${TORUPATH}/paths

lastsync ${LASTSYNCFILE}