cvs.eclass: Remove support for running under sudo.

This neither works, nor is it used in the tree.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
This commit is contained in:
Ulrich Müller
2019-07-21 11:13:45 +02:00
parent 82149b58be
commit 33cd0afb17
+8 -45
View File
@@ -1,4 +1,4 @@
# Copyright 1999-2017 Gentoo Foundation
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: cvs.eclass
@@ -174,22 +174,10 @@ inherit eutils
# Set this to get a clean copy when updating (passes the
# -C option to cvs update)
# @ECLASS-VARIABLE: ECVS_RUNAS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Specifies an alternate (non-root) user to use to run cvs. Currently
# b0rked and wouldn't work with portage userpriv anyway without
# special magic.
# : ${ECVS_RUNAS:=$(whoami)}
# add cvs to deps
# ssh is used for ext auth
# sudo is used to run as a specified user
DEPEND="dev-vcs/cvs"
[[ -n ${ECVS_RUNAS} ]] && DEPEND+=" app-admin/sudo"
if [[ ${ECVS_AUTH} == "ext" ]] ; then
#default to ssh
[[ -z ${CVS_RSH} ]] && export CVS_RSH="ssh"
@@ -250,15 +238,6 @@ cvs_fetch() {
ECVS_UP_OPTS+=" -D ${ECVS_DATE}"
fi
# It would be easiest to always be in "run-as mode", logic-wise,
# if sudo didn't ask for a password even when sudo'ing to `whoami`.
if [[ -z ${ECVS_RUNAS} ]] ; then
run=""
else
run="sudo -u ${ECVS_RUNAS}"
fi
# Create the top dir if needed
if [[ ! -d ${ECVS_TOP_DIR} ]] ; then
@@ -274,7 +253,7 @@ cvs_fetch() {
debug-print "${FUNCNAME}: checkout mode. creating cvs directory"
addwrite /foobar
addwrite /
${run} mkdir -p "/${ECVS_TOP_DIR}"
mkdir -p "/${ECVS_TOP_DIR}"
export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
fi
@@ -287,11 +266,6 @@ cvs_fetch() {
# Disable the sandbox for this dir
addwrite "${ECVS_TOP_DIR}"
# Chown the directory and all of its contents
if [[ -n ${ECVS_RUNAS} ]] ; then
${run} chown -R "${ECVS_RUNAS}" "/${ECVS_TOP_DIR}"
fi
# Determine the CVS command mode (checkout or update)
if [[ ! -d ${ECVS_TOP_DIR}/${ECVS_LOCALNAME}/CVS ]] ; then
mode=checkout
@@ -313,13 +287,13 @@ cvs_fetch() {
# Switch servers automagically if needed
if [[ ${mode} == "update" ]] ; then
cd "/${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"
local oldserver=$(${run} cat CVS/Root)
local oldserver=$(cat CVS/Root)
if [[ ${server} != "${oldserver}" ]] ; then
einfo "Changing the CVS server from ${oldserver} to ${server}:"
debug-print "${FUNCNAME}: Changing the CVS server from ${oldserver} to ${server}:"
einfo "Searching for CVS directories ..."
local cvsdirs=$(${run} find . -iname CVS -print)
local cvsdirs=$(find . -iname CVS -print)
debug-print "${FUNCNAME}: CVS directories found:"
debug-print "${cvsdirs}"
@@ -327,7 +301,7 @@ cvs_fetch() {
local x
for x in ${cvsdirs} ; do
debug-print "In ${x}"
${run} echo "${server}" > "${x}/Root"
echo "${server}" > "${x}/Root"
done
fi
fi
@@ -336,9 +310,6 @@ cvs_fetch() {
# mess with ~/.cvspass
touch "${T}/cvspass"
export CVS_PASSFILE="${T}/cvspass"
if [[ -n ${ECVS_RUNAS} ]] ; then
chown "${ECVS_RUNAS}" "${T}/cvspass"
fi
# The server string with the password in it, for login (only used for pserver)
cvsroot_pass=":${connection}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
@@ -352,9 +323,9 @@ cvs_fetch() {
fi
# Commands to run
cmdlogin=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_pass}" login )
cmdupdate=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME} )
cmdcheckout=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE} )
cmdlogin=( ${ECVS_CVS_COMMAND} -d "${cvsroot_pass}" login )
cmdupdate=( ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME} )
cmdcheckout=( ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE} )
# Execute commands
@@ -482,13 +453,6 @@ EOF
unset DISPLAY
fi
fi
# Restore ownership. Not sure why this is needed, but someone
# added it in the orig ECVS_RUNAS stuff.
if [[ -n ${ECVS_RUNAS} ]] ; then
chown $(whoami) "${T}/cvspass"
fi
}
# @FUNCTION: cvs_src_unpack
@@ -508,7 +472,6 @@ cvs_src_unpack() {
ECVS_PASS=${ECVS_PASS}
ECVS_MODULE=${ECVS_MODULE}
ECVS_LOCAL=${ECVS_LOCAL}
ECVS_RUNAS=${ECVS_RUNAS}
ECVS_LOCALNAME=${ECVS_LOCALNAME}"
[[ -z ${ECVS_MODULE} ]] && die "ERROR: CVS module not set, cannot continue."