Attached patch makes git-r3.eclass respect EVCS_UMASK.
See the variable's description in the patch itself (stolen from
subversion.eclass) for the use case.

Ulrich

Index: git-r3.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v
retrieving revision 1.47
diff -u -B -p -r1.47 git-r3.eclass
--- git-r3.eclass       28 Jul 2014 14:13:50 -0000      1.47
+++ git-r3.eclass       1 Feb 2015 21:58:52 -0000
@@ -131,6 +131,17 @@ fi
 # @DESCRIPTION:
 # If non-empty, this variable prevents any online operations.
 
+# @ECLASS-VARIABLE: EVCS_UMASK
+# @DEFAULT_UNSET
+# @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.
+
 # @ECLASS-VARIABLE: EGIT_BRANCH
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -309,8 +320,14 @@ _git-r3_set_gitdir() {
 
        addwrite "${EGIT3_STORE_DIR}"
        if [[ ! -d ${GIT_DIR} ]]; then
+               local restore_umask=":"
+               if [[ ${EVCS_UMASK} ]]; then
+                       restore_umask=$(umask -p)
+                       umask "${EVCS_UMASK}" || die "Bad options to umask: 
${EVCS_UMASK}"
+               fi
                mkdir "${GIT_DIR}" || die
                git init --bare || die
+               ${restore_umask} || die
        fi
 }
 
@@ -508,6 +525,11 @@ git-r3_fetch() {
 
        # try to fetch from the remote
        local r success
+       local restore_umask=":"
+       if [[ ${EVCS_UMASK} ]]; then
+               restore_umask=$(umask -p)
+               umask "${EVCS_UMASK}" || die "Bad options to umask: 
${EVCS_UMASK}"
+       fi
        for r in "${repos[@]}"; do
                einfo "Fetching ${r} ..."
 
@@ -668,6 +690,7 @@ git-r3_fetch() {
                        break
                fi
        done
+       ${restore_umask} || die
        [[ ${success} ]] || die "Unable to fetch from any of EGIT_REPO_URI"
 
        # submodules can reference commits in any branch

Attachment: pgpFWwUePCn2c.pgp
Description: PGP signature

Reply via email to