Firmicus a écrit :
> Firmicus a écrit :
>> This could be another bug. I'll test this later.
>
> And here is another patch for that.
>
>

And two more very minor patches ...

I have copied my updated dbscripts to archlinux.org:bin/ (in my $HOME)
and tried
~/bin/db-update testing
Everything worked for i686, but the symlink failed to be made for
x86_64. There was also a spurious error message when repo_unlock was
called for x86_64 ... No idea why! Perhaps I should wait until the
scripts under /arch-new/ are updated to test anew.

FC
>From d8a3d1e5b5497dc4666e84e6896d2c46f44ad594 Mon Sep 17 00:00:00 2001
From: Francois Charette <[email protected]>
Date: Mon, 20 Jul 2009 14:17:53 +0200
Subject: [PATCH 1/2] simple syntactic improvements

---
 db-update |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/db-update b/db-update
index 67f8782..c20aec8 100755
--- a/db-update
+++ b/db-update
@@ -196,15 +196,16 @@ for A in ${arch...@]}; do
 	# if non empty, move all build dirs
 	if [ $(/bin/ls "$WORKDIR/build/" 2>/dev/null | wc -l) != 0 ]; then
 		echo "Copying new files to '$ftppath'"
-		if [ $(/bin/ls "$WORKDIR/build/"*$current_arch$PKGEXT 2>/dev/null | wc -l) != 0 ]; then
-			for f in "$WORKDIR/build/"*$current_arch$PKGEXT; do
+		if [ $(/bin/ls "$WORKDIR/build/"*-$current_arch$PKGEXT 2>/dev/null | wc -l) != 0 ]; then
+			for f in $WORKDIR/build/*-$current_arch$PKGEXT; do
 				if ! /bin/cp "$f" "$ftppath"; then
 					die "error: failure while copying files to $ftppath"
 				fi
 			done
 		fi
-		if [ $(/bin/ls "$WORKDIR/build/"*any$PKGEXT 2>/dev/null | wc -l) != 0 ]; then
-			for f in "$WORKDIR/build/"*any$PKGEXT; do
+		if [ $(/bin/ls "$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"
 				fi
@@ -214,7 +215,7 @@ for A in ${arch...@]}; do
 				fi
 			done
 		fi
-		if ! /bin/cp "$WORKDIR/build/$reponame.db"* "$ftppath"; then
+		if ! /bin/cp "$WORKDIR/build/$reponame.db"* "$ftppath/"; then
 			die "failed to move repository $reponame-$A".
 		fi
 	else
@@ -228,8 +229,10 @@ for A in ${arch...@]}; do
 
 	repo_unlock $reponame $current_arch
 done
+
 if [ -n "$to_add_any" ]; then
 	/bin/rm $to_add_any
 fi
+
 rm -rf $WORKDIR
 # vim: set ts=4 sw=4 noet ft=sh:
-- 
1.6.3.3

>From 63dd915922b1081c2e0d063a3995c02684ad8e88 Mon Sep 17 00:00:00 2001
From: Francois Charette <[email protected]>
Date: Mon, 20 Jul 2009 17:08:47 +0200
Subject: [PATCH 2/2] Minor syntactic improvements in db-update

* also added error msg for repo_lock in db-functions
---
 db-functions |    3 +++
 db-update    |   11 +++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/db-functions b/db-functions
index 50f4555..74731fe 100644
--- a/db-functions
+++ b/db-functions
@@ -40,6 +40,9 @@ repo_lock () { #repo_lock repo-name arch
 		exit 1
 	else
 		/bin/touch "$LOCKFILE"
+		if [ ! -f "$LOCKFILE" ]; then
+			echo "error: could not create repo lock... something went wrong!"
+		fi
 		set_umask
 	fi
 }
diff --git a/db-update b/db-update
index c20aec8..6f4ca27 100755
--- a/db-update
+++ b/db-update
@@ -104,8 +104,7 @@ if [ -n "$ANYPKGS" ]; then
 	done
 fi
 
-for A in ${arch...@]}; do
-	current_arch="$A"
+for current_arch in ${arch...@]}; do
 
 	ftppath="$FTP_BASE/$reponame/os/$current_arch/"
 	ftppath_any="$FTP_BASE/$reponame/os/any/"
@@ -195,15 +194,15 @@ for A in ${arch...@]}; do
 
 	# if non empty, move all build dirs
 	if [ $(/bin/ls "$WORKDIR/build/" 2>/dev/null | wc -l) != 0 ]; then
-		echo "Copying new files to '$ftppath'"
-		if [ $(/bin/ls "$WORKDIR/build/"*-$current_arch$PKGEXT 2>/dev/null | wc -l) != 0 ]; then
+		if [ $(/bin/ls $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"
 				fi
 			done
 		fi
-		if [ $(/bin/ls "$WORKDIR/build/"*-any$PKGEXT 2>/dev/null | wc -l) != 0 ]; then
+		if [ $(/bin/ls $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
@@ -216,7 +215,7 @@ for A in ${arch...@]}; do
 			done
 		fi
 		if ! /bin/cp "$WORKDIR/build/$reponame.db"* "$ftppath/"; then
-			die "failed to move repository $reponame-$A".
+			die "failed to move repository $reponame-$current_arch".
 		fi
 	else
 		echo "Nothing to copy, no work done"
-- 
1.6.3.3

Reply via email to