summaryrefslogtreecommitdiff
path: root/fullpkg-find
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-05 11:44:26 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-05 11:44:26 -0300
commit369245e8dbee7ad97acec087de77081627a255db (patch)
tree8e128b0bad84d042b0d504e3e5ed726b0ffe9457 /fullpkg-find
parent3d3156b97f679a84210c08ca7e7563691d988a3b (diff)
parent9983b0c757834d61b9099a5953dec9d92330ac76 (diff)
Merge branch 'master' of git://ponape.local/libretools
Diffstat (limited to 'fullpkg-find')
-rwxr-xr-xfullpkg-find58
1 files changed, 34 insertions, 24 deletions
diff --git a/fullpkg-find b/fullpkg-find
index 64c1790..e188ec8 100755
--- a/fullpkg-find
+++ b/fullpkg-find
@@ -11,14 +11,6 @@ guess_repo() {
basename $(dirname $(pwd))
}
-# Finds a PKGBUILD on toru's path cache
-# Look in all caches but pick the first one
-# TODO move to a toru flag (-p?)
-where_is() {
- grep -m1 "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \
- cut -d: -f2 2>/dev/null
-}
-
# return : full version spec, including epoch (if necessary), pkgver, pkgrel
# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel )
get_fullver() {
@@ -31,6 +23,36 @@ get_fullver() {
}
+copy_files() {
+
+ local copydir="$build_dir/${pkgbase:-${pkgname[0]}}"
+ mkdir -p "$copydir"
+
+ # Copy PKGBUILD and sources
+ cp PKGBUILD "$copydir"
+ (
+ source PKGBUILD
+ for file in "${source[@]}"; do
+ file="${file%%::*}"
+ file="${file##*://*/}"
+ if [[ -f $file ]]; then
+ cp "$file" "$copydir/"
+ elif [[ -f $SRCDEST/$file ]]; then
+ cp "$SRCDEST/$file" "$copydir/"
+ fi
+ done
+
+ # Find all changelog and install files, even inside functions
+ for i in 'changelog' 'install'; do
+ while read -r file; do
+ # evaluate any bash variables used
+ eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
+ [[ -f $file ]] && cp "$file" "$copydir"
+ done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
+ done
+ )
+}
+
# Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated.
find_deps() {
# Check this level
@@ -63,7 +85,7 @@ find_deps() {
exit 0
# Copy dir to build_dir
else
- cp -r ../${pkgbase}/ ${build_dir}/
+ copy_files
# to identify repo later
echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO"
@@ -84,7 +106,6 @@ find_deps() {
for _dep in ${deps[@]}; do
local found=false
-# TODO change for where_is or toru-path
# May fail, e.g. since abslibre-mips64el doesn't include
# arch=any packages.
local pkgdir=$(toru -p ${_dep}) || true
@@ -133,7 +154,7 @@ usage() {
echo ""
echo "OPTIONS:"
echo " -h : this message."
-# echo " -A <absroot> : use this ABSROOT." # Is it needed anymore?
+ echo " -A <absroot> : use this ABSROOT."
echo " -c : clean <build_dir> before working."
echo " -m <max_level> : check deps until this level"
echo " -n : don't update pacman db."
@@ -145,7 +166,7 @@ usage() {
while getopts 'hA:l:cmn' arg; do
case "$arg" in
h) usage ;;
-# A) ABSROOT="$OPTARG" ;;
+ A) ABSROOT="$OPTARG" ;;
l) LEVEL="$OPTARG" ;; # hidden option to know dep level.
c) CLEANFIRST='true' ;;
m) MAXLEVEL="$OPTARG" ;;
@@ -185,18 +206,7 @@ if [ "$LEVEL" -eq 0 ]; then
msg "Checking dependencies"
fi
-# Probable circular deps
-[ "$LEVEL" -gt "$MAXLEVEL" ] && exit 20
-
# Find the dependencies on the ABS itself
-find_deps || {
-
-# Probable circular deps
- if [ "$?" -eq 20 -a "$LEVEL" -eq 0 ]; then
- error "Check for circular deps on $build_dir/BUILDORDER";
- fi
-# Pass message 20
- exit 20
-}
+find_deps
exit 0