Permalink
Browse files

Mirror upstream at local from the web and clone from it

Clone upstream repository with --mirror option in ${WORK_PATH}/srcs
when not exist, or run `git fetch` when it does. Then clone to
${WORK_PATH}/src from the local mirror after the everytime removal.
  • Loading branch information...
1 parent 6c130af commit 82817880c4c4d5697badf62015fe12658e211286 @ladios ladios committed Jan 14, 2013
Showing with 21 additions and 12 deletions.
  1. +21 −12 oab-java.sh
View
@@ -397,32 +397,41 @@ pid=$!;progress $pid
# Make sure the required dirs exist.
ncecho " [x] Making build directories "
-mkdir -p ${WORK_PATH}/{deb,gpg,pkg} >> "$log" 2>&1 &
+mkdir -p ${WORK_PATH}/{deb,gpg,pkg,srcs} >> "$log" 2>&1 &
pid=$!;progress $pid
# Set the permissions appropriately for 'gpg'
chown root:root ${WORK_PATH}/gpg 2>/dev/null
chmod 0700 ${WORK_PATH}/gpg 2>/dev/null
+if [ -d ${WORK_PATH}/srcs/${JAVA_UPSTREAM}.git ]; then
+ # Update the code
+ ncecho " [x] Updating from https://github.com/rraptorr/${JAVA_UPSTREAM} "
+ cd ${WORK_PATH}/srcs/${JAVA_UPSTREAM}.git/ >> "$log" 2>&1
+ git fetch >> "$log" 2>&1 &
+ pid=$!;progress $pid
+else
+ # Mirror the code
+ ncecho " [x] Mirroring https://github.com/rraptorr/${JAVA_UPSTREAM} "
+ cd ${WORK_PATH}/srcs/ >> "$log" 2>&1
+ git clone --mirror https://github.com/rraptorr/${JAVA_UPSTREAM} >> "$log" 2>&1 &
+ pid=$!;progress $pid
+fi
+
# Remove the 'src' directory everytime.
-ncecho " [x] Removing clones of https://github.com/rraptorr/${JAVA_UPSTREAM} "
+ncecho " [x] Removing local clones of ${JAVA_UPSTREAM} "
rm -rfv ${WORK_PATH}/${JAVA_UPSTREAM}* 2>/dev/null >> "$log" 2>&1
rm -rfv ${WORK_PATH}/src 2>/dev/null >> "$log" 2>&1 &
pid=$!;progress $pid
-# Clone the code
-ncecho " [x] Cloning https://github.com/rraptorr/${JAVA_UPSTREAM} "
-cd ${WORK_PATH}/ >> "$log" 2>&1
-git clone https://github.com/rraptorr/${JAVA_UPSTREAM} src >> "$log" 2>&1 &
-pid=$!;progress $pid
-
# Get the last commit tag.
-cd ${WORK_PATH}/src >> "$log" 2>&1
+cd ${WORK_PATH}/srcs/${JAVA_UPSTREAM}.git/ >> "$log" 2>&1
TAG=`git describe --abbrev=0 --tags`
-# Checkout the tagged, stable, version.
-ncecho " [x] Checking out ${TAG} "
-git checkout ${TAG} >> "$log" 2>&1 &
+# Clone from mirror, pointing to the tagged, stable, version.
+ncecho " [x] Cloning ${JAVA_UPSTREAM} with ${TAG} "
+cd ${WORK_PATH}/ >> "$log" 2>&1
+git clone -b ${TAG} ${WORK_PATH}/srcs/${JAVA_UPSTREAM}.git src >> "$log" 2>&1 &
pid=$!;progress $pid
# Cet the current Debian package version and package urgency

0 comments on commit 8281788

Please sign in to comment.