[arch-dev-public] [PATCH 5/7] db-update: Use a master package pool and symlinks

Ghost1227 ghost1227 at archlinux.us
Thu Mar 11 23:06:35 CET 2010


---
 db-update |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/db-update b/db-update
index be16499..572e44a 100755
--- a/db-update
+++ b/db-update
@@ -131,6 +131,11 @@ for current_arch in ${ARCHES[@]}; do
 
 	ftppath="$FTP_BASE/$reponame/os/$current_arch"
 	ftppath_any="$FTP_BASE/$reponame/os/any"
+	poolpath="$FTP_BASE/packages/os/$current_arch"
+	poolpath_any="$FTP_BASE/packages/os/any"
+	# The following is used to create relative symlinks
+	poolrel="../../../packages/os/$current_arch"
+	poolrel_any='../../../packages/os/any'	
 
 	if [ ! -d "$ftppath" ]; then
 		echo "FTP path for this repo ($reponame) is missing"
@@ -219,20 +224,27 @@ for current_arch in ${ARCHES[@]}; do
 		if [ $(getpkgfiles "$WORKDIR/build/"*-$current_arch$PKGEXT 2>/dev/null | wc -l) != 0 ]; then
 			echo "Copying new files to '$ftppath'"
 			for f in "$WORKDIR/build/"*-$current_arch$PKGEXT; do
-				if ! /bin/cp "$f" "$ftppath/"; then
-					die "error: failure while copying files to $ftppath"
+				if ! /bin/cp "$f" "$poolpath/"; then
+					die "error: failure while copying files to $poolpath"
+				fi
+				fname="$(basename $f)"
+				if ! ln -s "$poolrel/$fname" "$ftppath/$fname"; then
+					die "error: failure symlinking $fname to $ftppath"
 				fi
 			done
 		fi
 		if [ $(getpkgfiles "$WORKDIR/build/"*-any$PKGEXT 2>/dev/null | wc -l) != 0 ]; then
 			echo "Copying new files to '$ftppath_any' and symlinking"
 			for f in "$WORKDIR/build/"*-any$PKGEXT; do
-				if ! /bin/cp "$f" "$ftppath_any"; then
-					die "error: failure while copying files to $ftppath_any"
+				if ! /bin/cp "$f" "$poolpath_any"; then
+					die "error: failure while copying files to $poolpath_any"
+				fi
+				fname="$(basename $f)"
+				if ! ln -s "$poolrel_any/$fname" "$ftppath_any/$fname"; then
+					die "error: failure symlinking $fname to $ftppath_any"
 				fi
-				bf=$(basename $f)
-				if ! ln -s "../any/$bf" "$ftppath/$bf"; then
-					die "error: failed to make link for $bf."
+				if ! ln -s "$poolrel_any/$fname" "$ftppath/$fname"; then
+					die "error: failed symlinking $fname to $ftppath"
 				fi
 			done
 		fi
-- 
1.7.0.2




-- 


More information about the arch-dev-public mailing list