Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: /, bin/
Date: Thu, 05 Jun 2014 22:09:28
Message-Id: 1399426010.b66b35e438437f20aeb2e0f24e2ec06654b33b8b.dywi@gentoo
1 commit: b66b35e438437f20aeb2e0f24e2ec06654b33b8b
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Wed May 7 01:26:50 2014 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Wed May 7 01:26:50 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b66b35e4
7
8 bin/: add roverlay-others
9
10 Runs roverlay with ROVERLAY_TARGET_TYPE=foreign
11
12 ---
13 bin/invoke_pyscript.bash | 39 +++++++++++++++++++++++++++++++++++----
14 bin/roverlay | 25 +------------------------
15 bin/roverlay.others | 1 +
16 roverlay-others.py | 1 +
17 4 files changed, 38 insertions(+), 28 deletions(-)
18
19 diff --git a/bin/invoke_pyscript.bash b/bin/invoke_pyscript.bash
20 index 41af30d..574405e 100755
21 --- a/bin/invoke_pyscript.bash
22 +++ b/bin/invoke_pyscript.bash
23 @@ -1,10 +1,41 @@
24 #!/bin/bash
25 -readonly SCRIPT=$(readlink -f "${BASH_SOURCE[0]?}")
26 -readonly SCRIPT_NAME="${BASH_SOURCE[0]##*/}"
27 +readonly SCRIPT="$(readlink -f "${BASH_SOURCE[0]?}")"
28 +readonly SCRIPT_FILENAME="${BASH_SOURCE[0]##*/}"
29 readonly SCRIPT_DIR="${SCRIPT%/*}"
30 -
31 readonly PRJROOT="${SCRIPT_DIR%/*}"
32 -readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME%.*}.py"
33 +
34 +extra_args=()
35 +
36 +SCRIPT_NAME="${SCRIPT_FILENAME%.py}"
37 +case "${SCRIPT_NAME}" in
38 + *[-_.]others)
39 + export ROVERLAY_TARGET_TYPE="foreign"
40 + SCRIPT_NAME="${SCRIPT_NAME%[-_.]*}"
41 + ;;
42 + *)
43 + : ${ROVERLAY_TARGET_TYPE:=gentoo}
44 + SCRIPT_NAME="${SCRIPT_NAME}"
45 + ;;
46 +esac
47 +
48 +case "${SCRIPT_NAME}" in
49 + 'roverlay') SCRIPT_NAME="main" ;;
50 +esac
51 +readonly SCRIPT_NAME
52 +
53 +if [[ "${ROVERLAY_TARGET_TYPE}" == "foreign" ]]; then
54 + case "${SCRIPT_NAME#roverlay[_-]}" in
55 + 'setup')
56 + extra_args+=( '--target-type' 'foreign' "$@" )
57 + ;;
58 + 'main'|'query'[-_]'config'|'status')
59 + extra_args+=( '-c' "${PRJROOT}/R-overlay.conf.others" "$@" )
60 + ;;
61 + esac
62 +fi
63 +
64 +readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME}.py"
65 +[ ${#extra_args[@]} -eq 0 ] || set -- "${extra_args[@]}" "$@"
66
67 export ROVERLAY_PRJROOT="${PRJROOT}"
68 export PYTHONPATH="${PRJROOT}${PYTHONPATH:+:}${PYTHONPATH}"
69
70 diff --git a/bin/roverlay b/bin/roverlay
71 deleted file mode 100755
72 index 3c385b8..0000000
73 --- a/bin/roverlay
74 +++ /dev/null
75 @@ -1,24 +0,0 @@
76 -#!/bin/bash
77 -# similar to invoke_pyscript.bash, but uses a fixed SCRIPT_NAME
78 -#
79 -readonly SCRIPT=$(readlink -f "${BASH_SOURCE[0]?}")
80 -readonly SCRIPT_NAME="main"
81 -readonly SCRIPT_DIR="${SCRIPT%/*}"
82 -
83 -readonly PRJROOT="${SCRIPT_DIR%/*}"
84 -readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME%.*}.py"
85 -
86 -export ROVERLAY_PRJROOT="${PRJROOT}"
87 -export PYTHONPATH="${PRJROOT}${PYTHONPATH:+:}${PYTHONPATH}"
88 -
89 -
90 -cd "${PRJROOT}" || exit
91 -
92 -if [[ -z "${PYTHON-}" ]] && [[ -x "${PYSCRIPT}" ]]; then
93 - exec ${PYSCRIPT} "$@"
94 -elif [[ -f "${PYSCRIPT}" ]]; then
95 - exec ${PYTHON:-python} ${PYSCRIPT} "$@"
96 -else
97 - echo "script not found: ${PYSCRIPT}" 1>&2
98 - exit 9
99 -fi
100
101 diff --git a/bin/roverlay b/bin/roverlay
102 new file mode 120000
103 index 0000000..3f5df48
104 --- /dev/null
105 +++ b/bin/roverlay
106 @@ -0,0 +1 @@
107 +invoke_pyscript.bash
108 \ No newline at end of file
109
110 diff --git a/bin/roverlay.others b/bin/roverlay.others
111 new file mode 120000
112 index 0000000..3f5df48
113 --- /dev/null
114 +++ b/bin/roverlay.others
115 @@ -0,0 +1 @@
116 +invoke_pyscript.bash
117 \ No newline at end of file
118
119 diff --git a/roverlay-others.py b/roverlay-others.py
120 new file mode 120000
121 index 0000000..466a6fb
122 --- /dev/null
123 +++ b/roverlay-others.py
124 @@ -0,0 +1 @@
125 +bin/invoke_pyscript.bash
126 \ No newline at end of file