public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/lisp:master commit in: eclass/
Date: Fri,  1 Apr 2022 11:12:46 +0000 (UTC)	[thread overview]
Message-ID: <1648809623.40631c50150421f596445d04d897d9ecd40338ae.ulm@gentoo> (raw)

commit:     40631c50150421f596445d04d897d9ecd40338ae
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 25 01:27:34 2021 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Apr  1 10:40:23 2022 +0000
URL:        https://gitweb.gentoo.org/proj/lisp.git/commit/?id=40631c50

darcs.eclass: Copy last version from gentoo repository

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 eclass/darcs.eclass | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 223 insertions(+)

diff --git a/eclass/darcs.eclass b/eclass/darcs.eclass
new file mode 100644
index 00000000..1ed886fb
--- /dev/null
+++ b/eclass/darcs.eclass
@@ -0,0 +1,223 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: darcs.eclass
+# @MAINTAINER:
+# "Gentoo's Haskell Language team" <haskell@gentoo.org>
+# Sergei Trofimovich <slyfox@gentoo.org>
+# @AUTHOR:
+# Original Author: Jeffrey Yasskin <jyasskin@mail.utexas.edu>
+#               <rphillips@gentoo.org> (tla eclass author)
+# Andres Loeh   <kosmikus@gentoo.org> (darcs.eclass author)
+# Alexander Vershilov <alexander.vershilov@gmail.com> (various contributions)
+# @BLURB: This eclass provides functions for fetch and unpack darcs repositories
+# @DEPRECATED: none
+# @DESCRIPTION:
+# This eclass provides the generic darcs fetching functions.
+#
+# Define the EDARCS_REPOSITORY variable at least.
+# The ${S} variable is set to ${WORKDIR}/${P}.
+
+# TODO:
+
+# support for tags
+
+# eshopts_{push,pop}
+case "${EAPI:-0}" in
+	4|5|6) inherit eutils ;;
+	7)     inherit estack ;;
+	*) ;;
+esac
+
+# Don't download anything other than the darcs repository
+SRC_URI=""
+
+# You shouldn't change these settings yourself! The ebuild/eclass inheriting
+# this eclass will take care of that.
+
+# --- begin ebuild-configurable settings
+
+# darcs command to run
+# @ECLASS-VARIABLE: EDARCS_DARCS_CMD
+# @DESCRIPTION:
+# Path to darcs binary.
+: ${EDARCS_DARCS_CMD:=darcs}
+
+# darcs commands with command-specific options
+
+# @ECLASS-VARIABLE: EDARCS_GET_CMD
+# @DESCRIPTION:
+# First fetch darcs command.
+: ${EDARCS_GET_CMD:=get --lazy}
+
+# @ECLASS-VARIABLE: EDARCS_UPDATE_CMD
+# @DESCRIPTION:
+# Repo update darcs command.
+: ${EDARCS_UPDATE_CMD:=pull}
+
+# @ECLASS-VARIABLE: EDARCS_OPTIONS
+# @DESCRIPTION:
+# Options to pass to both the "get" and "update" commands
+: ${EDARCS_OPTIONS:=--set-scripts-executable}
+
+# @ECLASS-VARIABLE: EDARCS_TOP_DIR
+# @DESCRIPTION:
+# Where the darcs repositories are stored/accessed
+: ${EDARCS_TOP_DIR:=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src}
+
+# @ECLASS-VARIABLE: EDARCS_REPOSITORY
+# @DESCRIPTION:
+# The URI to the repository.
+: ${EDARCS_REPOSITORY:=}
+
+# @ECLASS-VARIABLE: EDARCS_OFFLINE
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Set this variable to a non-empty value to disable the automatic updating of
+# a darcs repository. This is intended to be set outside the darcs source
+# tree by users. Defaults to EVCS_OFFLINE value.
+: ${EDARCS_OFFLINE:=${EVCS_OFFLINE}}
+
+# @ECLASS-VARIABLE: EDARCS_CLEAN
+# @DESCRIPTION:
+# Set this to something to get a clean copy when updating
+# (removes the working directory, then uses EDARCS_GET_CMD to
+# re-download it.)
+: ${EDARCS_CLEAN:=}
+
+# --- end ebuild-configurable settings ---
+
+PROPERTIES+=" live"
+
+case ${EAPI:-0} in
+	[0-6]) # no need to care about 5-HDEPEND and similar
+		DEPEND="dev-vcs/darcs
+			net-misc/rsync"
+		;;
+	*)
+		BDEPEND="dev-vcs/darcs
+			net-misc/rsync"
+		;;
+esac
+
+# @FUNCTION: darcs_patchcount
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function to determine amount of patches in repository.
+darcs_patchcount() {
+	set -- $(HOME="${EDARCS_TOP_DIR}" ${EDARCS_DARCS_CMD} show repo --repodir="${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}" | grep "Num Patches")
+	# handle string like: "    Num Patches: 3860"
+	echo ${3}
+}
+
+# @FUNCTION: darcs_fetch
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function is called from darcs_src_unpack
+darcs_fetch() {
+	# The local directory to store the repository (useful to ensure a
+	# unique local name); relative to EDARCS_TOP_DIR
+	[[ -z ${EDARCS_LOCALREPO} ]] && [[ -n ${EDARCS_REPOSITORY} ]] \
+		&& EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
+		&& EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
+
+	debug-print-function ${FUNCNAME} $*
+
+	if [[ -n ${EDARCS_CLEAN} ]]; then
+		addwrite "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"
+		rm -rf "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"
+	fi
+
+	# create the top dir if needed
+	if [[ ! -d ${EDARCS_TOP_DIR} ]]; then
+		# note that the addwrite statements in this block are only there to allow creating EDARCS_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 darcs directory"
+		addwrite /foobar
+		addwrite /
+		mkdir -p "${EDARCS_TOP_DIR}"
+		export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
+	fi
+
+	# in case EDARCS_DARCS_DIR is a symlink to a dir, get the real
+	# dir's path, otherwise addwrite() doesn't work.
+	pushd . || die
+	cd -P "${EDARCS_TOP_DIR}" > /dev/null
+	EDARCS_TOP_DIR="`/bin/pwd`"
+
+	# disable the sandbox for this dir
+	addwrite "${EDARCS_TOP_DIR}"
+
+	# determine checkout or update mode and change to the right directory.
+	if [[ ! -d "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}/_darcs" ]]; then
+		mode=get
+		cd "${EDARCS_TOP_DIR}"
+	else
+		mode=update
+		cd "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"
+	fi
+
+	# commands to run
+	local    cmdget="${EDARCS_DARCS_CMD} ${EDARCS_GET_CMD}          ${EDARCS_OPTIONS} --repo-name=${EDARCS_LOCALREPO} ${EDARCS_REPOSITORY}"
+	local cmdupdate="${EDARCS_DARCS_CMD} ${EDARCS_UPDATE_CMD} --all ${EDARCS_OPTIONS}                                 ${EDARCS_REPOSITORY}"
+
+	if [[ ${mode} == "get" ]]; then
+		einfo "Running ${cmdget}"
+		HOME="${EDARCS_TOP_DIR}" ${cmdget} || die "darcs get command failed"
+	elif [[ -n ${EDARCS_OFFLINE} ]] ; then
+		einfo "Offline update"
+	elif [[ ${mode} == "update" ]]; then
+		einfo "Running ${cmdupdate}"
+		HOME="${EDARCS_TOP_DIR}" ${cmdupdate} || die "darcs update command failed"
+	fi
+
+	export EDARCS_PATCHCOUNT=$(darcs_patchcount)
+	einfo "    patches in repo: ${EDARCS_PATCHCOUNT}"
+
+	popd || die
+}
+
+# @FUNCTION: darcs_src_unpack
+# @DESCRIPTION:
+# src_upack function
+darcs_src_unpack() {
+	# The local directory to store the repository (useful to ensure a
+	# unique local name); relative to EDARCS_TOP_DIR
+	[[ -z ${EDARCS_LOCALREPO} ]] && [[ -n ${EDARCS_REPOSITORY} ]] \
+		&& EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
+		&& EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
+
+	debug-print-function ${FUNCNAME} $*
+
+	debug-print "${FUNCNAME}: init:
+	EDARCS_DARCS_CMD=${EDARCS_DARCS_CMD}
+	EDARCS_GET_CMD=${EDARCS_GET_CMD}
+	EDARCS_UPDATE_CMD=${EDARCS_UPDATE_CMD}
+	EDARCS_OPTIONS=${EDARCS_OPTIONS}
+	EDARCS_TOP_DIR=${EDARCS_TOP_DIR}
+	EDARCS_REPOSITORY=${EDARCS_REPOSITORY}
+	EDARCS_LOCALREPO=${EDARCS_LOCALREPO}
+	EDARCS_CLEAN=${EDARCS_CLEAN}"
+
+	einfo "Fetching darcs repository ${EDARCS_REPOSITORY} into ${EDARCS_TOP_DIR}..."
+	darcs_fetch
+
+	einfo "Copying ${EDARCS_LOCALREPO} from ${EDARCS_TOP_DIR}..."
+	debug-print "Copying ${EDARCS_LOCALREPO} from ${EDARCS_TOP_DIR}..."
+
+	# probably redundant, but best to make sure
+	# Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside.
+	mkdir -p "${WORKDIR}/${P}"
+
+	eshopts_push -s dotglob	# get any dotfiles too.
+	rsync -rlpgo "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"/* "${WORKDIR}/${P}"
+	eshopts_pop
+
+	einfo "Darcs repository contents are now in ${WORKDIR}/${P}"
+
+}
+
+EXPORT_FUNCTIONS src_unpack


             reply	other threads:[~2022-04-01 11:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 11:12 Ulrich Müller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-16 18:19 [gentoo-commits] proj/lisp:master commit in: eclass/ Ulrich Müller
2023-06-16 10:42 Ulrich Müller
2022-04-03 17:56 Ulrich Müller
2022-03-26 17:29 Ulrich Müller
2022-03-24  6:54 Ulrich Müller
2022-03-13 20:27 Ulrich Müller
2022-03-13 20:21 Ulrich Müller
2020-02-11 21:25 Ulrich Müller
2019-08-08 21:24 Ulrich Müller
2019-08-08 21:24 Ulrich Müller
2018-06-21 14:40 José María Alonso
2018-05-31 16:10 José María Alonso
2018-05-31 16:08 José María Alonso
2018-05-19 14:01 José María Alonso
2018-05-18 19:56 José María Alonso
2018-03-17 21:30 José María Alonso
2017-12-10 19:56 José María Alonso
2017-10-28 14:29 José María Alonso
2017-10-28 14:27 José María Alonso
2017-10-28 14:25 José María Alonso
2017-10-06 21:21 José María Alonso
2017-08-29 15:23 José María Alonso
2017-08-22 21:36 José María Alonso
2017-08-22 21:33 José María Alonso
2017-08-22 21:32 José María Alonso
2017-08-22 21:28 José María Alonso
2016-11-30 14:25 José María Alonso
2016-11-29 22:43 José María Alonso
2016-06-17 16:01 José María Alonso
2015-08-18 21:24 José María Alonso
2013-04-04 19:10 Stelian Ionescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1648809623.40631c50150421f596445d04d897d9ecd40338ae.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox