[SCM] Git repository for devscripts branch, master, updated. v2.11.7-60-g92c635f

Ron ron at debian.org
Sun Jun 3 15:15:35 UTC 2012


The following commit has been merged in the master branch:
commit 92c635fa1089723fc70ac881ffc804def92f1fc7
Author: Ron <ron at debian.org>
Date:   Mon Jun 4 00:40:26 2012 +0930

    cowpoke: Properly strip the arguments to dpkg --compare-versions
    
    We need to remove the leading strings as well as just the suffix, and pass
    only the version part to it.
    
    Signed-off-by: Ron <ron at debian.org>

diff --git a/scripts/cowpoke.sh b/scripts/cowpoke.sh
index ea361ef..050362d 100755
--- a/scripts/cowpoke.sh
+++ b/scripts/cowpoke.sh
@@ -220,6 +220,16 @@ cat > "$REMOTE_SCRIPT" <<-EOF
 	# cowpoke generated remote worker script.
 	# Normally this should have been deleted already, you can safely remove it now.
 
+	compare_changes()
+	{
+	    p1="\${1%_*.changes}"
+	    p2="\${2%_*.changes}"
+	    p1="\${p1##*_}"
+	    p2="\${p2##*_}"
+
+	    dpkg --compare-versions "\$p1" gt "\$p2"
+	}
+
 	$(get_archdist_vars)
 
 	for arch in $BUILDD_ARCH; do
@@ -243,12 +253,11 @@ cat > "$REMOTE_SCRIPT" <<-EOF
 	                    | sort 2>/dev/null)"
 	    P=( \$OLD_CHANGES )
 	    count=\${#P[*]}
-	    COMPARE="dpkg --compare-versions"
 
 	    for(( i=1; i < count; ++i )) do
 	        j=i
 	        #echo "was \$i: \${P[i]}"
-	        while ((\$j)) && \$COMPARE "\${P[j-1]%_*.changes}" gt "\${P[i]%_*.changes}"; do ((--j)); done
+	        while ((\$j)) && compare_changes "\${P[j-1]}" "\${P[i]}"; do ((--j)); done
 	        ((i==j)) || P=( \${P[@]:0:j} \${P[i]} \${P[j]} \${P[@]:j+1:i-(j+1)} \${P[@]:i+1} )
 	    done
 	    #for(( i=1; i < count; ++i )) do echo "now \$i: \${P[i]}"; done

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list