Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/update
diff options
context:
space:
mode:
Diffstat (limited to 'bin/update')
-rwxr-xr-xbin/update34
1 files changed, 27 insertions, 7 deletions
diff --git a/bin/update b/bin/update
index 1d317ed..f7b7c44 100755
--- a/bin/update
+++ b/bin/update
@@ -98,25 +98,45 @@ if test "${UPDATE_UPSTREAM}" = 1; then
IFS=" "
while read pkgname pkgver tag revision; do
if test "${VERBOSE}" = 1; then
- echo "${repo} ${pkgname}"
+ echo -n "${repo} ${pkgname}"
fi
if test ! -d "${packages_dir}/${repo}/${pkgname}"; then
+ if test "${VERBOSE}" = 1; then
+ echo ".. cloning .."
+ fi
cd "${packages_dir}/${repo}" || exit 1
pkgctl repo clone --protocol=https "${pkgname}"
sleep 10
else
- true
-# TODO: find a way to find out whether the reference revision is in out
-# current state repo and update only when we miss it. We can still
-# do a full update when we need it, but here it just creates a lot
-# of load..
-# git -C "${packages_dir}/${repo}/${pkgname}" pull
+ # get all revisions from the package repo, check if
+ # we find the state sha in there, if not, do an
+ # update of the repo. Doing a full git pull on
+ # every update is not acceptable as it creates too
+ # much load
+ cd "${packages_dir}/${repo}/${pkgname}" || exit 1
+ git show-ref --tags > /tmp/update_package_revisions.$$
+ grep -F "${revision}" "/tmp/update_package_revisions.$$" 2>&1 >/tmp/update_package_revision_found.$$
+ if test $? = 0; then
+ if test "${VERBOSE}"; then
+ tag=`cat /tmp/update_package_revision_found.$$ | cut -d ' ' -f 2`
+ echo ".. ${revision} (${tag}) exists in package history .."
+ fi
+ else
+ if test "${VERBOSE}"; then
+ echo ".. updating .."
+ fi
+ git -C "${packages_dir}/${repo}/${pkgname}" pull
+ sleep 10
+ fi
+ rm -f /tmp/update_package_revisions.$$ /tmp/update_package_revision_found.$$
fi
done < $pkgfile
IFS="$OLDIFS"
done
fi
+rm -f /tmp/update_packages.$$
+
if test "${UPDATE_AUR}" = 1; then
echo "Updating AUR state.."