diff options
author | Tal Peer <coredumb@gentoo.org> | 2004-01-04 14:35:12 +0000 |
---|---|---|
committer | Tal Peer <coredumb@gentoo.org> | 2004-01-04 14:35:12 +0000 |
commit | cf2129d938d74c74921e1c3a64837142272d2025 (patch) | |
tree | 8d2b6650b5d3285f81a520f11b019619b37dd235 /eclass/cvs.eclass | |
parent | Added 'dev-util/yacc' dependency. (diff) | |
download | historical-cf2129d938d74c74921e1c3a64837142272d2025.tar.gz historical-cf2129d938d74c74921e1c3a64837142272d2025.tar.bz2 historical-cf2129d938d74c74921e1c3a64837142272d2025.zip |
Added password-based SSH ext support + some cosmetic fixes. patch by jbms.
Diffstat (limited to 'eclass/cvs.eclass')
-rw-r--r-- | eclass/cvs.eclass | 435 |
1 files changed, 311 insertions, 124 deletions
diff --git a/eclass/cvs.eclass b/eclass/cvs.eclass index 7c53f44064d6..6038d492b0cb 100644 --- a/eclass/cvs.eclass +++ b/eclass/cvs.eclass @@ -1,89 +1,151 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.49 2003/09/28 17:24:18 coredumb Exp $ -# +# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.50 2004/01/04 14:35:12 coredumb Exp $ + # Current Maintainer: Tal Peer <coredumb@gentoo.org> # Original Author: Dan Armak <danarmak@gentoo.org> -# + # SSH auth code by Danny <danny.milo@gmx.net> -# -# This eclass provides the generic cvs fetching functions. -# to use from an ebuild, set the 'ebuild-configurable settings' below in your ebuild before inheriting. -# then either leave the default src_unpack or extend over cvs_src_unpack. -# if you find that you need to call the cvs_* functions directly, i'd be interested to hear about it. + +# SSH password authentication support and host key verification +# support by Jeremy Maitin-Shepard <jbms@gentoo.org> + + +# This eclass provides the generic cvs fetching functions. To use +# this from an ebuild, set the `ebuild-configurable settings' as +# specified below in your ebuild before inheriting. Then either leave +# the default src_unpack or extend over cvs_src_unpack. If you find +# that you need to call the cvs_* functions directly, I'd be +# interested to hear about it. # TODO: + # Implement more auth types (gserver?, kserver?) -# Implement more 'ext' auth methods (do anyone actually use it with anything other than ssh?) -# Add support for password-based ssh (only keys supported now) + +# Support additional remote shells with `ext' authentication (does +# anyone actually need to use it with anything other than SSH?) + ECLASS=cvs INHERITED="$INHERITED $ECLASS" -# You shouldn't change these settings yourself! The ebuild/eclass inheriting this eclass -# will take care of that. If you want to set the global KDE cvs ebuilds' settings, -# see the comments in kde-source.eclass. +# Users shouldn't change these settings! The ebuild/eclass inheriting +# this eclass will take care of that. If you want to set the global +# KDE cvs ebuilds' settings, see the comments in kde-source.eclass. # --- begin ebuild-configurable settings -# cvs command to run. you can set fex. "cvs -t" for extensive debug information -# on the cvs onnection. the default of "cvs -q -f -z4" means to be quiet, to disregard -# the ~/.cvsrc config file and to use maximum compression. +# ECVS_CVS_COMMAND -- CVS command to run +# +# You can set, for example, "cvs -t" for extensive debug information +# on the cvs connection. The default of "cvs -q -f -z4" means to be +# quiet, to disregard the ~/.cvsrc config file and to use maximum +# compression. + [ -z "$ECVS_CVS_COMMAND" ] && ECVS_CVS_COMMAND="cvs -q -f -z4" -# cvs options given after the cvs command (update or checkout) -# don't remove -dP from update or things won't work + +# ECVS_UP_OPTS, ECVS_CO_OPTS -- CVS options given after the cvs +# command (update or checkout). +# +# Don't remove -dP from update or things won't work. + [ -z "$ECVS_UP_OPTS" ] && ECVS_UP_OPTS="-dP" [ -z "$ECVS_CO_OPTS" ] && ECVS_CO_OPTS="" -# set this to some value for the module/subdir to be fetched non-recursively: ECVS_LOCAL -# local name of module. useful if the module on the server is called -# something common like 'driver' or is nested deep in a tree, and you don't -# like useless empty directories. -# WARNING: to be set only from within ebuilds! if set in your shell or some such, -# things wil break because the ebuild won't expect it and have e.g. a wrong $S setting. -# ECVS_LOCALNAME +# ECVS_LOCAL -- If this is set, the CVS module will be fetched +# non-recursively. Refer to the information in the CVS man page +# regarding the -l command option (not the -l global option). + + +# ECVS_LOCALNAME -- local name of checkout directory +# +# This is useful if the module on the server is called something +# common like 'driver' or is nested deep in a tree, and you don't like +# useless empty directories. +# +# WARNING: Set this only from within ebuilds! If set in your shell or +# some such, things will break because the ebuild won't expect it and +# have e.g. a wrong $S setting. + + +# ECVS_TOP_DIR -- The directory under which CVS modules are checked +# out. -# Where the cvs modules are stored/accessed [ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="${DISTDIR}/cvs-src" -# Name of cvs server, set to "offline" to disable fetching -# (i.e. to assume module is checked out already and don't update it). -# Format is server:/dir e.g. "anoncvs.kde.org:/home/kde". remove the other -# parts of the full CVSROOT (which looks like -# ":pserver:anonymous@anoncvs.kde.org:/home/kde"); these are added from -# other settings -# the special value 'offline' disables fetching, assumes sources are alread in ECVS_TOP_DIR +# ECVS_NAME -- CVS path +# +# The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde". +# Remove the other parts of the full CVSROOT, which might look like +# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated +# using other settings also. +# +# Set this to "offline" to disable fetching (i.e. to assume the module +# is already checked out in ECVS_TOP_DIR). + [ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline" -# Authentication method to use - possible values are "pserver" and "ext" -# Currently, only method for 'ext' is ssh, please note that it doesn't -# work with passwords, only with keys. -[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" -# Use su to run cvs as user -# Currently b0rked and wouldn't work with portage userpriv anyway without special magic -# [ -z "$ECVS_RUNAS" ] && ECVS_RUNAS="`whoami`" +# ECVS_MODULE -- the name of the CVS module to be fetched +# +# This must be set when cvs_src_unpack is called. This can include +# several directory levels, i.e. "foo/bar/baz" + +#[ -z "$ECVS_MODULE" ] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue" + + +# ECVS_BRANCH -- the name of the branch/tag to use + +# The default is "HEAD". The following default _will_ reset your +# branch checkout to head if used. + +#[ -z "$ECVS_BRANCH" ] && ECVS_BRANCH="HEAD" + + +# ECVS_AUTH -- authentication method to use +# +# Possible values are "pserver" and "ext". If `ext' authentication is +# used, the remote shell to use can be specified in CVS_RSH (SSH is +# used by default). Currently, the only supported remote shell for +# `ext' authentication is SSH. +[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" -# Username to give to the server +# ECVS_USER -- Username to use for authentication on the remote server [ -z "$ECVS_USER" ] && ECVS_USER="anonymous" -# Password to use + +# ECVS_PASS -- Password to use for authentication on the remote server [ -z "$ECVS_PASS" ] && ECVS_PASS="" -# Module to be fetched, must be set when kde_src_unpack is called -# can include several directory levels, ie foo/bar/baz -#[ -z "$ECVS_MODULE" ] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue" -# Branch/tag to use, default is HEAD -# the following default _will_ reset your branch checkout to head if used -#[ -z "$ECVS_BRANCH" ] && ECVS_BRANCH="HEAD" +# ECVS_SSH_HOST_KEY +# +# If SSH is used for `ext' authentication, use this variable to +# specify the host key of the remote server. The format of the value +# should be the same format that is used for the SSH known hosts file. +# +# WARNING: If a SSH host key is not specified using this variable, the +# remote host key will not be verified. + + +# ECVS_CLEAN -- Set this to get a clean copy when updating (passes the +# -C option to cvs update) + + +# ECVS_RUNAS +# +# Specifies an alternate (non-root) user to use to run cvs. Currently +# b0rked and wouldn't work with portage userpriv anyway without +# special magic. + +# [ -z "$ECVS_RUNAS" ] && ECVS_RUNAS="`whoami`" -# deprecated - do not use + +# ECVS_SUBDIR -- deprecated, do not use [ -n "$ECVS_SUBDIR" ] && die "ERROR: deprecated ECVS_SUBDIR defined. Please fix this ebuild." -# ECVS_CLEAN: set this to something to get a clean copy when updating (passes the -C option to cvs update) # --- end ebuild-configurable settings --- @@ -101,54 +163,82 @@ if [ "$ECVS_AUTH" == "ext" ]; then DEPEND="$DEPEND net-misc/openssh" fi -# calls cvs_contorl, is called from cvs_src_unpack +# called from cvs_src_unpack cvs_fetch() { - # fix for sourceforge which doesnt want -z>3 anymore. + # Make these options local variables so that the global values are + # not affected by modifications in this function. + + local ECVS_COMMAND="${ECVS_COMMAND}" + local ECVS_UP_OPTS="${ECVS_UP_OPTS}" + local ECVS_CO_OPTS="${ECVS_CO_OPTS}" - (echo $ECVS_SERVER | grep sourceforge) && [ "$ECVS_CVS_COMMAND" == "cvs -q -f -z4" ] && ECVS_CVS_COMMAND="cvs -q -f -z3" + # Fix for sourceforge which doesnt want -z>3 anymore. + + (echo $ECVS_SERVER | grep -q sourceforge) \ + && [ "$ECVS_CVS_COMMAND" == "cvs -q -f -z4" ] \ + && ECVS_CVS_COMMAND="cvs -q -f -z3" debug-print-function $FUNCNAME $* - # parameters modifying other parameters that should be effective every time cvs_fetch is called, - # and not just every time cvs.eclas is inherited - # 1. parameter for local (non-recursive) fetching + # Update variables that are modified by ebuild parameters, which + # should be effective every time cvs_fetch is called, and not just + # every time cvs.eclass is inherited + + + # Handle parameter for local (non-recursive) fetching + if [ -n "$ECVS_LOCAL" ]; then ECVS_UP_OPTS="$ECVS_UP_OPTS -l" ECVS_CO_OPTS="$ECVS_CO_OPTS -l" fi - # 2. cvs auto-switches branches, we just have to pass the correct -rBRANCH option to it when updating. - # doing it this way we get multiple -rX options - harmless afaik + + # Handle ECVS_BRANCH option + # + # Because CVS auto-switches branches, we just have to pass the + # correct -rBRANCH option when updating. + if [ -n "$ECVS_BRANCH" ]; then ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" ECVS_CO_OPTS="$ECVS_CO_OPTS -r$ECVS_BRANCH" fi + # Handle ECVS_LOCALNAME, which specifies the local directory name + # to use. Note that the -d command option is not equivalent to + # the global -d option. + if [ "$ECVS_LOCALNAME" != "$ECVS_MODULE" ]; then - # the option to cvs on which this is based. note this isn't the same as the - # global -d option to cvs, which specifies the cvs server. ugh @ cvs syntax. ECVS_CO_OPTS="$ECVS_CO_OPTS -d $ECVS_LOCALNAME" fi + if [ -n "$ECVS_CLEAN" ]; then ECVS_UP_OPTS="$ECVS_UP_OPTS -C" fi - # it's easiest to always be in "run-as mode", logic-wise - # or would be if sudo didn't ask for a password even when sudo'ing to `whoami` + + # 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 + # Create the top dir if needed + if [ ! -d "$ECVS_TOP_DIR" ]; then - # note that the addwrite statements in this block are only there to allow creating ECVS_TOP_DIR; - # we've already allowed writing inside it - # this is because it's simpler than trying to find out the parent path of the directory, which - # would need to be the real path and not a symlink for things to work (so we can't just remove - # the last path element in the string) + + # Note that the addwrite statements in this block are only + # there to allow creating ECVS_TOP_DIR; we allow writing + # inside it separately. + + # This is because it's simpler than trying to find out the + # parent path of the directory, which would need to be the + # real path and not a symlink for things to work (so we can't + # just remove the last path element in the string) + debug-print "$FUNCNAME: checkout mode. creating cvs directory" addwrite /foobar addwrite / @@ -156,44 +246,47 @@ cvs_fetch() { export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}" fi - # in case ECVS_TOP_DIR is a symlink to a dir, get the real dir's path, + # In case ECVS_TOP_DIR is a symlink to a dir, get the real path, # otherwise addwrite() doesn't work. + cd -P "$ECVS_TOP_DIR" > /dev/null ECVS_TOP_DIR="`/bin/pwd`" - # determine checkout or update mode + # 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 else mode=update fi - # disable the sandbox for this dir - addwrite "$ECVS_TOP_DIR" - - # chowning the directory and all contents - if [ -n "$ECVS_RUNAS" ]; then - $run chown -R "$ECVS_RUNAS" "/$ECVS_TOP_DIR" - fi - # our server string (aka CVSROOT), without the password so it can be put in Root - server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" + # Our server string (i.e. CVSROOT) without the password so it can + # be put in Root + local server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" - # switch servers automagically if needed + # Switch servers automagically if needed if [ "$mode" == "update" ]; then cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME - oldserver="`$run cat CVS/Root`" + local oldserver="`$run cat CVS/Root`" if [ "$server" != "$oldserver" ]; then - einfo "Changing CVS server from $oldserver to $server:" - debug-print "$FUNCNAME: Changing CVS server from $oldserver to $server:" + einfo "Changing the CVS server from $oldserver to $server:" + debug-print "$FUNCNAME: Changing the CVS server from $oldserver to $server:" - einfo "Searching for CVS dirs..." - cvsdirs="`$run find . -iname CVS -print`" - debug-print "$FUNCNAME: CVS dirs found:" + einfo "Searching for CVS directories..." + local cvsdirs="`$run find . -iname CVS -print`" + debug-print "$FUNCNAME: CVS directories found:" debug-print "$cvsdirs" - einfo "Modifying CVS dirs..." + einfo "Modifying CVS directories..." for x in $cvsdirs; do debug-print "In $x" $run echo "$server" > "$x/Root" @@ -202,24 +295,28 @@ cvs_fetch() { fi fi - # prepare a cvspass file just for this session, we don't want to mess with ~/.cvspass + # Prepare a cvspass file just for this session, we don't want to + # 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 + # The server string with the password in it, for login cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}" - # ditto without the password, for checkout/update after login, so that - # the CVS/Root files don't contain the password in plaintext + + # Ditto without the password, for checkout/update after login, so + # that the CVS/Root files don't contain the password in plaintext cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" - # commands to run + # 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}" + # Execute commands + cd "${ECVS_TOP_DIR}" if [ "${ECVS_AUTH}" == "pserver" ]; then einfo "Running $cmdlogin" @@ -231,8 +328,91 @@ cvs_fetch() { einfo "Running $cmdcheckout" eval $cmdcheckout|| die "cvs checkout command failed" fi - elif [ "${ECVS_AUTH}" == "ext" ]; then - #no login needed for ext + elif [ "${ECVS_AUTH}" == "ext" ]; then + + # Hack to support SSH password authentication + + # Backup environment variable values + local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}" + + if [ "${SSH_ASKPASS+set}" == "set" ]; then + local CVS_ECLASS_ORIG_SSH_ASKPASS="${SSH_ASKPASS}" + else + unset CVS_ECLASS_ORIG_SSH_ASKPASS + fi + + if [ "${DISPLAY+set}" == "set" ]; then + local CVS_ECLASS_ORIG_DISPLAY="${DISPLAY}" + else + unset CVS_ECLASS_ORIG_DISPLAY + fi + + if [ "${CVS_RSH}" == "ssh" ]; then + + # Force SSH to use SSH_ASKPASS by creating python wrapper + + export CVS_RSH="${T}/cvs_sshwrapper" + cat > "${CVS_RSH}"<<EOF +#!/usr/bin/python +import fcntl +import os +import sys +try: + fd = os.open('/dev/tty', 2) + TIOCNOTTY=0x5422 + try: + fcntl.ioctl(fd, TIOCNOTTY) + except: + pass + os.close(fd) +except: + pass +newarglist = sys.argv[:] +EOF + + # Handle SSH host key checking + + local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts" + echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \ + >> "${CVS_RSH}" + + if [ -z "${ECVS_SSH_HOST_KEY}" ]; then + ewarn "Warning: The SSH host key of the remote server will not be verified." + einfo "A temporary known hosts list will be used." + local CVS_ECLASS_STRICT_HOST_CHECKING="no" + touch "${CVS_ECLASS_KNOWN_HOSTS}" + echo "newarglist.insert(1, '-oStrictHostKeyChecking=no')" \ + >> "${CVS_RSH}" + else + local CVS_ECLASS_STRICT_HOST_CHECKING="yes" + echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}" + fi + + echo -n "newarglist.insert(1, '-oStrictHostKeyChecking=" \ + >> "${CVS_RSH}" + echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \ + >> "${CVS_RSH}" + echo "os.execv('/usr/bin/ssh', newarglist)" \ + >> "${CVS_RSH}" + + chmod a+x "${CVS_RSH}" + + # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS + # if DISPLAY is not set) + + [ -z "${DISPLAY}" ] && DISPLAY="DISPLAY" + export DISPLAY + + # Create a dummy executable to echo $ECVS_PASS + + export SSH_ASKPASS="${T}/cvs_sshechopass" + + echo -en "#!/bin/bash\necho \"$ECVS_PASS\"\n" \ + > "${SSH_ASKPASS}" + + chmod a+x "${SSH_ASKPASS}" + fi + if [ "${mode}" == "update" ]; then einfo "Running $cmdupdate" eval $cmdupdate || die "cvs update command failed" @@ -240,9 +420,24 @@ cvs_fetch() { einfo "Running $cmdcheckout" eval $cmdcheckout|| die "cvs checkout command failed" fi + + # Restore environment variable values + export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}" + if [ "${CVS_ECLASS_ORIG_SSH_ASKPASS+set}" == "set" ]; then + export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}" + else + unset SSH_ASKPASS + fi + + if [ "${CVS_ECLASS_ORIG_DISPLAY+set}" == "set" ]; then + export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}" + else + unset DISPLAY + fi fi - # restore ownership. not sure why this is needed, but someone added it in the orig ECVS_RUNAS stuff. + # 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 @@ -269,36 +464,32 @@ cvs_src_unpack() { [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue." - # merely setting this default value makes things fail when cvs_src_unpack is called - # more than once per ebuild (eg kdenonbeta submodules); so if we set a default value, - # we disable it again at the function's end. - # of course, we could instead always reference it with the bash syntax for 'take default - # value from this other variable if undefined', but i'm lazy. + local ECVS_LOCALNAME="${ECVS_LOCALNAME}" + if [ -z "$ECVS_LOCALNAME" ]; then ECVS_LOCALNAME="$ECVS_MODULE" - ECVS_LOCALNAME_SETDEFAULT=true fi - if [ "$ECVS_SERVER" == "offline" ]; then - # we're not required to fetch anything, the module already exists and shouldn't be updated + # We're not required to fetch anything; the module already + # exists and shouldn't be updated. if [ -d "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" ]; then debug-print "$FUNCNAME: offline mode" else - debug-print "$FUNCNAME: offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error" - die "ERROR: Offline mode specified, but dir ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting." + debug-print "$FUNCNAME: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error" + die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting." fi elif [ -n "$ECVS_SERVER" ]; then # ECVS_SERVER!=offline --> real fetching mode - einfo "Fetching cvs module $ECVS_MODULE into $ECVS_TOP_DIR..." + einfo "Fetching CVS module $ECVS_MODULE into $ECVS_TOP_DIR..." cvs_fetch - else # ECVS_SERVER not set - die "ERROR: CVS server not set, cannot continue." + else # ECVS_SERVER not set + die "ERROR: CVS server not specified, cannot continue." fi einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR..." debug-print "Copying module $ECVS_MODULE local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR..." - # probably redundant, but best to make sure + # This is probably redundant, but best to make sure. mkdir -p "$WORKDIR/$ECVS_LOCALNAME" if [ -n "$ECVS_LOCAL" ]; then @@ -307,16 +498,17 @@ cvs_src_unpack() { cp -Rf "$ECVS_TOP_DIR/$ECVS_LOCALNAME" "$WORKDIR/$ECVS_LOCALNAME/.." fi - # if the directory is empty, remove it; empty directories cannot exist in cvs. - # this happens when fex. kde-source requests module/doc/subdir which doesn't exist. - # still create the empty directory in workdir though. + # If the directory is empty, remove it; empty directories cannot + # exist in cvs. This happens when, for example, kde-source + # requests module/doc/subdir which doesn't exist. Still create + # the empty directory in workdir though. if [ "`ls -A \"${ECVS_TOP_DIR}/${ECVS_LOCALNAME}\"`" == "CVS" ]; then - debug-print "$FUNCNAME: removing cvs-empty directory $ECVS_LOCALNAME" + debug-print "$FUNCNAME: removing empty CVS directory $ECVS_LOCALNAME" rm -rf "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" fi - # implement some of base_src_unpack's functionality; - # note however that base.eclass may not have been inherited! + # Implement some of base_src_unpack's functionality; note however + # that base.eclass may not have been inherited! if [ -n "$PATCHES" ]; then debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" cd "$S" @@ -324,18 +516,13 @@ cvs_src_unpack() { debug-print "patching from $x" patch -p0 < "$x" done - # make sure we don't try to apply patches more than once, since - # cvs_src_unpack is usually called several times from e.g. kde-source_src_unpack + # Make sure we don't try to apply patches more than once, + # since cvs_src_unpack is usually called several times from + # e.g. kde-source_src_unpack export PATCHES="" fi - if [ -n "$ECVS_LOCALNAME_SETDEFAULT" ]; then - unset ECVS_LOCALNAME - unset ECVS_LOCALNAME_SETDEFAULT - fi - - einfo "Module ${ECVS_MODULE} is now in ${WORKDIR}" - + einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}" } EXPORT_FUNCTIONS src_unpack |