mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-28 00:51:41 +02:00
eclass/git-r3: Sync with Gentoo
It's from Gentoo commit 0dbbdfc6c6485614f2f84914dec2326cdb2a08e9.
This commit is contained in:
parent
52344a97d7
commit
de985a5696
@ -1,27 +1,26 @@
|
|||||||
# Copyright 1999-2021 Gentoo Authors
|
# Copyright 1999-2023 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# @ECLASS: git-r3.eclass
|
# @ECLASS: git-r3.eclass
|
||||||
# @MAINTAINER:
|
# @MAINTAINER:
|
||||||
# Michał Górny <mgorny@gentoo.org>
|
# Michał Górny <mgorny@gentoo.org>
|
||||||
# @SUPPORTED_EAPIS: 5 6 7 8
|
# @SUPPORTED_EAPIS: 6 7 8
|
||||||
# @BLURB: Eclass for fetching and unpacking git repositories.
|
# @BLURB: Eclass for fetching and unpacking git repositories.
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Third generation eclass for easing maintenance of live ebuilds using
|
# Third generation eclass for easing maintenance of live ebuilds using
|
||||||
# git as remote repository.
|
# git as remote repository.
|
||||||
|
|
||||||
case ${EAPI:-0} in
|
case ${EAPI} in
|
||||||
5|6|7|8) ;;
|
6|7|8) ;;
|
||||||
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
EXPORT_FUNCTIONS src_unpack
|
if [[ -z ${_GIT_R3_ECLASS} ]]; then
|
||||||
|
_GIT_R3_ECLASS=1
|
||||||
if [[ ! ${_GIT_R3} ]]; then
|
|
||||||
|
|
||||||
PROPERTIES+=" live"
|
PROPERTIES+=" live"
|
||||||
|
|
||||||
if [[ ${EAPI} != [56] ]]; then
|
if [[ ${EAPI} != 6 ]]; then
|
||||||
BDEPEND=">=dev-vcs/git-1.8.2.1[curl]"
|
BDEPEND=">=dev-vcs/git-1.8.2.1[curl]"
|
||||||
else
|
else
|
||||||
DEPEND=">=dev-vcs/git-1.8.2.1[curl]"
|
DEPEND=">=dev-vcs/git-1.8.2.1[curl]"
|
||||||
@ -559,49 +558,46 @@ git-r3_fetch() {
|
|||||||
local commit_id=${2:-${EGIT_COMMIT}}
|
local commit_id=${2:-${EGIT_COMMIT}}
|
||||||
local commit_date=${4:-${EGIT_COMMIT_DATE}}
|
local commit_date=${4:-${EGIT_COMMIT_DATE}}
|
||||||
|
|
||||||
# support new override API for EAPI 6+
|
# get the name and do some more processing:
|
||||||
if [[ ${EAPI} != 5 ]]; then
|
# 1) kill .git suffix,
|
||||||
# get the name and do some more processing:
|
# 2) underscore (remaining) non-variable characters,
|
||||||
# 1) kill .git suffix,
|
# 3) add preceding underscore if it starts with a digit,
|
||||||
# 2) underscore (remaining) non-variable characters,
|
# 4) uppercase.
|
||||||
# 3) add preceding underscore if it starts with a digit,
|
local override_name=${GIT_DIR##*/}
|
||||||
# 4) uppercase.
|
override_name=${override_name%.git}
|
||||||
local override_name=${GIT_DIR##*/}
|
override_name=${override_name//[^a-zA-Z0-9_]/_}
|
||||||
override_name=${override_name%.git}
|
override_name=${override_name^^}
|
||||||
override_name=${override_name//[^a-zA-Z0-9_]/_}
|
|
||||||
override_name=${override_name^^}
|
|
||||||
|
|
||||||
local varmap=(
|
local varmap=(
|
||||||
REPO:repos
|
REPO:repos
|
||||||
BRANCH:branch_name
|
BRANCH:branch_name
|
||||||
COMMIT:commit_id
|
COMMIT:commit_id
|
||||||
COMMIT_DATE:commit_date
|
COMMIT_DATE:commit_date
|
||||||
)
|
)
|
||||||
|
|
||||||
local localvar livevar live_warn= override_vars=()
|
local localvar livevar live_warn= override_vars=()
|
||||||
for localvar in "${varmap[@]}"; do
|
for localvar in "${varmap[@]}"; do
|
||||||
livevar=EGIT_OVERRIDE_${localvar%:*}_${override_name}
|
livevar=EGIT_OVERRIDE_${localvar%:*}_${override_name}
|
||||||
localvar=${localvar#*:}
|
localvar=${localvar#*:}
|
||||||
override_vars+=( "${livevar}" )
|
override_vars+=( "${livevar}" )
|
||||||
|
|
||||||
if [[ -n ${!livevar} ]]; then
|
if [[ -n ${!livevar} ]]; then
|
||||||
[[ ${localvar} == repos ]] && repos=()
|
[[ ${localvar} == repos ]] && repos=()
|
||||||
live_warn=1
|
live_warn=1
|
||||||
ewarn "Using ${livevar}=${!livevar}"
|
ewarn "Using ${livevar}=${!livevar}"
|
||||||
declare "${localvar}=${!livevar}"
|
declare "${localvar}=${!livevar}"
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ ${live_warn} ]]; then
|
|
||||||
ewarn "No support will be provided."
|
|
||||||
else
|
|
||||||
einfo "To override fetched repository properties, use:"
|
|
||||||
local x
|
|
||||||
for x in "${override_vars[@]}"; do
|
|
||||||
einfo " ${x}"
|
|
||||||
done
|
|
||||||
einfo
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ${live_warn} ]]; then
|
||||||
|
ewarn "No support will be provided."
|
||||||
|
else
|
||||||
|
einfo "To override fetched repository properties, use:"
|
||||||
|
local x
|
||||||
|
for x in "${override_vars[@]}"; do
|
||||||
|
einfo " ${x}"
|
||||||
|
done
|
||||||
|
einfo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set final variables after applying overrides
|
# set final variables after applying overrides
|
||||||
@ -1079,5 +1075,6 @@ git-r3_pkg_needrebuild() {
|
|||||||
# 'export' locally until this gets into EAPI
|
# 'export' locally until this gets into EAPI
|
||||||
pkg_needrebuild() { git-r3_pkg_needrebuild; }
|
pkg_needrebuild() { git-r3_pkg_needrebuild; }
|
||||||
|
|
||||||
_GIT_R3=1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
EXPORT_FUNCTIONS src_unpack
|
||||||
|
Loading…
x
Reference in New Issue
Block a user