1 |
commit: 4244739b888da20e9203b2ccd6c16978790865e7 |
2 |
Author: Andre Erdmann <dywi <AT> mailerd <DOT> de> |
3 |
AuthorDate: Wed May 30 18:03:44 2012 +0000 |
4 |
Commit: André Erdmann <dywi <AT> mailerd <DOT> de> |
5 |
CommitDate: Wed May 30 18:03:44 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=4244739b |
7 |
|
8 |
test_ebuildcreation.sh: temporary script; tests run_ebuildcreation.py with a high package number at once |
9 |
new file: test_ebuildcreation.sh |
10 |
|
11 |
--- |
12 |
test_ebuildcreation.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ |
13 |
1 files changed, 56 insertions(+), 0 deletions(-) |
14 |
|
15 |
diff --git a/test_ebuildcreation.sh b/test_ebuildcreation.sh |
16 |
new file mode 100755 |
17 |
index 0000000..7f838e8 |
18 |
--- /dev/null |
19 |
+++ b/test_ebuildcreation.sh |
20 |
@@ -0,0 +1,56 @@ |
21 |
+#!/bin/bash |
22 |
+set -u |
23 |
+set -e |
24 |
+readonly ARGV="$*" |
25 |
+readonly _SELF="${0##*/}" |
26 |
+readonly _SELF_NAME="${_SELF%.*sh}" |
27 |
+readonly TEST_SECTION="${_SELF_NAME#test_}" |
28 |
+# |
29 |
+readonly py=python3 |
30 |
+# |
31 |
+_ROOT=`pwd` |
32 |
+if [[ ! -e "${_ROOT}/examples" ]]; then |
33 |
+ _ROOT="${_ROOT%/*}" |
34 |
+fi |
35 |
+readonly EXAMPLES="${_ROOT}/examples" |
36 |
+readonly PKGDIR="${EXAMPLES}/packages" |
37 |
+ |
38 |
+ |
39 |
+if [[ "${TEST_SECTION}" == "ebuildcreation" ]]; then |
40 |
+ if [[ "${1:-}" == "-q" ]]; then |
41 |
+ q=1 |
42 |
+ shift ||: |
43 |
+ else q=0; fi |
44 |
+ |
45 |
+ declare -i multiply=${1:-1} |
46 |
+ [[ $multiply -gt 0 ]] || multiply=1 |
47 |
+ pkgline="" |
48 |
+ pkgcount=0 |
49 |
+ for x in "${PKGDIR}"/*.tar.gz "${PKGDIR}"/*.tgz; do |
50 |
+ if [[ -r "$x" ]]; then |
51 |
+ pkgline+=" ${x}" |
52 |
+ ((pkgcount++)) ||: |
53 |
+ fi |
54 |
+ done |
55 |
+ pkgline="${pkgline# }" |
56 |
+ |
57 |
+ argline="" |
58 |
+ for i in `seq 1 $multiply`; do |
59 |
+ argline+=" ${pkgline}" |
60 |
+ done |
61 |
+ |
62 |
+ num=$(( $multiply * $pkgcount )) |
63 |
+ echo "Please note: python may return 'Argument list too long'. Double check your result if it's too fantastic to believe. (28500 pkgs could work, but 30000 don't)." 1>&2 |
64 |
+ echo "Creating $num packages" 1>&2 |
65 |
+ time { |
66 |
+ if [[ $q -eq 1 ]]; then |
67 |
+ &>/dev/null $py "${_ROOT}/run_ebuildcreation.py" $argline || echo fail 1>&2 |
68 |
+ else |
69 |
+ $py "${_ROOT}/run_ebuildcreation.py" $argline |
70 |
+ fi; |
71 |
+ } |
72 |
+ echo "Done creating $num packages" 1>&2 |
73 |
+else |
74 |
+ echo "test section not defined: ${TEST_SECTION}" |
75 |
+ exit ${__UNDEF__:-102} |
76 |
+fi |