packages: rpm-build-tools/adapter.sh, rpm-build-tools/adapter.awk, rpm-buil...

pawelz pawelz at pld-linux.org
Sat Apr 3 15:34:58 CEST 2010


Author: pawelz                       Date: Sat Apr  3 13:34:58 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- up to 4.4.37\n- adapter.sh up to 1.45\n- adapter.awk up to 1.440\n- builder.sh up to 1.614\n- pldnotify.awk up to 1.83\n

---- Files affected:
packages/rpm-build-tools:
   adapter.sh (1.7 -> 1.8) , adapter.awk (1.11 -> 1.12) , builder.sh (1.27 -> 1.28) , pldnotify.awk (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: packages/rpm-build-tools/adapter.sh
diff -u packages/rpm-build-tools/adapter.sh:1.7 packages/rpm-build-tools/adapter.sh:1.8
--- packages/rpm-build-tools/adapter.sh:1.7	Tue Feb 16 18:36:38 2010
+++ packages/rpm-build-tools/adapter.sh	Sat Apr  3 15:34:53 2010
@@ -13,15 +13,14 @@
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 RCSID='$Id$'
-r=${RCSID#* * }
-rev=${r%% *}
-VERSION="v0.35/$rev"
+REVISION=${RCSID#* * } REVISION=${REVISION%% *}
+VERSION="v0.35/$REVISION"
 VERSIONSTRING="\
 Adapter adapts .spec files for PLD Linux.
-$VERSION (C) 1999-2009 Free Penguins".
+$VERSION (C) 1999-2010 Free Penguins".
 
 PROGRAM=${0##*/}
-dir=$(d=$0; [ -L "$d" ] && d=$(readlink "$d"); dirname "$d")
+dir=$(d=$0; [ -L "$d" ] && d=$(readlink -f "$d"); dirname "$d")
 adapter=$dir/adapter.awk
 usage="Usage: $PROGRAM [FLAGS] SPECFILE
 
@@ -194,6 +193,7 @@
 	_desktopdir
 	_pixmapsdir
 	_javadir
+	_pkgconfigdir
 
 	perl_sitearch
 	perl_archlib
@@ -231,19 +231,21 @@
 	export _cvsmailfeedback='%{?_cvsmailfeedback}%{!?_cvsmailfeedback:PLD Team <feedback at pld-linux.org>}'
 	"
 
+	export ADAPTER_REVISION=$REVISION
+
 	eval $(rpm --eval "$(echo -e $eval_expr)")
 }
 
 adapterize() {
 	local workdir
-	workdir=$(mktemp -d ${TMPDIR:-/tmp}/adapter-XXXXXX) || exit
+	workdir=$(mktemp -d ${TMPDIR:-/tmp}/adapter-XXXXXX) || exit $?
 	awk=gawk
 
-	local tmp=$workdir/$(basename $SPECFILE) || exit
+	local tmp=$workdir/$(basename $SPECFILE) || exit $?
 
 	import_rpm_macros
 
-	LC_ALL=en_US.UTF-8 $awk -f $adapter $SPECFILE > $tmp || exit
+	LC_ALL=en_US.UTF-8 $awk -f $adapter $SPECFILE > $tmp || exit $?
 
 	if [ "$outputonly" = 1 ]; then
 		cat $tmp

================================================================
Index: packages/rpm-build-tools/adapter.awk
diff -u packages/rpm-build-tools/adapter.awk:1.11 packages/rpm-build-tools/adapter.awk:1.12
--- packages/rpm-build-tools/adapter.awk:1.11	Tue Feb 16 18:36:37 2010
+++ packages/rpm-build-tools/adapter.awk	Sat Apr  3 15:34:53 2010
@@ -2,7 +2,7 @@
 #
 # Adapter adapts .spec files for PLD Linux.
 #
-# Copyright (C) 1999-2008 PLD-Team <feedback at pld-linux.org>
+# Copyright (C) 1999-2010 PLD-Team <feedback at pld-linux.org>
 # Authors:
 # 	Michał Kuratczyk <kura at pld.org.pl>
 # 	Sebastian Zagrodzki <s.zagrodzki at mimuw.edu.pl>
@@ -137,7 +137,7 @@
 		while (getline)		# print the rest of spec as it is
 			print
 		do_not_touch_anything = 1 # do not touch anything in END()
-		exit 0
+		exit(rc = 0)
 	}
 
 	# Generally, comments are printed without touching
@@ -418,6 +418,9 @@
 	# atrpms
 	$0 = fixedsub("%perl_configure", "%{__perl} Makefile.PL \\\n\tINSTALLDIRS=vendor", $0);
 	$0 = fixedsub("%perl_makecheck", "%{?with_tests:%{__make} test}", $0);
+
+	# alt linux
+	$0 = fixedsub("%make_build", "%{__make}", $0);
 }
 
 ##########
@@ -487,6 +490,9 @@
 
 	# atrpms
 	$0 = fixedsub("%perl_makeinstall", "%{__make} pure_install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0);
+
+	# alt linux
+	$0 = fixedsub("%make_install DESTDIR=$RPM_BUILD_ROOT install", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0);
 }
 
 ##########
@@ -975,8 +981,9 @@
 
 
 END {
-	if (do_not_touch_anything)
-		exit 0
+	if (do_not_touch_anything) {
+		exit(rc)
+	}
 
 	# TODO: need to output these in proper place
 	if (BR_count > 0) {
@@ -1092,6 +1099,9 @@
 	gsub("%{_datadir}/pixmaps", "%{_pixmapsdir}")
 	gsub("%{_datadir}/java", "%{_javadir}")
 
+	gsub("%{_libdir}/pkgconfig", "%{_pkgconfigdir}")
+	gsub(pkgconfigdir, "%{_pkgconfigdir}")
+
 	gsub(libdir, "%{_libdir}")
 	gsub(javadir, "%{_javadir}")
 
@@ -1724,7 +1734,13 @@
 	if (!topdir) {
 		print "adapter.awk should not not be invoked directly, but via adapter script" > "/dev/stderr"
 		do_not_touch_anything = 1
-		exit(1);
+		exit(rc = 1);
+	}
+
+	if (!ENVIRON["ADAPTER_REVISION"] || ENVIRON["ADAPTER_REVISION"] < 1.44) {
+		print "adapter shell script is outdated, please cvs up it" > "/dev/stderr"
+		do_not_touch_anything = 1
+		exit(rc = 1);
 	}
 
 	# get cvsaddress for changelog section
@@ -1748,6 +1764,7 @@
 	desktopdir = ENVIRON["_desktopdir"]
 	pixmapsdir = ENVIRON["_pixmapsdir"]
 	javadir = ENVIRON["_javadir"]
+	pkgconfigdir = ENVIRON["_pkgconfigdir"]
 
 	perl_sitearch = ENVIRON["perl_sitearch"]
 	perl_archlib = ENVIRON["perl_archlib"]
@@ -1849,6 +1866,7 @@
 	sub(/^python-imaging$/, "python-PIL", $2);
 	sub(/^python-imaging-tk$/, "python-PIL-tk", $2);
 	sub(/^initscripts$/, "rc-scripts", $2);
+	sub(/^libXft-devel$/, "xorg-lib-libXft-devel", $2);
 
 	# debian
 	sub(/^libgconf2-dev$/, "GConf2-devel", $2);
@@ -1901,6 +1919,7 @@
 	group = replace(group, "Development/Python", "Development/Languages/Python");
 	group = replace(group, "Development/Testing", "Development");
 	group = replace(group, "Emulators", "Applications/Emulators");
+	group = replace(group, "File tools", "Applications/File");
 	group = replace(group, "Games", "Applications/Games");
 	group = replace(group, "Library/Development", "Development/Libraries");
 	group = replace(group, "Networking/Deamons", "Networking/Daemons");

================================================================
Index: packages/rpm-build-tools/builder.sh
diff -u packages/rpm-build-tools/builder.sh:1.27 packages/rpm-build-tools/builder.sh:1.28
--- packages/rpm-build-tools/builder.sh:1.27	Tue Feb 16 18:36:38 2010
+++ packages/rpm-build-tools/builder.sh	Sat Apr  3 15:34:53 2010
@@ -25,6 +25,9 @@
 # - does not respect NoSource: X, and tries to cvs up such files [ example: VirtualBox-bin.spec and its Source0 ]
 # TODO:
 # - ability to do ./builder -bb foo.spec foo2.spec foo3.spec
+# - funny bug, if source-md5 is set then builder will download from distfiles even if there is no url present:
+#   Source10:	forwardfix.pl
+#   # Source10-md5:	8bf85f7368933a4e0cb4f875bac28733
 
 RCSID='$Id$'
 r=${RCSID#* * }
@@ -32,10 +35,13 @@
 VERSION="v0.35/$rev"
 VERSIONSTRING="\
 Build package utility from PLD Linux CVS repository
-$VERSION (C) 1999-2009 Free Penguins".
+$VERSION (C) 1999-2010 Free Penguins".
 
 PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
 
+# required rpm-build-macros
+RPM_MACROS_VER=1.534
+
 COMMAND="build"
 TARGET=""
 
@@ -358,6 +364,7 @@
 --show-bcond-args   - show active bconds, from ~/.bcondrc. this is used by
                       ./repackage.sh script. in other words, the output is
                       parseable by scripts.
+--show-avail-bconds - show available bconds
 --with/--without <feature>
                     - conditional build package depending on %_with_<feature>/
                       %_without_<feature> macro switch.  You may now use
@@ -382,13 +389,13 @@
 update_shell_title() {
 	[ -t 1 ] || return
 	local len=${COLUMNS:-80}
-	local msg=$(echo "$*" | cut -c-$len)
+	local msg="$(echo "$*" | cut -c-$len)"
 
 	if [ -n "$BE_VERBOSE" ]; then
 		echo >&2 "$(date +%s.%N) $*"
 	fi
 
-	if [ "x$TITLECHANGE" == "xyes" -o "x$TITLECHANGE" == "x" ]; then
+	if [ "x$TITLECHANGE" = "xyes" -o "x$TITLECHANGE" = "x" ]; then
 		local pkg
 		if [ -n "$PACKAGE_NAME" ]; then
 			pkg=${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_RELEASE}
@@ -662,8 +669,19 @@
 
 	if [ "$NOINIT" != "yes" ] ; then
 		TOP_DIR=$(eval $RPM $RPMOPTS --eval '%{_topdir}')
-		REPO_DIR=$TOP_DIR
-		PACKAGE_DIR=$REPO_DIR/$ASSUMED_NAME
+
+		local macros_ver=$(rpm -E %?rpm_build_macros)
+		if [ -z "$macros_ver" ]; then
+			REPO_DIR=$TOP_DIR/packages
+			PACKAGE_DIR=$TOP_DIR/packages/$ASSUMED_NAME
+		else
+			if awk "BEGIN{exit($macros_ver>=$RPM_MACROS_VER)}"; then
+				echo >&2 "builder requires rpm-build-macros >= $RPM_MACROS_VER"
+				exit 1
+			fi
+			REPO_DIR=$TOP_DIR
+			PACKAGE_DIR=$REPO_DIR/$ASSUMED_NAME
+		fi
 	else
 		REPO_DIR="."
 		PACKAGE_DIR="."
@@ -737,7 +755,7 @@
 	local origin mirror name rest ol prefix
 	while read origin mirror name rest; do
 		# skip comments and empty lines
-		if [ -z "$origin" ] || [[ $origin == \#* ]]; then
+		if [ -z "$origin" ] || [ "${origin#\#}" != "$origin" ]; then
 			continue
 		fi
 		ol=$(echo -n "$origin" | wc -c)
@@ -787,7 +805,7 @@
 		fi
 	fi
 
-	source_md5=`grep -i "#[ 	]*Source$no-md5[ 	]*:" $SPECFILE | sed -e 's/.*://'`
+	source_md5=`grep -i "^#[ 	]*Source$no-md5[ 	]*:" $SPECFILE | sed -e 's/.*://'`
 	if [ -n "$source_md5" ]; then
 		echo $source_md5
 	else
@@ -797,7 +815,7 @@
 		else
 			# we have empty SourceX-md5, but it is still possible
 			# that we have NoSourceX-md5 AND NoSource: X
-			nosource_md5=`grep -i "#[	 ]*NoSource$no-md5[	 ]*:" $SPECFILE | sed -e 's/.*://'`
+			nosource_md5=`grep -i "^#[	 ]*NoSource$no-md5[	 ]*:" $SPECFILE | sed -e 's/.*://'`
 			if [ -n "$nosource_md5" -a -n "`grep -i "^NoSource:[	 ]*$no$" $SPECFILE`" ] ; then
 				echo $nosource_md5
 			fi
@@ -1546,19 +1564,25 @@
 		case "$opt" in
 		without_*)
 			bcond=${opt#without_}
-			if [[ "$BCOND" = *--without?${bcond}* ]]; then
+			case "$BCOND" in
+			*--without?${bcond}*)
 				AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$bcond>"
-			else
+				;;
+			*)
 				AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $bcond"
-			fi
+				;;
+			esac
 			;;
 		with_*)
 			bcond=${opt#with_}
-			if [[ "$BCOND" = *--with?${bcond}* ]]; then
+			case "$BCOND" in
+			*--with?${bcond}*)
 				AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$bcond>"
-			else
+				;;
+			*)
 				AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $bcond"
-			fi
+				;;
+			esac
 			;;
 		*)
 			echo >&2 "ERROR: unexpected '$opt' in set_bconds_values"
@@ -1645,19 +1669,24 @@
 display_bconds() {
 	if [ "$AVAIL_BCONDS_WITH" -o "$AVAIL_BCONDS_WITHOUT" ]; then
 		if [ "$BCOND" ]; then
-			echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
-			echo -ne "$BCOND"
+			echo ""
+			echo "Building $SPECFILE with the following conditional flags:"
+			echo -n "$BCOND"
 		else
-			echo -ne "\nNo conditional flags passed"
+			echo ""
+			echo "No conditional flags passed"
 		fi
-		echo -ne "\n\nfrom available:\n"
-		echo -ne "--with   :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
+		echo ""
+		echo "from available:"
+		echo "--with   :\t$AVAIL_BCONDS_WITH"
+		echo "--without:\t$AVAIL_BCONDS_WITHOUT"
+		echo ""
 	fi
 }
 
 display_branches() {
 	if [ "$NOCVSSPEC" != "yes" ]; then
-		echo -ne "Available branches: "
+		echo -n "Available branches: "
 		$CVS_COMMAND status -v "${SPECFILE}" | awk '!/Sticky Tag:/ && /\(branch:/ { print $1 } ' | xargs
 	fi
 }
@@ -1753,10 +1782,12 @@
 	fi
 
 		# XXX is this ugliest code written in human history still needed?
-		echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
-		echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
-		echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
-		echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
+		echo "All packages installed by fetch_build_requires() are written to:"
+		echo "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
+		echo ""
+		echo "If anything fails, you may get rid of them by executing:"
+		echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`"
+		echo ""
 		echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
 		for package_item in $(cat $SPECFILE | grep -B100000 ^%changelog|grep -v ^#|grep BuildRequires|grep -v ^-|sed -e "s/^.*BuildRequires://g"|awk '{print $1}'|sed -e s,perl\(,perl-,g -e s,::,-,g -e s,\(.*\),,g -e s,%{,,g -e s,},,g|grep -v OpenGL-devel|sed -e s,sh-utils,coreutils,g -e s,fileutils,coreutils,g -e s,textutils,coreutils,g -e s,kgcc_package,gcc,g -e s,\),,g)
 		do
@@ -1829,11 +1860,11 @@
 						for package_name in `cat ".$package-req.txt"|grep -v ^#`
 						do
 							if [ "$package_name" = "$package" ]; then
-								echo -ne "Installing BuildRequired package:\t$package_name\n"
+								echo "Installing BuildRequired package:\t$package_name"
 								update_shell_title "Installing BuildRequired package: ${package_name}"
 								install_required_packages $package
 							else
-								echo -ne "Installing (sub)Required package:\t$package_name\n"
+								echo "Installing (sub)Required package:\t$package_name"
 								update_shell_title "Installing (sub)Required package: ${package_name}"
 								install_required_packages $package_name
 							fi
@@ -1844,7 +1875,7 @@
 									;;
 								*)
 									echo "Attempting to run spawn sub - builder..."
-									echo -ne "Package installation failed:\t$package_name\n"
+									echo "Package installation failed:\t$package_name"
 									run_sub_builder $package_name
 									if [ $? -eq 0 ]; then
 										install_required_packages $package_name
@@ -1864,7 +1895,7 @@
 						rm -f ".$package-req.txt"
 					else
 						echo "Attempting to run spawn sub - builder..."
-						echo -ne "Package installation failed:\t$package\n"
+						echo "Package installation failed:\t$package"
 						run_sub_builder $package
 						if [ $? -eq 0 ]; then
 							install_required_packages $package
@@ -1899,7 +1930,7 @@
 	TOP_DIR=$(eval $RPM $RPMOPTS --eval '%{_topdir}')
 	CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
 
-	echo "Initialising rpm directories to $TOP_DIR from $CVSROOT"
+	echo "Initializing rpm directories to $TOP_DIR from $CVSROOT"
 	mkdir -p $TOP_DIR/{RPMS,BUILD,SRPMS}
 	cd $TOP_DIR
 	$CVS_COMMAND -d $CVSROOT co packages/{.cvsignore,rpm.groups,dropin,mirrors,md5,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
@@ -2211,6 +2242,10 @@
 			COMMAND="show_bcond_args"
 			shift
 			;;
+		--show-avail-bconds)
+			COMMAND="show_avail_bconds"
+			shift
+			;;
 		--nodeps)
 			shift
 			RPMOPTS="${RPMOPTS} --nodeps"
@@ -2289,6 +2324,33 @@
 			set_bconds_values
 			echo "$BCOND"
 		fi
+		;;
+	"show_avail_bconds")
+		init_builder
+		if [ -n "$SPECFILE" ]; then
+			get_spec > /dev/null
+			parse_spec
+			local bcond_avail=$(find_spec_bcond $SPECFILE)
+			local opt bcond bconds
+			for opt in $bcond_avail; do
+				case "$opt" in
+				without_*)
+					bcond=${opt#without_}
+					bconds="$bconds $bcond"
+					;;
+				with_*)
+					bcond=${opt#with_}
+					bconds="$bconds $bcond"
+					;;
+				*)
+					echo >&2 "ERROR: unexpected '$opt' in show_avail_bconds"
+					exit 1
+					;;
+				esac
+			done
+			echo $bconds
+		fi
+
 		;;
 	"build" | "build-binary" | "build-source" | "build-prep" | "build-build" | "build-install" | "build-list")
 		init_builder

