Gentoo Archives: gentoo-commits

From: "Paul Varner (fuzzyray)" <fuzzyray@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoolkit r868 - in trunk/gentoolkit: . bin
Date: Wed, 24 Nov 2010 17:51:22
Message-Id: 20101124175115.8424920051@flycatcher.gentoo.org
1 Author: fuzzyray
2 Date: 2010-11-24 17:51:15 +0000 (Wed, 24 Nov 2010)
3 New Revision: 868
4
5 Modified:
6 trunk/gentoolkit/ChangeLog
7 trunk/gentoolkit/bin/euse
8 Log:
9 Update euse to look for portage config files in new as well as old paths. Bug 346519
10
11 Modified: trunk/gentoolkit/ChangeLog
12 ===================================================================
13 --- trunk/gentoolkit/ChangeLog 2010-11-23 22:05:12 UTC (rev 867)
14 +++ trunk/gentoolkit/ChangeLog 2010-11-24 17:51:15 UTC (rev 868)
15 @@ -1,3 +1,7 @@
16 +2010-11-24: Paul Varner <fuzzyray@g.o>
17 + * euse: Fix euse to look for portage configuration files in both the
18 + old and new paths. bug 346519.
19 +
20 2010-10-29: Tomáš Chvátal <scarabeus@g.o>
21 * eshowkw: Add new module as drop-in replacement for eshowkw from
22 gentoolkit-dev
23
24 Modified: trunk/gentoolkit/bin/euse
25 ===================================================================
26 --- trunk/gentoolkit/bin/euse 2010-11-23 22:05:12 UTC (rev 867)
27 +++ trunk/gentoolkit/bin/euse 2010-11-24 17:51:15 UTC (rev 868)
28 @@ -9,11 +9,42 @@
29 PROGRAM_NAME=euse
30 VERSION="svn"
31
32 -MAKE_CONF_PATH=/etc/make.conf
33 -MAKE_GLOBALS_PATH=/etc/make.globals
34 -MAKE_PROFILE_PATH=/etc/make.profile
35 -MAKE_CONF_BACKUP_PATH=/etc/make.conf.euse_backup
36 +ETC="/etc"
37 +USR_SHARE_PORTAGE="/usr/share/portage"
38
39 +# define error function so it can be used immediately
40 +error() {
41 + echo "ERROR: ${1}"
42 + set +f
43 + exit 1
44 +}
45 +
46 +# /etc/make.conf can now exist in /etc/portage/make.conf, prefer it over /etc/make.conf for changes
47 +if [ -e "${ETC}/portage/make.conf" ]; then
48 + MAKE_CONF_PATH="${ETC}/portage/make.conf"
49 +elif [ -e "${ETC}/make.conf" ]; then
50 + MAKE_CONF_PATH="${ETC}/make.conf"
51 +else
52 + error "make.conf does not exist"
53 +fi
54 +MAKE_CONF_BACKUP_PATH="${MAKE_CONF_PATH}.euse_backup"
55 +
56 +# /etc/make.globals has been moved to /usr/share/portage/config/make.globals
57 +if [ -e "${USR_SHARE_PORTAGE}/config/make.globals" ]; then
58 + MAKE_GLOBALS_PATH="${USR_SHARE_PORTAGE}/config/make.globals"
59 +else
60 + MAKE_GLOBALS_PATH="${ETC}/make.globals"
61 +fi
62 +
63 +# /etc/make.profile or /etc/portage/make.profile, if /etc/make.profile exists, it will be used
64 +if [ -e "${ETC}/make.profile" ]; then
65 + MAKE_PROFILE_PATH="${ETC}/make.profile"
66 +elif [ -e "${ETC}/portage/make.profile" ]; then
67 + MAKE_PROFILE_PATH="${ETC}/portage/make.profile"
68 +else
69 + error "make.profile does not exist"
70 +fi
71 +
72 [ -z "${MODE}" ] && MODE="showhelp" # available operation modes: showhelp, showversion, showdesc, showflags, modify
73
74 parse_arguments() {
75 @@ -49,12 +80,6 @@
76 done
77 }
78
79 -error() {
80 - echo "ERROR: ${1}"
81 - set +f
82 - exit 1
83 -}
84 -
85 get_real_path() {
86 set -P
87 cd "$1"
88 @@ -67,12 +92,16 @@
89 # file permission tests
90 local descdir
91 local make_defaults
92 + local make_conf
93
94 [[ ! -d "${MAKE_PROFILE_PATH}" || ! -r "${MAKE_PROFILE_PATH}" ]] && error "${MAKE_PROFILE_PATH} is not readable"
95 + #
96 + for make_conf in $(get_all_make_conf); do
97 + [ ! -r "${make_conf}" ] && error "${make_conf} is not readable"
98 + done
99
100 descdir="$(get_portdir)/profiles"
101
102 - [ ! -r "${MAKE_CONF_PATH}" ] && error "${MAKE_CONF_PATH} is not readable"
103 [ ! -r "${MAKE_GLOBALS_PATH}" ] && error "${MAKE_GLOBALS_PATH} is not readable"
104 [ -z "$(get_portdir)" ] && error "\$PORTDIR couldn't be determined"
105 [ ! -d "${descdir}" ] && error "${descdir} does not exist or is not a directory"
106 @@ -160,8 +189,10 @@
107
108 ACTIVE_FLAGS[0]="$(reduce_incrementals ${USE})"
109 USE=""
110 - source "${MAKE_CONF_PATH}"
111 - ACTIVE_FLAGS[1]="$(reduce_incrementals ${USE})"
112 + for x in $(get_all_make_conf); do
113 + source "${x}"
114 + ACTIVE_FLAGS[1]="$(reduce_incrementals ${ACTIVE_FLAGS[1]} ${USE})"
115 + done
116 USE=""
117 for x in $(get_all_make_defaults); do
118 source "${x}"
119 @@ -196,6 +227,13 @@
120 fi
121 }
122
123 +# get all make.conf files that exist on the system
124 +get_all_make_conf() {
125 + # At least one of the files exists or we would not have made it this far
126 + for x in ${ETC}/make.conf ${ETC}/portage/make.conf; do
127 + [ -e "${x}" ] && echo "${x}"
128 + done
129 +}
130 # get all make.defaults by traversing the cascaded profile directories
131 get_all_make_defaults() {
132 local curdir
133 @@ -272,7 +310,9 @@
134 for x in $(get_all_make_defaults); do
135 source "${x}"
136 done
137 - source "${MAKE_CONF_PATH}"
138 + for x in $(get_all_make_conf); do
139 + source "${x}"
140 + done
141 USE="${use_backup}"
142 fi
143 echo "${PORTDIR}"