diff options
author | Joshua I. Haase H. (xihh) <hahj87@gmail.com> | 2012-06-04 19:45:21 -0500 |
---|---|---|
committer | Joshua I. Haase H. (xihh) <hahj87@gmail.com> | 2012-06-04 19:45:21 -0500 |
commit | ff089d0a64dbf280c73e2ad6b11f82d015e229bd (patch) | |
tree | caec8d8d7db10fa127c3c9fc4bffd14b61cf3cd5 | |
parent | f39ca23301931899d1bf57dad1144983e1df9b8c (diff) |
fix https://labs.parabola.nu/issues/30
fullpkg-find:
- «copy_files» function added
- removed «circular deps» unused code
-rwxr-xr-x | fullpkg-find | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/fullpkg-find b/fullpkg-find index 64c1790..2f3aaaa 100755 --- a/fullpkg-find +++ b/fullpkg-find @@ -31,6 +31,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 +93,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" @@ -87,7 +117,7 @@ find_deps() { # 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 + local pkgdir=$(where_is ${_dep}) || true if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then found=true @@ -133,7 +163,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 +175,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 +215,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 |