aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2017-02-26 17:46:13 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2017-02-26 17:53:04 -0800
commit9cb3b2a709d826722960964c40059595de56ac91 (patch)
tree4dc61bc0235f8d8d9445839ccdd799cd51fb2808 /mastermirror-staging.sh
parentUpdate STAGEDIR, FINALDIR in remaining scripts (diff)
downloadmastermirror-scripts-9cb3b2a709d826722960964c40059595de56ac91.tar.gz
mastermirror-scripts-9cb3b2a709d826722960964c40059595de56ac91.tar.bz2
mastermirror-scripts-9cb3b2a709d826722960964c40059595de56ac91.zip
Enable $Id$ expansion on gentoo.git.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'mastermirror-staging.sh')
-rwxr-xr-xmastermirror-staging.sh36
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))