summaryrefslogtreecommitdiff
path: root/toru-path
blob: 5081115b520a3da9feaa51c90a4c70fec6ee8a42 (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 ${pkgname[@]} ${provides[@]}; do
    paths+=(${_pkg/[<>=]*}:${fullpath})
  done

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

lastsync ${LASTSYNCFILE}