================================================================
Index: packages/rpm-build-tools/pldnotify.awk
diff -u packages/rpm-build-tools/pldnotify.awk:1.10 packages/rpm-build-tools/pldnotify.awk:1.11
--- packages/rpm-build-tools/pldnotify.awk:1.10	Tue Feb 16 18:36:38 2010
+++ packages/rpm-build-tools/pldnotify.awk	Sat Apr  3 15:34:53 2010
@@ -1,7 +1,7 @@
 #!/bin/awk -f
 # $Revision$, $Date$
 #
-# Copyright (C) 2000-2009 PLD-Team <feedback at pld-linux.org>
+# Copyright (C) 2000-2010 PLD-Team <feedback at pld-linux.org>
 # Authors:
 #	Sebastian Zagrodzki <zagrodzki at pld-linux.org>
 #	Jacek Konieczny <jajcus at pld-linux.org>
@@ -169,6 +169,17 @@
 	return _tmpfile
 }
 
+# fix link to artificial one that will be recognized rest of this script
+function postfix_link(url, link) {
+	oldlink = link
+	if ((url ~/^(http|https):\/\/github.com\//) && (link ~ /.*\/tarball\//)) {
+		gsub(".*\/tarball\/", "", link)
+		link = link ".tar.gz"
+	}
+	if (DEBUG) print "POST FIXING URL [ " oldlink " ] to [ " link " ]"
+	return link
+}
+
 # get all <A HREF=..> tags from specified URL
 function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowerodp,tmpfile,cmd) {
 
@@ -216,17 +227,26 @@
 		if (DEBUG) print "edge launchpad url, mungled url to: " url
 	}
 
