[arch-projects] [dbscripts] [PATCH] Add repo_mtime file

Florian Pritz bluewind at xinu.at
Fri Jan 25 16:57:10 EST 2013


This allows for faster checking if an update might be needed and helps
to let reporead run when something changed.

Signed-off-by: Florian Pritz <bluewind at xinu.at>
---
 db-functions | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/db-functions b/db-functions
index b9d0d2f..2480be3 100644
--- a/db-functions
+++ b/db-functions
@@ -18,6 +18,7 @@ restore_umask () {
 # set up general environment
 WORKDIR=$(mktemp -d "${TMPDIR}/${0##*/}.XXXXXXXXXX")
 LOCKS=()
+REPO_MODIFIED=0
 
 # check if messages are to be printed using color
 unset ALL_OFF BOLD BLUE GREEN RED YELLOW
@@ -128,6 +129,11 @@ cleanup() {
 		script_unlock
 	fi
 	rm -rf "$WORKDIR"
+
+	if (( REPO_MODIFIED )); then
+		date +%s > "${FTP_BASE}/repo_mtime"
+	fi
+
 	[ "$1" ] && exit $1
 }
 
@@ -485,6 +491,8 @@ arch_repo_add() {
 		|| error "repo-add -f ${repo}${FILESEXT} ${pkgs[@]}"
 	popd >/dev/null
 	set_repo_permission "${repo}" "${arch}"
+
+	REPO_MODIFIED=1
 }
 
 arch_repo_remove() {
@@ -503,6 +511,8 @@ arch_repo_remove() {
 	/usr/bin/repo-remove -q "${filesfile}" ${pkgs[@]} \
 		|| error "repo-remove ${filesfile} ${pkgs[@]}"
 	set_repo_permission "${repo}" "${arch}"
+
+	REPO_MODIFIED=1
 }
 
 arch_svn() {
-- 
1.8.1.1


More information about the arch-projects mailing list