diff options
-rwxr-xr-x | mastermirror-staging.sh | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/mastermirror-staging.sh b/mastermirror-staging.sh index 5b0c140..fb40ab9 100755 --- a/mastermirror-staging.sh +++ b/mastermirror-staging.sh @@ -57,20 +57,42 @@ REPO_changelogs=${GITROOT}/data/gentoo-changelogs.git PROJECTS_XML_URI=https://api.gentoo.org/metastructure/projects.xml +# gitattributes +ATTRIB_gentoo=( + '*/*/*.ebuild ident' + '*/metadata.xml ident' + '*/*/metadata.xml ident' + 'eclass/*.eclass ident' + 'eclass/tests/* ident' + 'profiles/* ident' + 'scripts/* ident' +) + # Ensure all files are readable umask 0022 fetch_git() { targetdir=$1 repo=$2 - if [[ ! -d ${targetdir} ]] ; then + shift 2 + gitdir=${targetdir}.git + if [[ ! -d "${targetdir}" ]] ; then # not checked out yet, run initial co - ${GIT_CL} $repo --separate-git-dir=${targetdir}.git $targetdir || return 1 - else - cd ${targetdir} - ${GIT_PL} || return 1 + mkdir -p "${targetdir}.git" "$gitdir" && \ + $GIT init -q \ + --separate-git-dir "$gitdir" + "${targetdir}" && \ + GIT_DIR=${gitdir} $GIT remote add origin "$repo" fi - cd $targetdir && $GIT_RESTORE_MTIME || return 1 + attribfile=${gitdir}/info/attributes + for line in "$@" ; do + fgrep -sq -e "$line" "$attribfile" || + echo "$line" >>"$attribfile" + done + cd "${targetdir}" || return 1 + $GIT fetch -q --force origin master || return 1 + $GIT reset -q --hard origin/master || return 1 + $GIT_RESTORE_MTIME || return 1 } fetch_uri() { @@ -90,7 +112,7 @@ fetch_uri() { rc_sum=0 # repo/gentoo (formerly CVS gentoo-x86) -fetch_git ${STAGING_DIR_gentoo} ${REPO_gentoo} +fetch_git ${STAGING_DIR_gentoo} ${REPO_gentoo} "${ATTRIB_gentoo[@]}" rc=$? rc_sum=$((rc_sum + $rc)) |