diff options
-rw-r--r-- | eclass/eggs-svn.eclass | 41 | ||||
-rw-r--r-- | eclass/eggs.eclass | 176 | ||||
-rw-r--r-- | eclass/git-2.eclass | 610 | ||||
-rw-r--r-- | eclass/subversion.eclass | 551 |
4 files changed, 0 insertions, 1378 deletions
diff --git a/eclass/eggs-svn.eclass b/eclass/eggs-svn.eclass deleted file mode 100644 index abeb83b8..00000000 --- a/eclass/eggs-svn.eclass +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ -# -# Copyright 2008 Leonardo Valeri Manera <l.valerimanera@gmail.com> -# -# @ECLASS: eggs-svn.eclass -# @MAINTAINER: -# @BLURB: Eclass for Chicken-Scheme SVN Egg packages -# @DESCRIPTION: -# -# This eclass provides generalized functions to compile, test and -# install eggs, as well as setting a number of variables to default -# or autogenerated values. - -inherit eggs subversion - -SRC_URI="" -if [[ -n ${NON_TRUNK} ]]; then - ESVN_REPO_URI="http://galinha.ucpel.tche.br/svn/chicken-eggs/release/3/${EGG_NAME}" -else - ESVN_REPO_URI="http://galinha.ucpel.tche.br/svn/chicken-eggs/release/3/${EGG_NAME}/trunk" -fi -ESVN_OPTIONS="--username=anonymous --password= --non-interactive" - -eggs-svn-doc_maker() { - true -} - -eggs-svn_src_unpack() { - mkdir "${S}" - cd "${S}" - subversion_fetch || die -} - -eggs-svn_src_compile() { - eggs-svn-doc_maker - eggs_src_compile -} - -EXPORT_FUNCTIONS src_unpack src_compile diff --git a/eclass/eggs.eclass b/eclass/eggs.eclass deleted file mode 100644 index 5dff371d..00000000 --- a/eclass/eggs.eclass +++ /dev/null @@ -1,176 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ -# -# Copyright 2008 Leonardo Valeri Manera <l.valerimanera@gmail.com> -# -# @ECLASS: eggs.eclass -# @MAINTAINER: -# @BLURB: Eclass for Chicken-Scheme Egg packages -# @DESCRIPTION: -# -# This eclass provides generalized functions to compile, test and -# install eggs, as well as setting a number of variables to default -# or autogenerated values. - -# @ECLASS-VARIABLE: NEED_CHICKEN -# @DESCRIPTION: -# If you need anything different from chicken 3.0.5, use the -# NEED_CHICKEN variable before inheriting elisp.eclass. Set it to the -# major version the egg needs and the dependency will be adjusted. - -# @ECLASS-VARIABLE: EGG_TESTABLE -# @DESCRIPTION: -# Enables egg test-phase if set to 'yes'. - -# @ECLASS-VARIABLE: EGG_NAME -# @DESCRIPTION: -# Override egg name autogeneration by settting this before importing -# this eclass. - -RESTRICT="primaryuri" - -inherit flag-o-matic - -VERSION="${NEED_CHICKEN:-3.1.0}" -DEPEND=">=dev-scheme/chicken-${VERSION}" -RDEPEND=">=dev-scheme/chicken-${VERSION}" -SLOT="0" -IUSE="" - -case ${PN} in - srfi*) - EGG_NAME=${PN/#srfi/srfi-} - ;; - *) - EGG_NAME=${EGG_NAME:-${PN}} - ;; -esac - -EGGDOC_DIR="/usr/share/doc/chicken-eggs/${PN}" - -SRC_URI="http://cleo.uwindsor.ca/cgi-bin/gentoo-eggs/${EGG_NAME}-3-${PV}.tar.gz" - -if [[ -n "${OLD_EGGPAGE}" ]]; then - HOMEPAGE="http://www.call-with-current-continuation.org/eggs/${EGG_NAME}" -else - HOMEPAGE="http://chicken.wiki.br/${EGG_NAME}" -fi - -# @FUNCTION: eggs-install_binaries -# @USAGE: -# @DESCRIPTION: -# INstall egg binaries/scripts/wrappers into /usr/bin -eggs-install_binaries() { - if [[ -d "${S}/install/${PROGRAM_PATH}" ]]; then - pushd "${S}/install/${PROGRAM_PATH}" >/dev/null - local file - for file in $(ls); do - einfo " => /usr/bin/${file}" - dobin "${file}" || die "failed installing ${file}" - eend $? - done - popd >/dev/null - fi -} - -# @FUNCTION: eggs-install_files -# @USAGE: -# @DESCRIPTION: -# Install egg files into the correct locations. -eggs-install_files() { - local destination=${1:-${CHICKEN_REPOSITORY}} - local real_destination - local file - for file in $(ls); do - case "${file}" in - *.html|*.css) - # Hackish, but working, way of displaying real destinations - # in info messages. Feel free to improve on it. - real_destination=${EGGDOC_DIR} - insinto "${EGGDOC_DIR}" - insopts -m644 - ;; - *.so) - real_destination=${destination} - insinto "${destination}" - insopts -m755 - ;; - *) - real_destination=${destination} - insinto "${destination}" - insopts -m644 - ;; - esac - if [[ -d "${file}" ]];then - # To iterate is human, to recurse, divine. - ( cd "${file}"; eggs-install_files "${destination}/${file}" ) - else - einfo " => ${real_destination}/${file}" - doins "${file}" || die "failed installing ${file}" - eend $? - fi - done -} - -# @FUNCTION: eggs-set_paths -# @USAGE: -# @DESCRIPTION: -# Modify the .setup-info file(s) to reflect true documentation -# installation paths. -eggs-set_paths() { - ebegin "Processing setup files" - for setup_file in $(ls *.setup-info); do - einfo " ${setup_file}" - sed -e "s:${PROGRAM_PATH}:/usr/bin:g" \ - -e "s:${CHICKEN_REPOSITORY}/\(.*\).html:${EGGDOC_DIR}/\1.html:g" \ - -i "${setup_file}" || die "failed processing ${setup_file}" - eend $? - done - einfo "Done processing setup files." -} - -# -# Ebuild function redefintions -# - -eggs_src_unpack() { - mkdir "${S}" - cd "${S}" - unpack "${A}" || die -} - -eggs_src_compile() { - strip-flags || die - filter-ldflags -Wl,--as-needed - CSC_OPTIONS="-C '$CFLAGS $LDFLAGS'" - - CHICKEN_SETUP_OPTIONS="-v -k -build-prefix ${S}/build -install-prefix ${S}/install" - - chicken-setup ${CHICKEN_SETUP_OPTIONS} || die "egg compilation failed" -} - -eggs_src_test() { - if [[ "${EGG_TESTABLE}" == "yes" ]]; then - chicken-setup -n -t ${CHICKEN_SETUP_OPTIONS} || die "egg test phase failed" - fi -} - -eggs_src_install() { - CHICKEN_REPOSITORY=$(chicken-setup -R) || die - PROGRAM_PATH=$(chicken-setup -P) || die - - pushd "${S}/install/${CHICKEN_REPOSITORY}" >/dev/null - - [[ -f index.html ]] && rm index.html - eggs-set_paths - - ebegin "Installing files" - eggs-install_binaries - eggs-install_files - einfo "Done with installation." - - popd >/dev/null -} - -EXPORT_FUNCTIONS src_unpack src_compile src_test src_install diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass deleted file mode 100644 index 91716329..00000000 --- a/eclass/git-2.eclass +++ /dev/null @@ -1,610 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @ECLASS: git-2.eclass -# @MAINTAINER: -# maintainer-needed@gentoo.org -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 -# @BLURB: Eclass for fetching and unpacking git repositories. -# @DESCRIPTION: -# Eclass for easing maintenance of live ebuilds using git as remote repository. -# Eclass support working with git submodules and branching. -# -# This eclass is DEPRECATED. Please use git-r3 instead. - -case ${EAPI:-0} in - 0|1|2|3|4|5) ;; - *) die "${ECLASS}.eclass is banned in EAPI ${EAPI}";; -esac - -# This eclass support all EAPIs. -EXPORT_FUNCTIONS src_unpack - -PROPERTIES+=" live" - -DEPEND="dev-vcs/git" - -# @ECLASS-VARIABLE: EGIT_SOURCEDIR -# @DESCRIPTION: -# This variable specifies destination where the cloned -# data are copied to. -# -# EGIT_SOURCEDIR="${S}" - -# @ECLASS-VARIABLE: EGIT_STORE_DIR -# @DESCRIPTION: -# Storage directory for git sources. -# -# EGIT_STORE_DIR="${DISTDIR}/egit-src" - -# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES -# @DEFAULT_UNSET -# @DESCRIPTION: -# If non-empty this variable enables support for git submodules in our -# checkout. Also this makes the checkout to be non-bare for now. - -# @ECLASS-VARIABLE: EGIT_OPTIONS -# @DEFAULT_UNSET -# @DESCRIPTION: -# Variable specifying additional options for fetch command. - -# @ECLASS-VARIABLE: EGIT_MASTER -# @DESCRIPTION: -# Variable for specifying master branch. -# Useful when upstream don't have master branch or name it differently. -# -# EGIT_MASTER="master" - -# @ECLASS-VARIABLE: EGIT_PROJECT -# @DESCRIPTION: -# Variable specifying name for the folder where we check out the git -# repository. Value of this variable should be unique in the -# EGIT_STORE_DIR as otherwise you would override another repository. -# -# EGIT_PROJECT="${EGIT_REPO_URI##*/}" - -# @ECLASS-VARIABLE: EGIT_DIR -# @DESCRIPTION: -# Directory where we want to store the git data. -# This variable should not be overridden. -# -# EGIT_DIR="${EGIT_STORE_DIR}/${EGIT_PROJECT}" - -# @ECLASS-VARIABLE: EGIT_REPO_URI -# @REQUIRED -# @DEFAULT_UNSET -# @DESCRIPTION: -# URI for the repository -# e.g. http://foo, git://bar -# -# It can be overridden via env using packagename_LIVE_REPO -# variable. -# -# Support multiple values: -# EGIT_REPO_URI="git://a/b.git http://c/d.git" - -# @ECLASS-VARIABLE: EVCS_OFFLINE -# @DEFAULT_UNSET -# @DESCRIPTION: -# If non-empty this variable prevents performance of any online -# operations. - -# @ECLASS-VARIABLE: EGIT_BRANCH -# @DESCRIPTION: -# Variable containing branch name we want to check out. -# It can be overridden via env using packagename_LIVE_BRANCH -# variable. -# -# EGIT_BRANCH="${EGIT_MASTER}" - -# @ECLASS-VARIABLE: EGIT_COMMIT -# @DESCRIPTION: -# Variable containing commit hash/tag we want to check out. -# It can be overridden via env using packagename_LIVE_COMMIT -# variable. -# -# EGIT_COMMIT="${EGIT_BRANCH}" - -# @ECLASS-VARIABLE: EGIT_REPACK -# @DEFAULT_UNSET -# @DESCRIPTION: -# If non-empty this variable specifies that repository will be repacked to -# save space. However this can take a REALLY LONG time with VERY big -# repositories. - -# @ECLASS-VARIABLE: EGIT_PRUNE -# @DEFAULT_UNSET -# @DESCRIPTION: -# If non-empty this variable enables pruning all loose objects on each fetch. -# This is useful if upstream rewinds and rebases branches often. - -# @ECLASS-VARIABLE: EGIT_NONBARE -# @DEFAULT_UNSET -# @DESCRIPTION: -# If non-empty this variable specifies that all checkouts will be done using -# non bare repositories. This is useful if you can't operate with bare -# checkouts for some reason. - -# @ECLASS-VARIABLE: EGIT_NOUNPACK -# @DEFAULT_UNSET -# @DESCRIPTION: -# If non-empty this variable bans unpacking of ${A} content into the srcdir. -# Default behavior is to unpack ${A} content. - -# @FUNCTION: git-2_init_variables -# @INTERNAL -# @DESCRIPTION: -# Internal function initializing all git variables. -# We define it in function scope so user can define -# all the variables before and after inherit. -git-2_init_variables() { - debug-print-function ${FUNCNAME} "$@" - - local esc_pn liverepo livebranch livecommit - esc_pn=${PN//[-+]/_} - - : ${EGIT_SOURCEDIR="${S}"} - - : ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"} - - : ${EGIT_HAS_SUBMODULES:=} - - : ${EGIT_OPTIONS:=} - - : ${EGIT_MASTER:=master} - - liverepo=${esc_pn}_LIVE_REPO - EGIT_REPO_URI=${!liverepo:-${EGIT_REPO_URI}} - [[ ${EGIT_REPO_URI} ]] || die "EGIT_REPO_URI must have some value" - - : ${EVCS_OFFLINE:=} - - livebranch=${esc_pn}_LIVE_BRANCH - [[ ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support" - EGIT_BRANCH=${!livebranch:-${EGIT_BRANCH:-${EGIT_MASTER}}} - - livecommit=${esc_pn}_LIVE_COMMIT - [[ ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support" - EGIT_COMMIT=${!livecommit:-${EGIT_COMMIT:-${EGIT_BRANCH}}} - - : ${EGIT_REPACK:=} - - : ${EGIT_PRUNE:=} -} - -# @FUNCTION: git-2_submodules -# @INTERNAL -# @DESCRIPTION: -# Internal function wrapping the submodule initialisation and update. -git-2_submodules() { - debug-print-function ${FUNCNAME} "$@" - if [[ ${EGIT_HAS_SUBMODULES} ]]; then - if [[ ${EVCS_OFFLINE} ]]; then - # for submodules operations we need to be online - debug-print "${FUNCNAME}: not updating submodules in offline mode" - return 1 - fi - - debug-print "${FUNCNAME}: working in \"${1}\"" - pushd "${EGIT_DIR}" > /dev/null || die - - debug-print "${FUNCNAME}: git submodule init" - git submodule init || die - debug-print "${FUNCNAME}: git submodule sync" - git submodule sync || die - debug-print "${FUNCNAME}: git submodule update" - git submodule update || die - - popd > /dev/null || die - fi -} - -# @FUNCTION: git-2_branch -# @INTERNAL -# @DESCRIPTION: -# Internal function that changes branch for the repo based on EGIT_COMMIT and -# EGIT_BRANCH variables. -git-2_branch() { - debug-print-function ${FUNCNAME} "$@" - - local branchname src - - debug-print "${FUNCNAME}: working in \"${EGIT_SOURCEDIR}\"" - pushd "${EGIT_SOURCEDIR}" > /dev/null || die - - local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH} - if [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]]; then - branchname=tree-${EGIT_COMMIT} - src=${EGIT_COMMIT} - fi - debug-print "${FUNCNAME}: git checkout -b ${branchname} ${src}" - git checkout -b ${branchname} ${src} \ - || die "${FUNCNAME}: changing the branch failed" - - popd > /dev/null || die -} - -# @FUNCTION: git-2_gc -# @INTERNAL -# @DESCRIPTION: -# Internal function running garbage collector on checked out tree. -git-2_gc() { - debug-print-function ${FUNCNAME} "$@" - - local args - - if [[ ${EGIT_REPACK} || ${EGIT_PRUNE} ]]; then - pushd "${EGIT_DIR}" > /dev/null || die - ebegin "Garbage collecting the repository" - [[ ${EGIT_PRUNE} ]] && args='--prune' - debug-print "${FUNCNAME}: git gc ${args}" - git gc ${args} - eend $? - popd > /dev/null || die - fi -} - -# @FUNCTION: git-2_prepare_storedir -# @INTERNAL -# @DESCRIPTION: -# Internal function preparing directory where we are going to store SCM -# repository. -git-2_prepare_storedir() { - debug-print-function ${FUNCNAME} "$@" - - local clone_dir - - # initial clone, we have to create master git storage directory and play - # nicely with sandbox - if [[ ! -d ${EGIT_STORE_DIR} ]]; then - debug-print "${FUNCNAME}: Creating git main storage directory" - addwrite / - mkdir -m 775 -p "${EGIT_STORE_DIR}" \ - || die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\"" - fi - - # allow writing into EGIT_STORE_DIR - addwrite "${EGIT_STORE_DIR}" - - # calculate git.eclass store dir for data - # We will try to clone the old repository, - # and we will remove it if we don't need it anymore. - EGIT_OLD_CLONE= - if [[ ${EGIT_STORE_DIR} == */egit-src ]]; then - local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src} - local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}} - - if [[ -d ${old_location} ]]; then - EGIT_OLD_CLONE=${old_location} - # required to remove the old clone - addwrite "${old_store_dir}" - fi - fi - - # calculate the proper store dir for data - # If user didn't specify the EGIT_DIR, we check if he did specify - # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI. - EGIT_REPO_URI=${EGIT_REPO_URI%/} - if [[ ! ${EGIT_DIR} ]]; then - if [[ ${EGIT_PROJECT} ]]; then - clone_dir=${EGIT_PROJECT} - else - local strippeduri=${EGIT_REPO_URI%/.git} - clone_dir=${strippeduri##*/} - fi - EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} - - if [[ ${EGIT_OLD_CLONE} && ! -d ${EGIT_DIR} ]]; then - elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location." - elog "It will be necessary to rebuild the package to fetch updates." - EGIT_REPO_URI="${EGIT_OLD_CLONE} ${EGIT_REPO_URI}" - fi - fi - export EGIT_DIR=${EGIT_DIR} - debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." -} - -# @FUNCTION: git-2_move_source -# @INTERNAL -# @DESCRIPTION: -# Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir. -git-2_move_source() { - debug-print-function ${FUNCNAME} "$@" - - debug-print "${FUNCNAME}: ${MOVE_COMMAND} \"${EGIT_DIR}\" \"${EGIT_SOURCEDIR}\"" - pushd "${EGIT_DIR}" > /dev/null || die - mkdir -p "${EGIT_SOURCEDIR}" \ - || die "${FUNCNAME}: failed to create ${EGIT_SOURCEDIR}" - ${MOVE_COMMAND} "${EGIT_SOURCEDIR}" \ - || die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed" - popd > /dev/null || die -} - -# @FUNCTION: git-2_initial_clone -# @INTERNAL -# @DESCRIPTION: -# Internal function running initial clone on specified repo_uri. -git-2_initial_clone() { - debug-print-function ${FUNCNAME} "$@" - - local repo_uri - - EGIT_REPO_URI_SELECTED="" - for repo_uri in ${EGIT_REPO_URI}; do - debug-print "${FUNCNAME}: git clone ${EGIT_LOCAL_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\"" - if git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}"; then - # global variable containing the repo_name we will be using - debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\"" - EGIT_REPO_URI_SELECTED="${repo_uri}" - break - fi - done - - [[ ${EGIT_REPO_URI_SELECTED} ]] \ - || die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}" -} - -# @FUNCTION: git-2_update_repo -# @INTERNAL -# @DESCRIPTION: -# Internal function running update command on specified repo_uri. -git-2_update_repo() { - debug-print-function ${FUNCNAME} "$@" - - local repo_uri - - if [[ ${EGIT_LOCAL_NONBARE} ]]; then - # checkout master branch and drop all other local branches - git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}" - for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do - debug-print "${FUNCNAME}: git branch -D ${x}" - git branch -D ${x} > /dev/null - done - fi - - EGIT_REPO_URI_SELECTED="" - for repo_uri in ${EGIT_REPO_URI}; do - # git urls might change, so reset it - git config remote.origin.url "${repo_uri}" - - debug-print "${EGIT_UPDATE_CMD}" - if ${EGIT_UPDATE_CMD} > /dev/null; then - # global variable containing the repo_name we will be using - debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\"" - EGIT_REPO_URI_SELECTED="${repo_uri}" - break - fi - done - - [[ ${EGIT_REPO_URI_SELECTED} ]] \ - || die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}" -} - -# @FUNCTION: git-2_fetch -# @INTERNAL -# @DESCRIPTION: -# Internal function fetching repository from EGIT_REPO_URI and storing it in -# specified EGIT_STORE_DIR. -git-2_fetch() { - debug-print-function ${FUNCNAME} "$@" - - local oldsha cursha repo_type - - [[ ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository" - - if [[ ! -d ${EGIT_DIR} ]]; then - git-2_initial_clone - pushd "${EGIT_DIR}" > /dev/null || die - cursha=$(git rev-parse ${UPSTREAM_BRANCH}) - echo "GIT NEW clone -->" - echo " repository: ${EGIT_REPO_URI_SELECTED}" - echo " at the commit: ${cursha}" - - popd > /dev/null || die - elif [[ ${EVCS_OFFLINE} ]]; then - pushd "${EGIT_DIR}" > /dev/null || die - cursha=$(git rev-parse ${UPSTREAM_BRANCH}) - echo "GIT offline update -->" - echo " repository: $(git config remote.origin.url)" - echo " at the commit: ${cursha}" - popd > /dev/null || die - else - pushd "${EGIT_DIR}" > /dev/null || die - oldsha=$(git rev-parse ${UPSTREAM_BRANCH}) - git-2_update_repo - cursha=$(git rev-parse ${UPSTREAM_BRANCH}) - - # fetch updates - echo "GIT update -->" - echo " repository: ${EGIT_REPO_URI_SELECTED}" - # write out message based on the revisions - if [[ "${oldsha}" != "${cursha}" ]]; then - echo " updating from commit: ${oldsha}" - echo " to commit: ${cursha}" - else - echo " at the commit: ${cursha}" - fi - - # print nice statistic of what was changed - git --no-pager diff --stat ${oldsha}..${UPSTREAM_BRANCH} - popd > /dev/null || die - fi - # export the version the repository is at - export EGIT_VERSION="${cursha}" - # log the repo state - [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \ - && echo " commit: ${EGIT_COMMIT}" - echo " branch: ${EGIT_BRANCH}" - echo " storage directory: \"${EGIT_DIR}\"" - echo " checkout type: ${repo_type}" - - # Cleanup after git.eclass - if [[ ${EGIT_OLD_CLONE} ]]; then - einfo "${FUNCNAME}: removing old clone in ${EGIT_OLD_CLONE}." - rm -rf "${EGIT_OLD_CLONE}" - fi -} - -# @FUNCTION: git_bootstrap -# @INTERNAL -# @DESCRIPTION: -# Internal function that runs bootstrap command on unpacked source. -git-2_bootstrap() { - debug-print-function ${FUNCNAME} "$@" - - # @ECLASS-VARIABLE: EGIT_BOOTSTRAP - # @DESCRIPTION: - # Command to be executed after checkout and clone of the specified - # repository. - # enviroment the package will fail if there is no update, thus in - # combination with --keep-going it would lead in not-updating - # pakcages that are up-to-date. - if [[ ${EGIT_BOOTSTRAP} ]]; then - pushd "${EGIT_SOURCEDIR}" > /dev/null || die - einfo "Starting bootstrap" - - if [[ -f ${EGIT_BOOTSTRAP} ]]; then - # we have file in the repo which we should execute - debug-print "${FUNCNAME}: bootstraping with file \"${EGIT_BOOTSTRAP}\"" - - if [[ -x ${EGIT_BOOTSTRAP} ]]; then - eval "./${EGIT_BOOTSTRAP}" \ - || die "${FUNCNAME}: bootstrap script failed" - else - eerror "\"${EGIT_BOOTSTRAP}\" is not executable." - eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command." - die "\"${EGIT_BOOTSTRAP}\" is not executable" - fi - else - # we execute some system command - debug-print "${FUNCNAME}: bootstraping with commands \"${EGIT_BOOTSTRAP}\"" - - eval "${EGIT_BOOTSTRAP}" \ - || die "${FUNCNAME}: bootstrap commands failed" - fi - - einfo "Bootstrap finished" - popd > /dev/null || die - fi -} - -# @FUNCTION: git-2_migrate_repository -# @INTERNAL -# @DESCRIPTION: -# Internal function migrating between bare and normal checkout repository. -# This is based on usage of EGIT_SUBMODULES, at least until they -# start to work with bare checkouts sanely. -# This function also set some global variables that differ between -# bare and non-bare checkout. -git-2_migrate_repository() { - debug-print-function ${FUNCNAME} "$@" - - local bare returnstate - - # first find out if we have submodules - # or user explicitly wants us to use non-bare clones - if ! [[ ${EGIT_HAS_SUBMODULES} || ${EGIT_NONBARE} ]]; then - bare=1 - fi - - # test if we already have some repo and if so find out if we have - # to migrate the data - if [[ -d ${EGIT_DIR} ]]; then - if [[ ${bare} && -d ${EGIT_DIR}/.git ]]; then - debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to bare copy" - - ebegin "Converting \"${EGIT_DIR}\" from non-bare to bare copy" - mv "${EGIT_DIR}/.git" "${EGIT_DIR}.bare" - export GIT_DIR="${EGIT_DIR}.bare" - git config core.bare true > /dev/null - returnstate=$? - unset GIT_DIR - rm -rf "${EGIT_DIR}" - mv "${EGIT_DIR}.bare" "${EGIT_DIR}" - eend ${returnstate} - elif [[ ! ${bare} && ! -d ${EGIT_DIR}/.git ]]; then - debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to non-bare copy" - - ebegin "Converting \"${EGIT_DIR}\" from bare to non-bare copy" - git clone -l "${EGIT_DIR}" "${EGIT_DIR}.nonbare" > /dev/null - returnstate=$? - rm -rf "${EGIT_DIR}" - mv "${EGIT_DIR}.nonbare" "${EGIT_DIR}" - eend ${returnstate} - fi - fi - if [[ ${returnstate} -ne 0 ]]; then - debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" failed, removing to start from scratch" - - # migration failed, remove the EGIT_DIR to play it safe - einfo "Migration failed, removing \"${EGIT_DIR}\" to start from scratch." - rm -rf "${EGIT_DIR}" - fi - - # set various options to work with both targets - if [[ ${bare} ]]; then - debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\"" - EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare" - MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }" - EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}" - UPSTREAM_BRANCH="${EGIT_BRANCH}" - EGIT_LOCAL_NONBARE= - else - debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\"" - MOVE_COMMAND="cp -pPR ." - EGIT_LOCAL_OPTIONS="${EGIT_OPTIONS}" - EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}" - UPSTREAM_BRANCH="origin/${EGIT_BRANCH}" - EGIT_LOCAL_NONBARE="true" - fi -} - -# @FUNCTION: git-2_cleanup -# @INTERNAL -# @DESCRIPTION: -# Internal function cleaning up all the global variables -# that are not required after the unpack has been done. -git-2_cleanup() { - debug-print-function ${FUNCNAME} "$@" - - # Here we can unset only variables that are GLOBAL - # defined by the eclass, BUT NOT subject to change - # by user (like EGIT_PROJECT). - # If ebuild writer polutes his environment it is - # his problem only. - unset EGIT_DIR - unset MOVE_COMMAND - unset EGIT_LOCAL_OPTIONS - unset EGIT_UPDATE_CMD - unset UPSTREAM_BRANCH - unset EGIT_LOCAL_NONBARE -} - -# @FUNCTION: git-2_src_unpack -# @DESCRIPTION: -# Default git src_unpack function. -git-2_src_unpack() { - debug-print-function ${FUNCNAME} "$@" - - git-2_init_variables - git-2_prepare_storedir - git-2_migrate_repository - git-2_fetch "$@" - git-2_gc - git-2_submodules - git-2_move_source - git-2_branch - git-2_bootstrap - git-2_cleanup - echo ">>> Unpacked to ${EGIT_SOURCEDIR}" - - # Users can specify some SRC_URI and we should - # unpack the files too. - if [[ ! ${EGIT_NOUNPACK} ]]; then - if has ${EAPI:-0} 0 1; then - [[ ${A} ]] && unpack ${A} - else - default_src_unpack - fi - fi -} diff --git a/eclass/subversion.eclass b/eclass/subversion.eclass deleted file mode 100644 index 4d5f8677..00000000 --- a/eclass/subversion.eclass +++ /dev/null @@ -1,551 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @ECLASS: subversion.eclass -# @MAINTAINER: -# Akinori Hattori <hattya@gentoo.org> -# @AUTHOR: -# Original Author: Akinori Hattori <hattya@gentoo.org> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 -# @BLURB: Fetch software sources from subversion repositories -# @DESCRIPTION: -# The subversion eclass provides functions to fetch, patch and bootstrap -# software sources from subversion repositories. - -ESVN="${ECLASS}" - -case ${EAPI:-0} in - 0|1) - inherit eutils - EXPORT_FUNCTIONS src_unpack pkg_preinst - ;; - 2|3|4|5) - inherit eutils - EXPORT_FUNCTIONS src_unpack src_prepare pkg_preinst - ;; - 6|7) - inherit estack - EXPORT_FUNCTIONS src_unpack pkg_preinst - ;; - *) - die "${ESVN}: EAPI ${EAPI:-0} is not supported" - ;; -esac - -PROPERTIES+=" live" - -case ${EAPI:-0} in - 0|1) DEPEND="dev-vcs/subversion" ;; - *) DEPEND="|| ( dev-vcs/subversion[http] - dev-vcs/subversion[webdav-neon] - dev-vcs/subversion[webdav-serf] )" ;; -esac -DEPEND+=" net-misc/rsync" - -case ${EAPI} in - 0|1|2|3|4|5|6) ;; - *) BDEPEND="${DEPEND}"; DEPEND="" ;; -esac - -# @ECLASS-VARIABLE: ESVN_STORE_DIR -# @DESCRIPTION: -# subversion sources store directory. Users may override this in /etc/portage/make.conf -[[ -z ${ESVN_STORE_DIR} ]] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src" - -# @ECLASS-VARIABLE: ESVN_FETCH_CMD -# @DESCRIPTION: -# subversion checkout command -ESVN_FETCH_CMD="svn checkout" - -# @ECLASS-VARIABLE: ESVN_UPDATE_CMD -# @DESCRIPTION: -# subversion update command -ESVN_UPDATE_CMD="svn update" - -# @ECLASS-VARIABLE: ESVN_SWITCH_CMD -# @DESCRIPTION: -# subversion switch command -ESVN_SWITCH_CMD="svn switch" - -# @ECLASS-VARIABLE: ESVN_OPTIONS -# @DESCRIPTION: -# the options passed to checkout or update. If you want a specific revision see -# ESVN_REPO_URI instead of using -rREV. -ESVN_OPTIONS="${ESVN_OPTIONS:-}" - -# @ECLASS-VARIABLE: ESVN_REPO_URI -# @DESCRIPTION: -# repository uri -# -# e.g. http://foo/trunk, svn://bar/trunk, svn://bar/branch/foo@1234 -# -# supported URI schemes: -# http:// -# https:// -# svn:// -# svn+ssh:// -# file:// -# -# to peg to a specific revision, append @REV to the repo's uri -ESVN_REPO_URI="${ESVN_REPO_URI:-}" - -# @ECLASS-VARIABLE: ESVN_REVISION -# @DESCRIPTION: -# User configurable revision checkout or update to from the repository -# -# Useful for live svn or trunk svn ebuilds allowing the user to peg -# to a specific revision -# -# Note: This should never be set in an ebuild! -ESVN_REVISION="${ESVN_REVISION:-}" - -# @ECLASS-VARIABLE: ESVN_USER -# @DESCRIPTION: -# User name -ESVN_USER="${ESVN_USER:-}" - -# @ECLASS-VARIABLE: ESVN_PASSWORD -# @DESCRIPTION: -# Password -ESVN_PASSWORD="${ESVN_PASSWORD:-}" - -# @ECLASS-VARIABLE: ESVN_PROJECT -# @DESCRIPTION: -# project name of your ebuild (= name space) -# -# subversion eclass will check out the subversion repository like: -# -# ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/} -# -# so if you define ESVN_REPO_URI as http://svn.collab.net/repo/svn/trunk or -# http://svn.collab.net/repo/svn/trunk/. and PN is subversion-svn. -# it will check out like: -# -# ${ESVN_STORE_DIR}/subversion/trunk -# -# this is not used in order to declare the name of the upstream project. -# so that you can declare this like: -# -# # jakarta commons-loggin -# ESVN_PROJECT=commons/logging -# -# default: ${PN/-svn}. -ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}" - -# @ECLASS-VARIABLE: ESVN_BOOTSTRAP -# @DESCRIPTION: -# Bootstrap script or command like autogen.sh or etc.. -# Removed in EAPI 6 and later. -ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:-}" - -# @ECLASS-VARIABLE: ESVN_PATCHES -# @DESCRIPTION: -# subversion eclass can apply patches in subversion_bootstrap(). -# you can use regexp in this variable like *.diff or *.patch or etc. -# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed. -# -# Patches are searched both in ${PWD} and ${FILESDIR}, if not found in either -# location, the installation dies. -# -# Removed in EAPI 6 and later, use PATCHES instead. -ESVN_PATCHES="${ESVN_PATCHES:-}" - -# @ECLASS-VARIABLE: ESVN_RESTRICT -# @DESCRIPTION: -# this should be a space delimited list of subversion eclass features to -# restrict. -# export) -# don't export the working copy to S. -ESVN_RESTRICT="${ESVN_RESTRICT:-}" - -# @ECLASS-VARIABLE: ESVN_OFFLINE -# @DESCRIPTION: -# Set this variable to a non-empty value to disable the automatic updating of -# an svn source tree. This is intended to be set outside the subversion source -# tree by users. -ESVN_OFFLINE="${ESVN_OFFLINE:-${EVCS_OFFLINE}}" - -# @ECLASS-VARIABLE: ESVN_UMASK -# @DESCRIPTION: -# Set this variable to a custom umask. This is intended to be set by users. -# By setting this to something like 002, it can make life easier for people -# who do development as non-root (but are in the portage group), and then -# switch over to building with FEATURES=userpriv. Or vice-versa. Shouldn't -# be a security issue here as anyone who has portage group write access -# already can screw the system over in more creative ways. -ESVN_UMASK="${ESVN_UMASK:-${EVCS_UMASK}}" - -# @ECLASS-VARIABLE: ESVN_UP_FREQ -# @DESCRIPTION: -# Set the minimum number of hours between svn up'ing in any given svn module. This is particularly -# useful for split KDE ebuilds where we want to ensure that all submodules are compiled for the same -# revision. It should also be kept user overrideable. -ESVN_UP_FREQ="${ESVN_UP_FREQ:=}" - -# @ECLASS-VARIABLE: ESCM_LOGDIR -# @DESCRIPTION: -# User configuration variable. If set to a path such as e.g. /var/log/scm any -# package inheriting from subversion.eclass will record svn revision to -# ${CATEGORY}/${PN}.log in that path in pkg_preinst. This is not supposed to be -# set by ebuilds/eclasses. It defaults to empty so users need to opt in. -ESCM_LOGDIR="${ESCM_LOGDIR:=}" - -# @FUNCTION: subversion_fetch -# @USAGE: [repo_uri] [destination] -# @DESCRIPTION: -# Wrapper function to fetch sources from subversion via svn checkout or svn update, -# depending on whether there is an existing working copy in ${ESVN_STORE_DIR}. -# -# Can take two optional parameters: -# repo_uri - a repository URI. default is ESVN_REPO_URI. -# destination - a check out path in S. -subversion_fetch() { - local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")" - local revision="$(subversion__get_peg_revision "${1:-${ESVN_REPO_URI}}")" - local S_dest="${2}" - - if [[ -z ${repo_uri} ]]; then - die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." - fi - - [[ -n "${ESVN_REVISION}" ]] && revision="${ESVN_REVISION}" - - # check for the scheme - local scheme="${repo_uri%%:*}" - case "${scheme}" in - http|https) - ;; - svn|svn+ssh) - ;; - file) - ;; - *) - die "${ESVN}: fetch from '${scheme}' is not yet implemented." - ;; - esac - - addread "/etc/subversion" - addwrite "${ESVN_STORE_DIR}" - - if [[ -n "${ESVN_UMASK}" ]]; then - eumask_push "${ESVN_UMASK}" - fi - - if [[ ! -d ${ESVN_STORE_DIR} ]]; then - debug-print "${FUNCNAME}: initial checkout. creating subversion directory" - mkdir -m 775 -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." - fi - - pushd "${ESVN_STORE_DIR}" >/dev/null || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" - - local wc_path="$(subversion__get_wc_path "${repo_uri}")" - local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion" - - [[ -n "${revision}" ]] && options="${options} -r ${revision}" - - if [[ "${ESVN_OPTIONS}" = *-r* ]]; then - ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please" - ewarn "see \${ESVN_REPO_URI}" - fi - - if has_version ">=dev-vcs/subversion-1.6.0"; then - options="${options} --config-option=config:auth:password-stores=" - fi - - debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" - debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" - debug-print "${FUNCNAME}: options = \"${options}\"" - - if [[ ! -d ${wc_path}/.svn ]]; then - if [[ -n ${ESVN_OFFLINE} ]]; then - ewarn "ESVN_OFFLINE cannot be used when there is no existing checkout." - fi - # first check out - einfo "subversion check out start -->" - einfo " repository: ${repo_uri}${revision:+@}${revision}" - - debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" - - mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." - cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" - if [[ -n "${ESVN_USER}" ]]; then - ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." - else - ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." - fi - - elif [[ -n ${ESVN_OFFLINE} ]]; then - svn upgrade "${wc_path}" &>/dev/null - svn cleanup "${wc_path}" &>/dev/null - subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." - - if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then - die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally." - fi - einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}." - else - svn upgrade "${wc_path}" &>/dev/null - svn cleanup "${wc_path}" &>/dev/null - subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." - - local esvn_up_freq= - if [[ -n ${ESVN_UP_FREQ} ]]; then - if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then - die "${ESVN}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up." - elif [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then - einfo "Fetching disabled since ${ESVN_UP_FREQ} hours has not passed since last update." - einfo "Using existing repository copy at revision ${ESVN_WC_REVISION}." - esvn_up_freq=no_update - fi - fi - - if [[ -z ${esvn_up_freq} ]]; then - if [[ ${ESVN_WC_UUID} != $(subversion__svn_info "${repo_uri}" "Repository UUID") ]]; then - # UUID mismatch. Delete working copy and check out it again. - einfo "subversion recheck out start -->" - einfo " old UUID: ${ESVN_WC_UUID}" - einfo " new UUID: $(subversion__svn_info "${repo_uri}" "Repository UUID")" - einfo " repository: ${repo_uri}${revision:+@}${revision}" - - rm -fr "${ESVN_PROJECT}" || die - - debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" - - mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." - cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" - if [[ -n "${ESVN_USER}" ]]; then - ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." - else - ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." - fi - elif [[ ${ESVN_WC_URL} != $(subversion__get_repository_uri "${repo_uri}") ]]; then - einfo "subversion switch start -->" - einfo " old repository: ${ESVN_WC_URL}@${ESVN_WC_REVISION}" - einfo " new repository: ${repo_uri}${revision:+@}${revision}" - - debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" - - cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" - if [[ -n "${ESVN_USER}" ]]; then - ${ESVN_SWITCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." - else - ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." - fi - else - # update working copy - einfo "subversion update start -->" - einfo " repository: ${repo_uri}${revision:+@}${revision}" - - debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" - - cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" - if [[ -n "${ESVN_USER}" ]]; then - ${ESVN_UPDATE_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." - else - ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." - fi - fi - - # export updated information for the working copy - subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." - fi - fi - - if [[ -n "${ESVN_UMASK}" ]]; then - eumask_pop - fi - - einfo " working copy: ${wc_path}" - - if ! has "export" ${ESVN_RESTRICT}; then - cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" - - local S="${S}/${S_dest}" - mkdir -p "${S}" - - # export to the ${WORKDIR} - #* "svn export" has a bug. see https://bugs.gentoo.org/119236 - #* svn export . "${S}" || die "${ESVN}: can't export to ${S}." - rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}." - fi - - popd >/dev/null - echo -} - -# @FUNCTION: subversion_bootstrap -# @DESCRIPTION: -# Apply patches in ${ESVN_PATCHES} and run ${ESVN_BOOTSTRAP} if specified. -# Removed in EAPI 6 and later. -subversion_bootstrap() { - [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is removed from subversion.eclass in EAPI 6 and later" - - if has "export" ${ESVN_RESTRICT}; then - return - fi - - cd "${S}" - - if [[ -n ${ESVN_PATCHES} ]]; then - local patch fpatch - einfo "apply patches -->" - for patch in ${ESVN_PATCHES}; do - if [[ -f ${patch} ]]; then - epatch "${patch}" - else - for fpatch in ${FILESDIR}/${patch}; do - if [[ -f ${fpatch} ]]; then - epatch "${fpatch}" - else - die "${ESVN}: ${patch} not found" - fi - done - fi - done - echo - fi - - if [[ -n ${ESVN_BOOTSTRAP} ]]; then - einfo "begin bootstrap -->" - if [[ -f ${ESVN_BOOTSTRAP} && -x ${ESVN_BOOTSTRAP} ]]; then - einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" - eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." - else - einfo " bootstrap with command: ${ESVN_BOOTSTRAP}" - eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP." - fi - fi -} - -# @FUNCTION: subversion_wc_info -# @USAGE: [repo_uri] -# @RETURN: ESVN_WC_URL, ESVN_WC_ROOT, ESVN_WC_UUID, ESVN_WC_REVISION and ESVN_WC_PATH -# @DESCRIPTION: -# Get svn info for the specified repo_uri. The default repo_uri is ESVN_REPO_URI. -# -# The working copy information on the specified repository URI are set to -# ESVN_WC_* variables. -subversion_wc_info() { - local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")" - local wc_path="$(subversion__get_wc_path "${repo_uri}")" - - debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" - debug-print "${FUNCNAME}: wc_path = ${wc_path}" - - if [[ ! -d ${wc_path} ]]; then - return 1 - fi - - export ESVN_WC_URL="$(subversion__svn_info "${wc_path}" "URL")" - export ESVN_WC_ROOT="$(subversion__svn_info "${wc_path}" "Repository Root")" - export ESVN_WC_UUID="$(subversion__svn_info "${wc_path}" "Repository UUID")" - export ESVN_WC_REVISION="$(subversion__svn_info "${wc_path}" "Revision")" - export ESVN_WC_PATH="${wc_path}" -} - -# @FUNCTION: subversion_src_unpack -# @DESCRIPTION: -# Default src_unpack. Fetch and, in older EAPIs, bootstrap. -subversion_src_unpack() { - subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch." - if has "${EAPI:-0}" 0 1; then - subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." - fi -} - -# @FUNCTION: subversion_src_prepare -# @DESCRIPTION: -# Default src_prepare. Bootstrap. -# Removed in EAPI 6 and later. -subversion_src_prepare() { - [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is removed from subversion.eclass in EAPI 6 and later" - subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." -} - -# @FUNCTION: subversion_pkg_preinst -# @USAGE: [repo_uri] -# @DESCRIPTION: -# Log the svn revision of source code. Doing this in pkg_preinst because we -# want the logs to stick around if packages are uninstalled without messing with -# config protection. -subversion_pkg_preinst() { - has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" - local pkgdate=$(date "+%Y%m%d %H:%M:%S") - if [[ -n ${ESCM_LOGDIR} ]]; then - local dir="${EROOT%/}${ESCM_LOGDIR}/${CATEGORY}" - if [[ ! -d ${dir} ]]; then - mkdir -p "${dir}" || eerror "Failed to create '${dir}' for logging svn revision" - fi - local logmessage="svn: ${pkgdate} - ${PF}:${SLOT} was merged at revision ${ESVN_WC_REVISION}" - if [[ -d ${dir} ]]; then - echo "${logmessage}" >>"${dir}/${PN}.log" - else - eerror "Could not log the message '${logmessage}' to '${dir}/${PN}.log'" - fi - fi -} - -## -- Private Functions - -## -- subversion__svn_info() ------------------------------------------------- # -# -# param $1 - a target. -# param $2 - a key name. -# -subversion__svn_info() { - local target="${1}" - local key="${2}" - - env LC_ALL=C svn info ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${target}" \ - | grep -i "^${key}" \ - | cut -d" " -f2- -} - -## -- subversion__get_repository_uri() --------------------------------------- # -# -# param $1 - a repository URI. -subversion__get_repository_uri() { - local repo_uri="${1}" - - debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" - if [[ -z ${repo_uri} ]]; then - die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." - fi - # delete trailing slash - if [[ -z ${repo_uri##*/} ]]; then - repo_uri="${repo_uri%/}" - fi - repo_uri="${repo_uri%@*}" - - echo "${repo_uri}" -} - -## -- subversion__get_wc_path() ---------------------------------------------- # -# -# param $1 - a repository URI. -subversion__get_wc_path() { - local repo_uri="$(subversion__get_repository_uri "${1}")" - - debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" - - echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}" -} - -## -- subversion__get_peg_revision() ----------------------------------------- # -# -# param $1 - a repository URI. -subversion__get_peg_revision() { - local repo_uri="${1}" - local peg_rev= - - debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" - # repo_uri has peg revision? - if [[ ${repo_uri} = *@* ]]; then - peg_rev="${repo_uri##*@}" - debug-print "${FUNCNAME}: peg_rev = ${peg_rev}" - else - debug-print "${FUNCNAME}: repo_uri does not have a peg revision." - fi - - echo "${peg_rev}" -} |