about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-10-31 15:30:29 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2014-10-31 15:30:29 +0100
commit6380ec04a77542670503407e6df243d069d59575 (patch)
tree73ecf4f8c41232d393b4e550e54404edad4a022e
parent4c7390da2f3351782cc65e5ce940c55617f8a0b6 (diff)
downloadxtools-6380ec04a77542670503407e6df243d069d59575.tar.gz
xtools-6380ec04a77542670503407e6df243d069d59575.tar.xz
xtools-6380ec04a77542670503407e6df243d069d59575.zip
xnuxnu: read update_* variables
-rwxr-xr-xxnuxnu74
1 files changed, 49 insertions, 25 deletions
diff --git a/xnuxnu b/xnuxnu
index e019523..51f4538 100755
--- a/xnuxnu
+++ b/xnuxnu
@@ -9,32 +9,43 @@ nl='
 export LC_ALL=C
 
 void_version=$(./xbps-src show "$1" | sed -n '/^version/s/[^:]*:[\t]*//p')
+pkg=$1 bash -c '
+	. ./srcpkgs/"$pkg"/template >/dev/null
+	printf %s\\n "$update_site" "$update_pattern" "$update_ignore"' |
+{
+	IFS=$nl read -r update_site
+	IFS=$nl read -r update_pattern
+	IFS=$nl read -r update_ignore
 
-./xbps-src show "$1" |
-	sed -n '/^distfiles:/{s/[^:]*:[\t]*//;s|/[^/]*$|/|p};
-		/^Upstream URL/s/[^:]*:[\t]*//p' |
-	while IFS=$nl read url; do
+	if [ -n "$update_site" ]; then
+		printf %s\\n "$update_site"
+	else
+		./xbps-src show "$1" |
+			sed -n '/^distfiles:/{s/[^:]*:[\t]*//;s|/[^/]*$|/|p};
+				/^Upstream URL/s/[^:]*:[\t]*//p'
+	fi |
+	while IFS=$nl read -r url; do
 		rx="(?<!-)\b$pkgname[-_]?((src|source)[-_])?\K([^-/_\s]*?\d[^-/_\s]*?)(?=(?:[-_.](?:src|source|orig))?\.(?:[jt]ar|shar|t[bglx]z|tbz2|zip))\b"
 		case "$url" in
-			*sourceforge.net/sourceforge*)
-				url="http://sourceforge.net/projects/$pkgname/rss?limit=200";;
-			*code.google.com*|*googlecode*)
-				url="http://code.google.com/p/$pkgname/downloads/list";;
-			*launchpad.net*)
-				url="https://launchpad.net/$pkgname/+download";;
-			*cpan.*)
-				pkgname=${pkgname#perl-};;
-			*pypi.python.org*)
-				pkgname=${pkgname#python-};;
-			*github.com*)
-				githubname="$(echo $url | cut -d/ -f4,5)"
-				url="https://api.github.com/repos/$githubname/tags"
-				rx='"name":\s*"(v|'"$pkgname"'-)?\K[^\d]*([\d\.]+)(?=")';;
+		*sourceforge.net/sourceforge*)
+			url="http://sourceforge.net/projects/$pkgname/rss?limit=200";;
+		*code.google.com*|*googlecode*)
+			url="http://code.google.com/p/$pkgname/downloads/list";;
+		*launchpad.net*)
+			url="https://launchpad.net/$pkgname/+download";;
+		*cpan.*)
+			pkgname=${pkgname#perl-};;
+		*pypi.python.org*)
+			pkgname=${pkgname#python-};;
+		*github.com*)
+			githubname="$(echo $url | cut -d/ -f4,5)"
+			url="https://api.github.com/repos/$githubname/tags"
+			rx='"name":\s*"(v|'"$pkgname"'-)?\K[^\d]*([\d\.]+)(?=")';;
 		esac
 
-		set -- $(grep "^${orig_pkgname} " xnuxnu-override)
-		url=${2:-$url}
-		rx=${3:-$rx}
+		#set -- $(grep "^${orig_pkgname} " xnuxnu-override)
+		url=${update_site:-$url}
+		rx=${update_pattern:-$rx}
 
 		echo "fetching $url" 1>&2
 		curl -A xnuxnu -Ls "$url" |
@@ -43,9 +54,22 @@ void_version=$(./xbps-src show "$1" | sed -n '/^version/s/[^:]*:[\t]*//p')
 	done |
 	{ tee /dev/stderr | grep . || echo "NO VERSION found for $orig_pkgname" 1>&2; } |
 	while read version; do
-		xbps-uhelper cmpver "$orig_pkgname-${void_version}_1" "$orig_pkgname-${version}_1"
-		if [ $? = 255 ]; then
-			echo "NEWER VERSION $orig_pkgname-$version (have $orig_pkgname-${void_version})"
+		consider=true
+		p="$update_ignore "
+		while [ -n "$p" ]; do
+			i=${p%% *}
+			p=${p#* }
+			case "$version" in
+			$i)
+				consider=false
+				echo "ignored"
+			esac
+		done
+		if $consider; then
+			xbps-uhelper cmpver "$orig_pkgname-${void_version}_1" "$orig_pkgname-${version}_1"
+			if [ $? = 255 ]; then
+				echo "NEWER VERSION $orig_pkgname-$version (have $orig_pkgname-${void_version})"
+			fi
 		fi
 	done
-
+}