Re: New Release: fou4s 0.12.4

Lars Ellenberg <[email protected]> Tue, 26 Oct 2004 18:23:51 +0200
Newsgroups gmane.linux.suse.fou4s.devel
Message-ID <[email protected]>
/ 2004-10-25 23:01:19 +0200
\ Markus Gaugusch:
> This version fixes only two bugs:
>   + Reboot notification was wrong for kernel 2.6.5-7.111
>   + Fix kernel backup feature (wrong path was used -> no copying)
> 
> Many thanks go to Lars Ellenberg and Klaus Lehmann for code contributions 
> and testing!

and later, today:

> Please note, that I've updated 0.12.4 to 0.12.4-1 today because of a 
> problem during update installation, which happened only on some
> machines 
> (not any of mine, but at least on those of two other users).


some more fixes:

 * $machinearch never defined...
   you allow i786 on i386 $MACHINEARCH  ;)
 * cleaned up the PKGDESCFILES=(something) ...
   bash is not c, "\n" is a literal "n"; if you really wanted it, you
   could use $'\n', though.
   and your current code won't work with "directory-files other than
   */patches/directory.*, so why not stream-edit them directly.

please verify whether this (still) is what you meant.

Thanks,

	Lars Ellenberg

btw, you are sure that you want to have ~200 character long lines?
   

--- fou4s-0.12.4/fou4s.orig	2004-10-26 16:30:14.000000000 +0200
+++ fou4s-0.12.4/fou4s	2004-10-26 18:05:51.000000000 +0200
@@ -1646,16 +1646,16 @@
 
 	[ $a $op $b ]
 	ret=$?
-	myEcho 3 "Comparing $a $op $b: $ret "
 	# if this happens, you called this with an invalid op
 	# check source code!
 	[ $ret -gt 1 ] && { myError 0 "Error ($ret) in vcmp:" [ $a \\$op $b ]; }
