From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31815 invoked by uid 1002); 18 Apr 2003 14:12:09 -0000 Mailing-List: contact gentoo-dev-help@gentoo.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Received: (qmail 8942 invoked from network); 18 Apr 2003 14:12:08 -0000 From: Dan Armak Reply-To: danarmak@gentoo.org Organization: Gentoo Technologies, Inc. To: gentoo-dev@gentoo.org, gentoo-core@gentoo.org Date: Fri, 18 Apr 2003 14:11:48 +0000 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-03=_leAo+5ixd+COAmc"; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200304181411.49407.danarmak@gentoo.org> Subject: [gentoo-dev] New cvs.eclass X-Archives-Salt: 560f034b-fd64-49bd-83d4-064cdbe2e69c X-Archives-Hash: ff1c35ac905d102a8ecc5deaddc5690f --Boundary-03=_leAo+5ixd+COAmc Content-Type: multipart/mixed; boundary="Boundary-01=_keAo+DFn7Y8CSdz" Content-Transfer-Encoding: 7bit Content-Description: signed data Content-Disposition: inline --Boundary-01=_keAo+DFn7Y8CSdz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Description: body text Content-Disposition: inline Hello everyone, I've rewritten cvs.eclass. I'll test all cvs euilds once again now and then= =20 commit the new eclass and ebuilds if noone objects. Extra testing from anyo= ne=20 else welcome. Attached are the new eclass, and kde-source.eclass which had to be slightly= =20 modified to match. A new kde-cvs tarball that works with the new=20 cvs.eclass is at http://cvs.gentoo.org/~danarmak/kde-cvs-20030418.tar.gz. Changes to the eclass: =2D General fixes for many cases, even if noone seemed to be having problem= s=20 except for me. This didn't start out as a cleanup... =2D It is now much smaller and cleaner and easy to read and understand. =2D No longer uses the pexpect package with inline python to log in. =2D Explicitly deprecates ext auth support. This was claimed to be supporte= d=20 before, but never actually worked. There is no ebuild in portage that uses= =20 ext instead of pserver; if you have one and want ext auh to work, lpease se= nd=20 me your ebuild to test against. =2D Transfers some logic from the eclass code to cvs itself. Therefore virt= ual=20 cvs modules are now transparently supported (in at least some cases), this= =20 enables the php-cvs ebuild to work (soon to be submitted on bugzilla by=20 coredumb). Changes people writing cvs ebuilds want to know about: =2D ECVS_RUNAS, running everything under su to a specified user, does not w= ork.=20 I am not sure how well it worked before. In any case it is impossible to do= =20 in portage's userpriv mode AFAIK, unless the administrator gave the portage= =20 user the right to su or sudo to that user without benig prompted for a=20 password. I may implement this again before committing, mostly for=20 non-userpriv mode (especially if people ask me to ;-). =2D ECVS_ANON is deprecated. From the cvs POV there is always a password, e= ven=20 if it's empty. So if you want the previous "anonymous login" behaviour, jus= t=20 leave things alone and the default values of ECVS_USER=3D"anonymous",=20 ECVS_PASS=3D"" should work. =2D ECVS_SUBDIR is deprecated. Instead you can now specify subdirectories l= ike=20 this: ECVS_MODULE=3D"dir/dir/dir..." =2D ECVS_AUTH=3Dext is deprecated and will make the eclass die. =2D ECVS_CVS_OPTIONS doesn't exist anymore since update and checkout give=20 different meaning to the same parameters, such as -P. So now there are=20 separate ECVS_UP_OPTS, ECVS_CO_OPTS vars for update and checkout parameters= =20 respectively. (Because I moved some logic to cvs as said above, I now do re= al=20 cvs checkout when needed, not just a fake cvs update.) These ebuilds set the deprecated variables ECVS_ANON and/or ECVS_CVS_OPTION= S,=20 these settings can be safely removed (I went over the ebuilds and it should= =20 be OK): app-editors/emacs-cvs, dev-perl/Common, dev-python/twisted-cvs,=20 net-www/galeon-cvs, sys-libs/ldetect-lst, sys-libs/ldetect. =2D-=20 Dan Armak Gentoo Linux developer (KDE) Matan, Israel Public GPG key: http://cvs.gentoo.org/~danarmak/danarmak-gpg-public.key --Boundary-01=_keAo+DFn7Y8CSdz Content-Type: text/plain; charset="us-ascii"; name="cvs.eclass" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cvs.eclass" # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /home/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.35 2003/04/17 09:05:03 cretin Exp $ # # Author Dan Armak # # 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. 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. # --- 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. [ -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 [ -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 # 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 [ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline" # Authentication method to use - possible values are "pserver" and "ext" # WARNING ext is NOT supported! (never was, despite what earlier version of this file said) [ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" [ "$ECVS_AUTH" == ext ] && die "ERROR: ext auth not supported. If you want it, please contact danarmak@gentoo.org." # 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`" # Username to give to the server [ -z "$ECVS_USER" ] && ECVS_USER="anonymous" # Password to use [ -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" # deprecated - do not use [ -n "$ECVS_SUBDIR" ] && die "ERROR: deprecated ECVS_SUBDIR defined. Please fix this ebuild." # --- end ebuild-configurable settings --- # add cvs to deps # ssh is used for ext auth # sudo is used to run as a specified user DEPEND="$DEPEND dev-util/cvs app-admin/sudo" #[ "$ECVS_AUTH" == "ext" ] && DEPEND="$DEPEND net-misc/openssh" # calls cvs_contorl, is called from cvs_src_unpack cvs_fetch() { debug-print-function $FUNCNAME $* # parameters modifying other parameters that should be effective every time cvs_prep is called, and not # just every time cvs.eclas is inherited # 1. 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 if [ -n "$ECVS_BRANCH" ]; then ECVS_UP_OPTS="$ECVS_UP_OPTS -r$ECVS_BRANCH" ECVS_CO_OPTS="$ECVS_CO_OPTS -r$ECVS_BRANCH" 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` 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 # 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) debug-print "$FUNCNAME: checkout mode. creating cvs directory" addwrite /foobar addwrite / $run mkdir -p "/$ECVS_TOP_DIR" export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}" fi # in case ECVS_TOP_DIR is a symlink to a dir, get the real dir's path, # otherwise addwrite() doesn't work. cd -P "$ECVS_TOP_DIR" > /dev/null ECVS_TOP_DIR="`/bin/pwd`" # determine checkout or update mode if [ ! -d "$ECVS_TOP_DIR/$ECVS_MODULE/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 CVSHOST), without the password so it can be put in Root server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" # switch servers automagically if needed if [ "$mode" == "update" ]; then cd /$ECVS_TOP_DIR/$ECVS_MODULE 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 "Searching for CVS dirs..." cvsdirs="`$run find . -iname CVS -print`" debug-print "$FUNCNAME: CVS dirs found:" debug-print "$cvsdirs" einfo "Modifying CVS dirs..." for x in $cvsdirs; do debug-print "In $x" $run echo "$server" > "$x/Root" done fi fi # the server string with the password in it # needed for mode=update too as we may not be inside ECVS_MODULE but only inside ECVS_TOP_DIR # however putting the password in in update mode can break (?) if [ "$mode" == "checkout" ]; then export CVSROOT=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}" else export CVSROOT=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" fi # 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 # commands to run cmdupdate="${run} ${ECVS_CVS_COMMAND} update ${ECVS_UP_OPTS} ${ECVS_MODULE}" cmdcheckout="${run} ${ECVS_CVS_COMMAND} checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" cd "${ECVS_TOP_DIR}" if [ "${ECVS_AUTH}" == "pserver" ]; then if [ "${mode}" == "update" ]; then $cmdupdate elif [ "${mode}" == "checkout" ]; then $cmdcheckout fi # elif [ "${ECVS_AUTH}" == "ext" ]; then # # for ext there's also a possible ssh prompt, code not yet written # echo "${ECVS_DELAY} continue connecting&yes" >> "$instruct" # echo "${ECVS_DELAY} CVS password:&${ECVS_PASS}" >> "$instruct" # if [ "$mode" == "update" ]; then # expect "$cvsout" "$instruct" | $cmdupdate > "$cvsout" # elif [ "$mode" == "checkout" ]; then # expect "$cvsout" "$instruct" | $cmdcheckout > "$cvsout" # 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 } cvs_src_unpack() { debug-print-function $FUNCNAME $* debug-print "$FUNCNAME: init: ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND ECVS_UP_OPTS=$ECVS_UP_OPTS ECVS_CO_OPTS=$ECVS_CO_OPTS ECVS_TOP_DIR=$ECVS_TOP_DIR ECVS_SERVER=$ECVS_SERVER ECVS_USER=$ECVS_USER ECVS_PASS=$ECVS_PASS ECS_MODULE=$ECVS_MODULE ECVS_LOCAL=$ECVS_LOCAL ECVS_RUNAS=$ECVS_RUNAS" [ -z "$ECVS_MODULE" ] && die "ERROR: CVS module not set, cannot continue." if [ "$ECVS_SERVER" == "offline" ]; then # we're not required to fetch anything, the module already exists and shouldn't be updated if [ -d "${ECVS_TOP_DIR}/${ECVS_MODULE}" ]; then debug-print "$FUNCNAME: offline mode, exiting" return 0 else debug-print "$FUNCNAME: offline mode specified but module/subdir not found, exiting with error" die "ERROR: Offline mode specified, but module/subdir checkout 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..." cvs_fetch else # ECVS_SERVER not set die "ERROR: CVS server not set, cannot continue." fi einfo "Copying $ECVS_MODULE from $ECVS_TOP_DIR..." debug-print "Copying module $ECVS_MODULElocal_mode=$ECVS_LOCAL from $ECVS_TOP_DIR..." # probably redundant, but best to make sure mkdir -p "$WORKDIR/$ECVS_MODULE" if [ -n "$ECVS_LOCAL" ]; then mkdir -p "$WORKDIR/$ECVS_MODULE" cp -f "$ECVS_TOP_DIR/$ECVS_MODULE"/* "$WORKDIR/$ECVS_MODULE" else cp -Rf "$ECVS_TOP_DIR/$ECVS_MODULE" "$WORKDIR/$ECVS_MODULE/.." 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 [ "`ls -A \"${ECVS_TOP_DIR}/${ECVS_MODULE}\"`" == "CVS" ]; then debug-print "$FUNCNAME: removing cvs-empty directory $ECVS_MODULE" rm -rf "${ECVS_TOP_DIR}/${ECVS_MODULE}" fi # 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" for x in $PATCHES; do 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 export PATCHES="" fi } EXPORT_FUNCTIONS src_unpack --Boundary-01=_keAo+DFn7Y8CSdz Content-Type: text/x-diff; charset="us-ascii"; name="kde-source.eclass" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kde-source.eclass" # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /home/cvsroot/gentoo-x86/eclass/kde-source.eclass,v 1.14 2003/04/08 17:48:12 danarmak Exp $ # # Author Dan Armak # # This is for kde-base cvs ebuilds. Read comments about settings. # It uses $S and sets $SRC_URI, so inherit it as late as possible (certainly after any other eclasses). # See http://www.gentoo.org/~danarmak/kde-cvs.html ! # All of the real functionality is in cvs.eclass; this just adds some trivial kde-specific items ECLASS=kde-source INHERITED="$INHERITED $ECLASS" # --- begin user-configurable settings --- # Set yours in profile (e.g. make.conf), or export from the command line to override. # Most have acceptable default values or are set by the ebuilds, but be sure to read the comments # in cvs.eclass for detailed descriptions of them all. # You should probably set at least ECVS_SERVER. # TODO: add options to store the modules as tarballs in $DISTDIR or elsewhere # Under this directory the cvs modules are stored/accessed # Storing in tarballs in $DISTDIR to be implemented soon [ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="$DISTDIR/cvs-src/kde" # Set to name of cvs server. Set to "" to disable fetching (offline mode). # In offline mode, we presume that modules are already checked out at the specified # location and that they shouldn't be updated. # Format example: "anoncvs.kde.org:/home/kde" (without :pserver:anonymous@ part) # Mirror list is available at http://developer.kde.org/source/anoncvs.html [ -z "$ECVS_SERVER" ] && ECVS_SERVER="anoncvs.kde.org:/home/kde" [ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" # ECVS_SUBDIR reimplementation if [ -n "$KCVS_SUBDIR" ]; then ECVS_MODULE="$KCVS_MODULE/$KCVS_SUBDIR" S="$WORKDIR/$KCVS_MODULE" elif [ -n "$KCVS_MODULE" ]; then ECVS_MODULE="$KCVS_MODULE" S="$WORKDIR/$KCVS_MODULE" else # default for kde-base ebuilds ECVS_MODULE="$PN" S="$WORKDIR/$ECVS_MODULE" fi # Other variables: see cvs.eclass # we do this here and not in the very beginning because we need to keep # the configuration order intact: env. and profile settings override # kde-source.eclass defaults, which in turn override cvs.eclass defaults inherit cvs #... and reset $ECLASS. Ugly I know, hopefully I can prettify it someday ECLASS=kde-source # --- end user-configurable settings --- DESCRIPTION="$DESCRIPTION (cvs) " # set this to more easily maintain cvs and std ebuilds side-by-side # (we don't need to remove SRC_URI, kde-dist.eclass, kde.org.eclass etc # from the cvs ones). To download patches or something, set SRC_URI again after # inheriting kde_source. SRC_URI="" kde-source_src_unpack() { debug-print-function $FUNCNAME $* cvs_src_unpack # subdirs of kde modules get special treatment that is designed for # subdirs which are separate selfcontained apps and only need # automake/autoconf stuff etc. added to them. # this fits for apps from kdenonbeta, kdeextragear modules etc. # So, if we just fetched a module's subdir, fetch the top directory # of the module (non-recursively) and make it build only the subdirectory # we need if [ -n "$KCVS_SUBDIR" ]; then ECVS_MODULE="$KCVS_MODULE" ECVS_LOCAL=yes cvs_src_unpack # we need the /doc/ directory too, # and we need the top-level doc/ directory fetched locally ECVS_MODULE="${KCVS_MODULE}/doc" ECVS_LOCAL=yes cvs_src_unpack # but, if such a directory doesn't exist on the cvs server and we're # in offline mode cvs.eclass will abort, so only call this if we're # in online mode or the dir is already fetched if [ -d "$ECVS_TOP_DIR/$KCVS_MODULE/doc/$KCVS_SUBDIR" -o "$ECVS_SERVER" != "offline" ]; then ECVS_MODULE="${KCVS_MODULE}/doc/${KCVS_SUBDIR}" cvs_src_unpack fi fi # typically for kde cvs, the admin subdir lives in the kde-common module # which is also needed if [ ! -d "$S/admin" ]; then ECVS_MODULE="kde-common/admin" cvs_src_unpack IFS2="$IFS" IFS="/" path="" for x in $ECVS_MODULE; do [ -z "$path" ] && path="$x" done IFS="$IFS2" mv ${WORKDIR}/kde-common/admin $WORKDIR/$path fi # make sure we give them a clean cvs checkout cd ${S} [ -f "Makefile" ] && make -f Makefile.cvs cvs-clean [ -f "config.cache" ] && rm config.cache } EXPORT_FUNCTIONS src_unpack --Boundary-01=_keAo+DFn7Y8CSdz-- --Boundary-03=_leAo+5ixd+COAmc Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQA+oAelUI2RQ41fiVERAkWCAJ9UFWx9jrjZITDwUd50/8WseAclWgCfbs1D GU52hiTh1r9buUAXs5S37rs= =BcQd -----END PGP SIGNATURE----- --Boundary-03=_leAo+5ixd+COAmc--