diff options
author | John Turner <jturner.usa+gentoo@gmail.com> | 2025-09-18 02:10:25 -0400 |
---|---|---|
committer | John Turner <jturner.usa+gentoo@gmail.com> | 2025-09-18 04:49:42 -0400 |
commit | 12f935c0597d418d7de5f8192de238b80be739de (patch) | |
tree | 36f7260763f1baf711e0ba14a7a2c3a097c768c2 /eclass/git-r3.eclass | |
parent | 822fff37bccd6bf135ef961294d08e45a1b2ff8c (diff) | |
download | ebuilds-12f935c0597d418d7de5f8192de238b80be739de.tar.gz |
add git commit verification to git-r3 and verify-sig eclasses
Diffstat (limited to 'eclass/git-r3.eclass')
-rw-r--r-- | eclass/git-r3.eclass | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass index 35ad6af..f223e66 100644 --- a/eclass/git-r3.eclass +++ b/eclass/git-r3.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: git-r3.eclass @@ -33,6 +33,12 @@ esac if [[ -z ${_GIT_R3_ECLASS} ]]; then _GIT_R3_ECLASS=1 +case ${VERIFY_SIG_METHOD} in + git) + inherit verify-sig + ;; +esac + PROPERTIES+=" live" BDEPEND=">=dev-vcs/git-1.8.2.1[curl]" @@ -512,7 +518,6 @@ _git-r3_set_subrepos() { fi } - # @FUNCTION: _git-r3_is_local_repo # @USAGE: <repo-uri> # @INTERNAL @@ -1149,6 +1154,32 @@ git-r3_src_unpack() { _git-r3_env_setup git-r3_src_fetch + + if use "verify-sig"; then + + local repos + + if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then + repos=( "${EGIT_REPO_URI[@]}" ) + else + repos=( ${EGIT_REPO_URI} ) + fi + + local -x GIT_DIR + _git-r3_set_gitdir "${repos[0]}" + + local commit + if [[ -n ${EGIT_BRANCH} ]]; then + commit=${EGIT_BRANCH} + elif [[ -n ${EGIT_COMMIT} ]]; then + commit=${EGIT_COMMIT} + else + commit=HEAD + fi + + verify-sig_verify_git_repo "${GIT_DIR}" "${commit}" + fi + git-r3_checkout if [[ ! ${EGIT_LFS} && ${_EGIT_LFS_FILTERS_FOUND} ]]; then |