+	if (url ~/^(http|https):\/\/github.com\/.*\/(.*)\/tarball\//) {
+		gsub("\/tarball\/.*", "/downloads", url)
+		if (DEBUG) print "github tarball url, mungled url to: " url
+	}
+
 
 	if (DEBUG) print "Retrieving: " url
 	cmd = "wget --user-agent \"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100129 PLD/3.0 (Th) Iceweasel/3.6\" -nv -O - \"" url "\" -t 2 -T 45 --passive-ftp --no-check-certificate > " tmpfile " 2> " tmpfileerr
 	if (DEBUG) print "Execute: " cmd
 	errno = system(cmd)
+	if (DEBUG) print "Execute done"
 
 	if (errno==0) {
+		wholeodp = ""
+		if ( DEBUG ) print "Reading succeess response..."
 		while (getline oneline < tmpfile)
 			wholeodp=(wholeodp " " oneline)
-		if ( DEBUG ) print "Response: " wholeodp
+		# if ( DEBUG ) print "Response: " wholeodp
 	} else {
+		if ( DEBUG ) print "Reading failure response..."
 		wholeerr = ""
 		while (getline oneline < tmpfileerr)
 			wholeerr=(wholeerr " " oneline)
@@ -241,6 +261,7 @@
 
 	if ( errno==0) {
 		while (match(wholeodp, /<([aA]|[fF][rR][aA][mM][eE])[ \t][^>]*>/) > 0) {
+			if (DEBUG) print "Processing links..."
 			odp=substr(wholeodp,RSTART,RLENGTH);
 			wholeodp=substr(wholeodp,RSTART+RLENGTH);
 
@@ -267,6 +288,7 @@
 				link=substr(odp,RSTART,RLENGTH)
 				odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH)
 				link=substr(link,7,length(link)-7)
+				link=postfix_link(url, link)
 
 				if (link_seen(link)) {
 					link=""
@@ -281,6 +303,7 @@
 				link=substr(odp,RSTART,RLENGTH)
 				odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH)
 				link=substr(link,7,length(link)-7)
+				link=postfix_link(url, link)
 
 				if (link_seen(link)) {
 					link=""
@@ -373,13 +396,17 @@
 	filename=url[4]
 
 	if (index(dir,version)) {
+		# directory name as version maching mode:
+		# if /something/version/name-version.tarball then check
+		# in /something/ looking for newer directory
 		dir=substr(dir,1,index(dir,version)-1)
 		sub("[^/]*$","",dir)
 		sub("(\.tar\.(bz|bz2|gz)|zip)$","",filename)
-		if ( DEBUG ) print "Will check a directory: " dir
-		if ( DEBUG ) print "and a file: " filename
 	}
 
+	if ( DEBUG ) print "Will check a directory: " dir
+	if ( DEBUG ) print "and a file: " filename
+
 	filenameexp=filename
 	gsub("\+","\\+",filenameexp)
 	sub(version,"[A-Za-z0-9.]+",filenameexp)
@@ -407,8 +434,17 @@
 		c=split(odp,linki)
 		for (nr=1; nr<=c; nr++) {
 			addr=linki[nr]
+
 			if (DEBUG) print "Found link: " addr
-			if ((addr ~ filenameexp) && !(addr ~ "[-_.0-9A-Za-z~]" filenameexp)) {
+
+			# github has very different tarball links that clash with this safe check
+			if (!(newurl ~/^(http|https):\/\/github.com\/.*\/tarball/)) {
+				if (addr ~ "[-_.0-9A-Za-z~]" filenameexp) {
+					continue
+				}
+			}
+
+			if (addr ~ filenameexp) {
 				match(addr,filenameexp)
 				newfilename=substr(addr,RSTART,RLENGTH)
 				if (DEBUG) print "Hypothetical new: " newfilename
@@ -416,6 +452,8 @@
 				newfilename=fixedsub(postver,"",newfilename)
 				if (DEBUG) print "Version: " newfilename
 				if (newfilename ~ /\.(asc|sig|pkg|bin|binary|built)$/) continue
+				# strip ending (happens when in directiory name as version matching mode)
+				sub("(\.tar\.(bz|bz2|gz)|zip)$","",newfilename)
 				if (NUMERIC) {
 					if ( compare_ver_dec(version, newfilename)==1 ) {
 						if (DEBUG) print "Yes, there is new one"
@@ -437,7 +475,7 @@
 }
 
 # upgrade check for pear package using PEAR CLI
-function pear_upgrade(name, ver) {
+function pear_upgrade(name, ver,    pname, pearcmd, nver) {
 	pname = name;
 	sub(/^php-pear-/, "", pname);
 
@@ -457,9 +495,29 @@
 	return
 }
 
+function vim_upgrade(name, ver,     mver, nver, vimcmd) {
+	# %patchset_source -f ftp://ftp.vim.org/pub/editors/vim/patches/7.2/7.2.%03g 1 %{patchlevel}
+	mver = substr(ver, 0, 4)
+	vimcmd = "wget -q -O - ftp://ftp.vim.org/pub/editors/vim/patches/"mver"/MD5SUMS|grep -vF .gz|tail -n1|awk '{print $2}'"
+	if (DEBUG) {
+		print "vimcmd: " vimcmd
+	}
+	vimcmd | getline nver
+	close(vimcmd)
+
+	if (compare_ver(ver, nver)) {
+		print name " [OLD] " ver " [NEW] " nver
+	} else {
+		print name " seems ok: " ver
+	}
+}
+
 function process_data(name,ver,rel,src) {
 	if (name ~ /^php-pear-/) {
 		return pear_upgrade(name, ver);
+	}
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm-build-tools/adapter.sh?r1=1.7&r2=1.8&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm-build-tools/adapter.awk?r1=1.11&r2=1.12&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm-build-tools/builder.sh?r1=1.27&r2=1.28&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm-build-tools/pldnotify.awk?r1=1.10&r2=1.11&f=u



More information about the pld-cvs-commit mailing list