+	[[ $ret = 0 ]] && bool=true || bool=false
+	myEcho 3 "Comparing $a $op $b: $bool"
 
 	# warn to stderr if length of padded a and b differ
 	# it was something like a=3.0 and b=3.0.1
 	# or a=0.8.7 and b=0.9.1_beta
 	if [ $QUIET -eq 0 -a ${#a} != ${#b} -a $FORCEINSTALL -eq 0 -a "$3" != "0.0.0.0-0" -a "$3" != "N/A" -a "$kind" != "generated" ] && ! packageFiltered $pkg $kind $series; then
-		[ $ret -eq 1 ] && bool=false || bool=true
 		myWarn 2 "Warn: Different version structure: $pkg: $1 $op $3 = $bool" >&2
 		myWarn 2 "Using buildtime to check again for safety ..." >&2
 		usebuildtime=1 # non-global variable only used for this check in checkpkg.
@@ -2170,7 +2170,13 @@
 		arch=`grep "^=Pkg: $pkg " $PACKAGES81 | grep -v src$`
 		arch=${arch##* }
 	fi
-	[[ $series != default && $series == @(${VALIDARCHS// /|}) ]] && myEcho 2 "Using arch $series instead of $arch for $pkg" && arch=$series # fixme does this really work?!?!
+	if	[[ $series != $arch ]] &&
+		# [[ $series != default ]] && redundant with next
+		[[ $series == @(${VALIDARCHS// /|}) ]]
+	then
+		myEcho 2 "Using arch $series instead of $arch for $pkg"
+		arch=$series # fixme does this really work?!?!
+	fi
 	if [[ $filename != *.rpm ]] ; then
 		if [ $usepatchrpmnow -eq 1 ] ; then
 			filename=$filename-$newversion.$arch.patch.rpm
@@ -2200,7 +2206,7 @@
 	for a in $VALIDARCHS ; do
 		test "$arch" == "$a" && quit=0 && break
 	done
-	test $quit -eq 1 && myWarn 2 "Invalid arch for $pkg: $arch, skipping" && return
+	test $quit -eq 1 && myWarn 0 "Invalid arch for $pkg: $arch, skipping" && return
 	if [ $USEFULLPATH -eq 0 ] || [[ $rpm == *tp://* ]] ; then
 		baserpm=${rpm##*/} rpmpath=.
 	else
@@ -2214,13 +2220,13 @@
 	# forced because of installtrigger or updateonlyinstalled=0
 	test $FORCEINSTALL -eq 1 -a $remarkonly -eq 0 && update=1
 	# compare packages
+	test "$currentversion" == "N/A" && update=1
 	if [ $update -eq 0 ] ; then
 		local usebuildtime=$USEBUILDTIME # can be overwritten in vcmp
 		if [ $USEBUILDTIME -eq 0 ] ; then
 			test "$currentversion" = "$newversion" && return # same version
 			test -n "$currentversion" -a "$currentversion" != "N/A" && \
 				vcmp "$newversion" \> "$currentversion" && update=1
-			test "$currentversion" == "N/A" && update=1
 		fi
 		if [ $usebuildtime -eq 1 -a "$currentversion" != "N/A" ] ; then
 			[ -n "$newbuildtime" -a -n "$curbuildtime" \
@@ -2713,7 +2719,7 @@
 		VALIDARCHS=noarch
 		for a in i386 i486 i586 i686 i786 ; do
 			VALIDARCHS="$VALIDARCHS $a"
-			test "$a" == "$machinearch" && break
+			test "$a" == "$MACHINEARCH" && break
 		done
 	fi
 	RPMCACHE=$CACHEDIR/.cache.$HOSTNAME/rpmcache.$SUSEVERSION # cache file with all versions
@@ -3187,20 +3193,25 @@
 		cd "$DLPATH"
 		PKGDESCFILES=
 		if [ $USEDIR -eq 1 ] ; then
-			DIRFILES=`find ./$server/$SERVERPATH -follow -regex ".*\/directory.*" 2>/dev/null`
-			test -n "$DIRFILES" && for dir in $DIRFILES ; do
-				for p in `cat $dir` ; do
-					PKGDESCFILES="./$server/$SERVERPATH/patches/$p\n$PKGDESCFILES"
-				done
-			done
+			#DIRFILES=`find ./$server/$SERVERPATH -follow -regex ".*\/directory.*" 2>/dev/null`
+			# that won't work with something different than "patches/directory.*" anyways.
+			# so just use them directly.
+			PKGDESCFILES=$(
+				shopt -s nullglob
+				sed -e "s|^|./$server/$SERVERPATH/patches/|" \
+					./$server/$SERVERPATH/patches/directory.* /dev/null |
+				grep -v -F -f $SKIPPEDPATCHESFILE |
+				sort -u
+			)
 			test -z "$PKGDESCFILES" && myEcho 3 "No directory file found on $server"
-			PKGDESCFILES=`echo $PKGDESCFILE| grep -v -F -f $SKIPPEDPATCHESFILE`
 		fi
 		if [ -z "$PKGDESCFILES" ] ; then
-			PKGDESCFILES=`find ./$server/$SERVERPATH/patches* -follow -regex ".*$PATCHGLOB" 2>/dev/null\
-			| grep -v -F -f $SKIPPEDPATCHESFILE`
+			# either no patches/directory.X, or all SKIPPED.
+			PKGDESCFILES=$(
+				find ./$server/$SERVERPATH/patches* -follow -regex ".*$PATCHGLOB" 2>/dev/null |
+				grep -v -F -f $SKIPPEDPATCHESFILE | sort
+			)
 		fi
-		PKGDESCFILES=`echo $PKGDESCFILES | tr " " "\n" | sort -u`
 		# if --nogenerated is used, we don't want to see this message
 		if [ -z "$PKGDESCFILES" -a $GENERATED -eq 1 ] ; then
 			echo -e $COL_RED
@@ -3213,6 +3224,9 @@
 		fi
 		ALLPKGDESCFILES="$ALLPKGDESCFILES $PKGDESCFILES"
 		if [ $EXPORT -eq 1 ] ; then
+			# FIXME this does not make too much sense to have in the inner loop?
+			# at least, then it should not tar --append $ALLPAKGDESCFILES
+			# but only $PKGDESCFILES !
 			(
 			cd "$BASEDIR"
 			cd "$DLPATH"
--