Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 1/3] cvs.eclass: Remove support for running under sudo.
Date: Thu, 18 Jul 2019 10:19:36
Message-Id: w6g4l3jir0v.fsf@kph.uni-mainz.de
In Reply to: [gentoo-dev] [PATCH 0/3] cvs.eclass update by "Ulrich Müller"
1 This neither works, nor is it used in the tree.
2
3 Signed-off-by: Ulrich Müller <ulm@g.o>
4 ---
5 eclass/cvs.eclass | 53 +++++++----------------------------------------
6 1 file changed, 8 insertions(+), 45 deletions(-)
7
8 diff --git a/eclass/cvs.eclass b/eclass/cvs.eclass
9 index e2121f4724f2..128c065ebe78 100644
10 --- a/eclass/cvs.eclass
11 +++ b/eclass/cvs.eclass
12 @@ -1,4 +1,4 @@
13 -# Copyright 1999-2017 Gentoo Foundation
14 +# Copyright 1999-2019 Gentoo Authors
15 # Distributed under the terms of the GNU General Public License v2
16
17 # @ECLASS: cvs.eclass
18 @@ -174,22 +174,10 @@ inherit eutils
19 # Set this to get a clean copy when updating (passes the
20 # -C option to cvs update)
21
22 -# @ECLASS-VARIABLE: ECVS_RUNAS
23 -# @DEFAULT_UNSET
24 -# @DESCRIPTION:
25 -# Specifies an alternate (non-root) user to use to run cvs. Currently
26 -# b0rked and wouldn't work with portage userpriv anyway without
27 -# special magic.
28 -
29 -# : ${ECVS_RUNAS:=$(whoami)}
30 -
31 # add cvs to deps
32 # ssh is used for ext auth
33 -# sudo is used to run as a specified user
34 DEPEND="dev-vcs/cvs"
35
36 -[[ -n ${ECVS_RUNAS} ]] && DEPEND+=" app-admin/sudo"
37 -
38 if [[ ${ECVS_AUTH} == "ext" ]] ; then
39 #default to ssh
40 [[ -z ${CVS_RSH} ]] && export CVS_RSH="ssh"
41 @@ -250,15 +238,6 @@ cvs_fetch() {
42 ECVS_UP_OPTS+=" -D ${ECVS_DATE}"
43 fi
44
45 - # It would be easiest to always be in "run-as mode", logic-wise,
46 - # if sudo didn't ask for a password even when sudo'ing to `whoami`.
47 -
48 - if [[ -z ${ECVS_RUNAS} ]] ; then
49 - run=""
50 - else
51 - run="sudo -u ${ECVS_RUNAS}"
52 - fi
53 -
54 # Create the top dir if needed
55
56 if [[ ! -d ${ECVS_TOP_DIR} ]] ; then
57 @@ -274,7 +253,7 @@ cvs_fetch() {
58 debug-print "${FUNCNAME}: checkout mode. creating cvs directory"
59 addwrite /foobar
60 addwrite /
61 - ${run} mkdir -p "/${ECVS_TOP_DIR}"
62 + mkdir -p "/${ECVS_TOP_DIR}"
63 export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
64 fi
65
66 @@ -287,11 +266,6 @@ cvs_fetch() {
67 # Disable the sandbox for this dir
68 addwrite "${ECVS_TOP_DIR}"
69
70 - # Chown the directory and all of its contents
71 - if [[ -n ${ECVS_RUNAS} ]] ; then
72 - ${run} chown -R "${ECVS_RUNAS}" "/${ECVS_TOP_DIR}"
73 - fi
74 -
75 # Determine the CVS command mode (checkout or update)
76 if [[ ! -d ${ECVS_TOP_DIR}/${ECVS_LOCALNAME}/CVS ]] ; then
77 mode=checkout
78 @@ -313,13 +287,13 @@ cvs_fetch() {
79 # Switch servers automagically if needed
80 if [[ ${mode} == "update" ]] ; then
81 cd "/${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"
82 - local oldserver=$(${run} cat CVS/Root)
83 + local oldserver=$(cat CVS/Root)
84 if [[ ${server} != "${oldserver}" ]] ; then
85 einfo "Changing the CVS server from ${oldserver} to ${server}:"
86 debug-print "${FUNCNAME}: Changing the CVS server from ${oldserver} to ${server}:"
87
88 einfo "Searching for CVS directories ..."
89 - local cvsdirs=$(${run} find . -iname CVS -print)
90 + local cvsdirs=$(find . -iname CVS -print)
91 debug-print "${FUNCNAME}: CVS directories found:"
92 debug-print "${cvsdirs}"
93
94 @@ -327,7 +301,7 @@ cvs_fetch() {
95 local x
96 for x in ${cvsdirs} ; do
97 debug-print "In ${x}"
98 - ${run} echo "${server}" > "${x}/Root"
99 + echo "${server}" > "${x}/Root"
100 done
101 fi
102 fi
103 @@ -336,9 +310,6 @@ cvs_fetch() {
104 # mess with ~/.cvspass
105 touch "${T}/cvspass"
106 export CVS_PASSFILE="${T}/cvspass"
107 - if [[ -n ${ECVS_RUNAS} ]] ; then
108 - chown "${ECVS_RUNAS}" "${T}/cvspass"
109 - fi
110
111 # The server string with the password in it, for login (only used for pserver)
112 cvsroot_pass=":${connection}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
113 @@ -352,9 +323,9 @@ cvs_fetch() {
114 fi
115
116 # Commands to run
117 - cmdlogin=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_pass}" login )
118 - cmdupdate=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME} )
119 - cmdcheckout=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE} )
120 + cmdlogin=( ${ECVS_CVS_COMMAND} -d "${cvsroot_pass}" login )
121 + cmdupdate=( ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME} )
122 + cmdcheckout=( ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE} )
123
124 # Execute commands
125
126 @@ -482,13 +453,6 @@ EOF
127 unset DISPLAY
128 fi
129 fi
130 -
131 - # Restore ownership. Not sure why this is needed, but someone
132 - # added it in the orig ECVS_RUNAS stuff.
133 - if [[ -n ${ECVS_RUNAS} ]] ; then
134 - chown $(whoami) "${T}/cvspass"
135 - fi
136 -
137 }
138
139 # @FUNCTION: cvs_src_unpack
140 @@ -508,7 +472,6 @@ cvs_src_unpack() {
141 ECVS_PASS=${ECVS_PASS}
142 ECVS_MODULE=${ECVS_MODULE}
143 ECVS_LOCAL=${ECVS_LOCAL}
144 - ECVS_RUNAS=${ECVS_RUNAS}
145 ECVS_LOCALNAME=${ECVS_LOCALNAME}"
146
147 [[ -z ${ECVS_MODULE} ]] && die "ERROR: CVS module not set, cannot continue."
148 --
149 2.22.0

Attachments

File name MIME type
signature.asc application/pgp-signature