Aaron Griffin:
> I made a few small changes and pushed them to git. I have not fully
> committed all of the db-update changes, as I'm not entirely sure why
> some of these changes were made - for instance: why was the pkglisting
> broken out to the top of the file?
>
>   
It seems I had forgotten to reply to the above! Sorry.

The current dev version of db-update will stop with errors if, for at
least one of the three arch categories, no package is present under
$staging. In other words, if you run it and there are N packages for
arch=any, but none for arch=i686, for instance. The script attempts to
copy files for each arch, but if none is there, cp returns an error and
db-update will die. I send you a patch to fix that by checking first for
the existence of at least one package before attempting to copy it to
the ftp tree.
I'm also sending you three additional patches: a second one to create
the $WORKDIR before cd'ing to it, a third one that fixes an obvious bug
in the creation of symlinks, and a fourth one to fix the incorrect
redirection of error messages for get_svnpath in db-functions.

Hope it helps...


> Regarding the new convert2any script you added - I'd prefer to fix the
> existing script rather than add a new one - or at least preserve some
> of the logic (such as sourcing of makepkg.conf)
>
>   

All right, perhaps Abhishek can do that? ;)

F
>From 27139784eba55039116741e30f31b001b1931eeb Mon Sep 17 00:00:00 2001
From: Francois Charette <[email protected]>
Date: Tue, 12 May 2009 10:35:33 +0200
Subject: [PATCH 1/2] Check whether packages exist in build dirs before attempting to copy them

---
 db-update |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/db-update b/db-update
index 8d3e1ab..ce04f7f 100755
--- a/db-update
+++ b/db-update
@@ -204,19 +204,23 @@ 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'"
-		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
-		for f in "$WORKDIR/build/"*any.pkg.tar.gz; do
-			if ! /bin/cp "$f" "$ftppath_any"; then
-				die "error: failure while copying files to $ftppath_any"
-			fi
-			if ! ln -s "$ftppath_any/$f" "$ftppath/$f"; then
-				die "error: failed to make link for $f."
-			fi
-		done
+		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/cp "$f" "$ftppath_any"; then
+					die "error: failure while copying files to $ftppath_any"
+				fi
+				if ! ln -s "$ftppath_any/$f" "$ftppath/$f"; then
+					die "error: failed to make link for $f."
+				fi
+			done
+		fi
 		if ! /bin/cp "$WORKDIR/build/$reponame.db"* "$ftppath"; then
 			die "failed to move repository $reponame-$A".
 		fi
-- 
1.6.3

>From 6ce2d1eeec9a57c345643a542fe740db48975596 Mon Sep 17 00:00:00 2001
From: Francois Charette <[email protected]>
Date: Tue, 12 May 2009 11:29:44 +0200
Subject: [PATCH 2/2] create $WORKDIR before cding to it

---
 db-update |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/db-update b/db-update
index ce04f7f..940a8fd 100755
--- a/db-update
+++ b/db-update
@@ -83,6 +83,7 @@ fi
 
 pkgtotal=$(echo "$ANYPKGS" | wc -w)
 echo "==> Processing $pkgtotal new/updated arch-independent packages for '$reponame'..." >&2
+mkdir -p $WORKDIR
 cd "$WORKDIR"
 svnpath="$(get_svnpath $reponame)"
 /usr/bin/svn checkout -N $svnpath checkout
-- 
1.6.3

>From b1628e13c0389cc78183bc6bd3b6032e0b2b52e6 Mon Sep 17 00:00:00 2001
From: Francois Charette <[email protected]>
Date: Tue, 12 May 2009 11:42:27 +0200
Subject: [PATCH] fixed filename in creation of symlinks

---
 db-update |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/db-update b/db-update
index 940a8fd..88126e6 100755
--- a/db-update
+++ b/db-update
@@ -217,8 +217,9 @@ for A in ${arch...@]}; do
 				if ! /bin/cp "$f" "$ftppath_any"; then
 					die "error: failure while copying files to $ftppath_any"
 				fi
-				if ! ln -s "$ftppath_any/$f" "$ftppath/$f"; then
-					die "error: failed to make link for $f."
+				bf=$(basename $f)
+				if ! ln -s "$ftppath_any/$bf" "$ftppath/$bf"; then
+					die "error: failed to make link for $bf."
 				fi
 			done
 		fi
-- 
1.6.3

>From 609563c70f3a4fe125e6b13a9a186b40dd650dfb Mon Sep 17 00:00:00 2001
From: Francois Charette <[email protected]>
Date: Tue, 12 May 2009 11:48:12 +0200
Subject: [PATCH] fixed redirection of error msgs in get_svnpath

---
 db-functions |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/db-functions b/db-functions
index 99de756..f052bad 100644
--- a/db-functions
+++ b/db-functions
@@ -99,8 +99,8 @@ get_svnpath () { #get_svnpath reponame
 
 	eval repopath=${var}
 	if [ -z "$repopath" ]; then
-		echo "ERROR: SVN path not defined for '${1}'" >2
-		echo "       Please check SVNREPO_${1} config setting" >2
+		echo "ERROR: SVN path not defined for '${1}'" 2>
+		echo "       Please check SVNREPO_${1} config setting" 2>
 	fi
 	
 	echo "$repopath"
-- 
1.6.3

Reply via email to