/[gentoo-x86]/eclass/git-r3.eclass
Gentoo

Diff of /eclass/git-r3.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.50 Revision 1.51
1# Copyright 1999-2015 Gentoo Foundation 1# Copyright 1999-2015 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.50 2015/07/09 20:21:05 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.51 2015/08/08 09:32:50 mgorny Exp $
4 4
5# @ECLASS: git-r3.eclass 5# @ECLASS: git-r3.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Michał Górny <mgorny@gentoo.org> 7# Michał Górny <mgorny@gentoo.org>
8# @BLURB: Eclass for fetching and unpacking git repositories. 8# @BLURB: Eclass for fetching and unpacking git repositories.
183 case "${EGIT_MIN_CLONE_TYPE}" in 183 case "${EGIT_MIN_CLONE_TYPE}" in
184 shallow) 184 shallow)
185 ;; 185 ;;
186 single) 186 single)
187 if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then 187 if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then
188 einfo "git-r3: ebuild needs to be cloned in 'single' mode, adjusting" 188 einfo "git-r3: ebuild needs to be cloned in '\e[1msingle\e[22m' mode, adjusting"
189 EGIT_CLONE_TYPE=single 189 EGIT_CLONE_TYPE=single
190 fi 190 fi
191 ;; 191 ;;
192 single+tags) 192 single+tags)
193 if [[ ${EGIT_CLONE_TYPE} == shallow || ${EGIT_CLONE_TYPE} == single ]]; then 193 if [[ ${EGIT_CLONE_TYPE} == shallow || ${EGIT_CLONE_TYPE} == single ]]; then
194 einfo "git-r3: ebuild needs to be cloned in 'single+tags' mode, adjusting" 194 einfo "git-r3: ebuild needs to be cloned in '\e[1msingle+tags\e[22m' mode, adjusting"
195 EGIT_CLONE_TYPE=single+tags 195 EGIT_CLONE_TYPE=single+tags
196 fi 196 fi
197 ;; 197 ;;
198 mirror) 198 mirror)
199 if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then 199 if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then
200 einfo "git-r3: ebuild needs to be cloned in 'mirror' mode, adjusting" 200 einfo "git-r3: ebuild needs to be cloned in '\e[1mmirror\e[22m' mode, adjusting"
201 EGIT_CLONE_TYPE=mirror 201 EGIT_CLONE_TYPE=mirror
202 fi 202 fi
203 ;; 203 ;;
204 *) 204 *)
205 die "Invalid EGIT_MIN_CLONE_TYPE=${EGIT_MIN_CLONE_TYPE}" 205 die "Invalid EGIT_MIN_CLONE_TYPE=${EGIT_MIN_CLONE_TYPE}"
530 if [[ ${EVCS_UMASK} ]]; then 530 if [[ ${EVCS_UMASK} ]]; then
531 saved_umask=$(umask) 531 saved_umask=$(umask)
532 umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}" 532 umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}"
533 fi 533 fi
534 for r in "${repos[@]}"; do 534 for r in "${repos[@]}"; do
535 einfo "Fetching ${r} ..." 535 einfo "Fetching \e[1m${r}\e[22m ..."
536 536
537 local fetch_command=( git fetch "${r}" ) 537 local fetch_command=( git fetch "${r}" )
538 local clone_type=${EGIT_CLONE_TYPE} 538 local clone_type=${EGIT_CLONE_TYPE}
539 539
540 if [[ ${r} == https://* ]] && ! ROOT=/ has_version 'dev-vcs/git[curl]'; then 540 if [[ ${r} == https://* ]] && ! ROOT=/ has_version 'dev-vcs/git[curl]'; then
551 # 1) can't handle shallow clones at all, 551 # 1) can't handle shallow clones at all,
552 # 2) fetches duplicately when tags are pulled in with branch 552 # 2) fetches duplicately when tags are pulled in with branch
553 # so automatically switch to single+tags mode. 553 # so automatically switch to single+tags mode.
554 if [[ ${clone_type} == shallow ]]; then 554 if [[ ${clone_type} == shallow ]]; then
555 einfo " Google Code does not support shallow clones" 555 einfo " Google Code does not support shallow clones"
556 einfo " using EGIT_CLONE_TYPE=single+tags" 556 einfo " using \e[1mEGIT_CLONE_TYPE=single+tags\e[22m"
557 clone_type=single+tags 557 clone_type=single+tags
558 elif [[ ${clone_type} == single ]]; then 558 elif [[ ${clone_type} == single ]]; then
559 einfo " git-r3: Google Code does not send tags properly in 'single' mode" 559 einfo " git-r3: Google Code does not send tags properly in 'single' mode"
560 einfo " using EGIT_CLONE_TYPE=single+tags" 560 einfo " using \e[1mEGIT_CLONE_TYPE=single+tags\e[22m"
561 clone_type=single+tags 561 clone_type=single+tags
562 fi 562 fi
563 fi 563 fi
564 564
565 if [[ ${clone_type} == mirror ]]; then 565 if [[ ${clone_type} == mirror ]]; then
769 local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}} 769 local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}}
770 770
771 local -x GIT_DIR 771 local -x GIT_DIR
772 _git-r3_set_gitdir "${repos[0]}" 772 _git-r3_set_gitdir "${repos[0]}"
773 773
774 einfo "Checking out ${repos[0]} to ${out_dir} ..." 774 einfo "Checking out \e[1m${repos[0]}\e[22m to \e[1m${out_dir}\[e22m ..."
775 775
776 if ! git cat-file -e refs/git-r3/"${local_id}"/__main__; then 776 if ! git cat-file -e refs/git-r3/"${local_id}"/__main__; then
777 if [[ ${EVCS_OFFLINE} ]]; then 777 if [[ ${EVCS_OFFLINE} ]]; then
778 die "No local clone of ${repos[0]}. Unable to work with EVCS_OFFLINE." 778 die "No local clone of ${repos[0]}. Unable to work with EVCS_OFFLINE."
779 else 779 else
914 914
915 [[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset" 915 [[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset"
916 916
917 local r success 917 local r success
918 for r in "${repos[@]}"; do 918 for r in "${repos[@]}"; do
919 einfo "Peeking ${remote_ref} on ${r} ..." >&2 919 einfo "Peeking \e[1m${remote_ref}\e[22m on \e[1m${r}\e[22m ..." >&2
920 920
921 local is_branch lookup_ref 921 local is_branch lookup_ref
922 if [[ ${remote_ref} == refs/heads/* || ${remote_ref} == HEAD ]] 922 if [[ ${remote_ref} == refs/heads/* || ${remote_ref} == HEAD ]]
923 then 923 then
924 is_branch=1 924 is_branch=1
964 git-r3_src_fetch 964 git-r3_src_fetch
965 git-r3_checkout 965 git-r3_checkout
966} 966}
967 967
968# https://bugs.gentoo.org/show_bug.cgi?id=482666 968# https://bugs.gentoo.org/show_bug.cgi?id=482666
969git-r3_pkg_outofdate() { 969git-r3_pkg_needrebuild() {
970 debug-print-function ${FUNCNAME} "$@" 970 debug-print-function ${FUNCNAME} "$@"
971 971
972 local new_commit_id=$(git-r3_peek_remote_ref) 972 local new_commit_id=$(git-r3_peek_remote_ref)
973 ewarn "old: ${EGIT_VERSION}" 973 [[ ${new_commit_id} && ${EGIT_VERSION} ]] || die "Lookup failed"
974 ewarn "new: ${new_commit_id}" 974
975 [[ ${new_commit_id} && ${old_commit_id} ]] || return 2 975 if [[ ${EGIT_VERSION} != ${new_commit_id} ]]; then
976 einfo "Update from \e[1m${EGIT_VERSION}\e[22m to \e[1m${new_commit_id}\e[22m"
977 else
978 einfo "Local and remote at \e[1m${EGIT_VERSION}\e[22m"
979 fi
976 980
977 [[ ${EGIT_VERSION} != ${new_commit_id} ]] 981 [[ ${EGIT_VERSION} != ${new_commit_id} ]]
978} 982}
983
984# 'export' locally until this gets into EAPI
985pkg_needrebuild() { git-r3_pkg_needrebuild; }
979 986
980_GIT_R3=1 987_GIT_R3=1
981fi 988fi

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

  ViewVC Help
Powered by ViewVC 1.1.20