From 46c4def0733a78ce08702d188e3e1a141fb07316 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 29 Aug 2011 10:53:50 +0200 Subject: Support non-standard install locations This build system overhaul allows for adding (define-style) macros to our scripts. All source files are now suffixed with ".in" to clarify that they might contain unprocessed defines. The Makefile provides a new rule to preprocess source files and generate proper output scripts. Also, add a "@pkgdatadir@" define (as used in GNU Autotools) and use it instead of hardcoded paths to "/usr/share/devtools" everywhere. We missed this when adding PREFIX support to the build system in commit 35fc83ce7d8dc26cd424321f2e8638d05da0a6d4. Signed-off-by: Lukas Fleischer --- finddeps.in | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 finddeps.in (limited to 'finddeps.in') diff --git a/finddeps.in b/finddeps.in new file mode 100644 index 0000000..ded7a93 --- /dev/null +++ b/finddeps.in @@ -0,0 +1,46 @@ +#!/bin/bash +# +# finddeps - find packages that depend on a given depname +# + +if [ "$1" = '' ]; then + echo 'usage: finddeps ' + echo '' + echo 'Find packages that depend on a given depname.' + echo 'Run this script from the top-level directory of your ABS tree.' + echo '' + exit 0 +fi + +match=$1 +tld=$(pwd) + +for d in $(find . -type d); do + cd $d + if [ -f PKGBUILD ]; then + unset pkgname depends makedepends + . PKGBUILD + for dep in "${depends[@]}"; do + # lose the version comparator, if any + depname=${dep%%[<>=]*} + if [ "$depname" = "$match" ]; then + echo "$d (depends)" + fi + done + for dep in "${makedepends[@]}"; do + # lose the version comparator, if any + depname=${dep%%[<>=]*} + if [ "$depname" = "$match" ]; then + echo "$d (makedepends)" + fi + done + for dep in "${optdepends[@]/:*}"; do + # lose the version comaparator, if any + depname=${dep%%[<>=]*} + if [ "$depname" = "$match" ]; then + echo "$d (optdepends)" + fi + done + fi + cd $tld +done -- cgit v1.2.3-24-g4f1b From 4800be25c2089927b340f01d974ae2707bca8a86 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 27 Sep 2011 09:40:31 +0200 Subject: finddeps: Proper quoting, use double brackets Signed-off-by: Lukas Fleischer --- finddeps.in | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'finddeps.in') diff --git a/finddeps.in b/finddeps.in index ded7a93..0d59634 100644 --- a/finddeps.in +++ b/finddeps.in @@ -3,7 +3,10 @@ # finddeps - find packages that depend on a given depname # -if [ "$1" = '' ]; then +match=$1 +tld=$(pwd) + +if [[ -z $match ]]; then echo 'usage: finddeps ' echo '' echo 'Find packages that depend on a given depname.' @@ -12,35 +15,26 @@ if [ "$1" = '' ]; then exit 0 fi -match=$1 -tld=$(pwd) - -for d in $(find . -type d); do - cd $d - if [ -f PKGBUILD ]; then +for d in "$(find . -type d)"; do + cd "$d" + if [[ -f PKGBUILD ]]; then unset pkgname depends makedepends . PKGBUILD for dep in "${depends[@]}"; do # lose the version comparator, if any depname=${dep%%[<>=]*} - if [ "$depname" = "$match" ]; then - echo "$d (depends)" - fi + [[ $depname = $match ]] && echo "$d (depends)" done for dep in "${makedepends[@]}"; do # lose the version comparator, if any depname=${dep%%[<>=]*} - if [ "$depname" = "$match" ]; then - echo "$d (makedepends)" - fi + [[ $depname = $match ]] && echo "$d (makedepends)" done for dep in "${optdepends[@]/:*}"; do # lose the version comaparator, if any depname=${dep%%[<>=]*} - if [ "$depname" = "$match" ]; then - echo "$d (optdepends)" - fi + [[ $depname = $match ]] && echo "$d (optdepends)" done fi - cd $tld + cd "$tld" done -- cgit v1.2.3-24-g4f1b From 8edb443c125cb668e6609b5ff696e565b15a6069 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 27 Sep 2011 09:43:26 +0200 Subject: finddeps: Remove redundant cd(1) Source the PKGBUILD using the correct path (relative to our base directory) instead of using cd(1) to switch to the ABS base directory first and to the package directory afterwards. This is very useful when trying to track errors, also: $ ~/src/devtools/finddeps libdaq ./community/snort (depends) PKGBUILD: line 17: ruby: command not found PKGBUILD: line 19: [: =: unary operator expected Versus: $ ~/src/devtools/finddeps libdaq ./community/snort (depends) ./community/ruby-pkgconfig/PKGBUILD: line 17: ruby: command not found ./community/lmms/PKGBUILD: line 19: [: =: unary operator expected Signed-off-by: Lukas Fleischer --- finddeps.in | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'finddeps.in') diff --git a/finddeps.in b/finddeps.in index 0d59634..ec8cde4 100644 --- a/finddeps.in +++ b/finddeps.in @@ -4,7 +4,6 @@ # match=$1 -tld=$(pwd) if [[ -z $match ]]; then echo 'usage: finddeps ' @@ -16,10 +15,9 @@ if [[ -z $match ]]; then fi for d in "$(find . -type d)"; do - cd "$d" - if [[ -f PKGBUILD ]]; then + if [[ -f "$d/PKGBUILD" ]]; then unset pkgname depends makedepends - . PKGBUILD + . "$d/PKGBUILD" for dep in "${depends[@]}"; do # lose the version comparator, if any depname=${dep%%[<>=]*} @@ -36,5 +34,4 @@ for d in "$(find . -type d)"; do [[ $depname = $match ]] && echo "$d (optdepends)" done fi - cd "$tld" done -- cgit v1.2.3-24-g4f1b From 84b789f760e91bcbcf035cca5d40c40032ad87dd Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 27 Sep 2011 09:48:13 +0200 Subject: finddeps: Use read builtin to iterate over packages Using parameter substitution might result in unpredictable behaviour when directories contain whitespaces here. The read shell builtin is the proper way to read single lines. Signed-off-by: Lukas Fleischer --- finddeps.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'finddeps.in') diff --git a/finddeps.in b/finddeps.in index ec8cde4..3f4515b 100644 --- a/finddeps.in +++ b/finddeps.in @@ -14,7 +14,7 @@ if [[ -z $match ]]; then exit 0 fi -for d in "$(find . -type d)"; do +find . -type d | while read d; do if [[ -f "$d/PKGBUILD" ]]; then unset pkgname depends makedepends . "$d/PKGBUILD" -- cgit v1.2.3-24-g4f1b From dcb80e7b5c57b14bbab2858c6c863d8f224ba43b Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 27 Sep 2011 09:52:09 +0200 Subject: finddeps: Unset optdepends The optdepends array should be unset before sourcing the PKGBUILD to avoid dangling optional depends. Signed-off-by: Lukas Fleischer --- finddeps.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'finddeps.in') diff --git a/finddeps.in b/finddeps.in index 3f4515b..4651fd9 100644 --- a/finddeps.in +++ b/finddeps.in @@ -16,7 +16,7 @@ fi find . -type d | while read d; do if [[ -f "$d/PKGBUILD" ]]; then - unset pkgname depends makedepends + unset pkgname depends makedepends optdepends . "$d/PKGBUILD" for dep in "${depends[@]}"; do # lose the version comparator, if any -- cgit v1.2.3-24-g4f1b