]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
- up to 4.4.37\n- adapter.sh up to 1.45\n- adapter.awk up to 1.440\n- builder.sh...
authorpawelz <pawelz@pld-linux.org>
Sat, 3 Apr 2010 13:34:53 +0000 (13:34 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    adapter_.awk -> 1.12
    adapter_.sh -> 1.8
    builder_.sh -> 1.28
    pldnotify_.awk -> 1.11

adapter_.awk
adapter_.sh
builder_.sh
pldnotify_.awk

index 2c5eebf88d8a6e63b4025d3a9c884361bb010652..a7d624a381dccf90eb6b7ef259577408eaa164b5 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Adapter adapts .spec files for PLD Linux.
 #
-# Copyright (C) 1999-2008 PLD-Team <feedback@pld-linux.org>
+# Copyright (C) 1999-2010 PLD-Team <feedback@pld-linux.org>
 # Authors:
 #      MichaƂ Kuratczyk <kura@pld.org.pl>
 #      Sebastian Zagrodzki <s.zagrodzki@mimuw.edu.pl>
@@ -137,7 +137,7 @@ function b_makekey(a, b,    s) {
                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 @@ function b_makekey(a, b,    s) {
        # 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 @@ function b_makekey(a, b,    s) {
 
        # 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 @@ preamble == 1 {
 
 
 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 @@ function use_macros()
        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 @@ function import_rpm_macros() {
        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 @@ function import_rpm_macros() {
        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 @@ function replace_requires() {
        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 @@ function replace_groupnames(group) {
        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 f3b25054ec57fe2ff1d746fb355c3415d8cefae6..efaa60192474db89e7e620b05059198be34d623c 100644 (file)
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 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 @@ import_rpm_macros() {
        _desktopdir
        _pixmapsdir
        _javadir
+       _pkgconfigdir
 
        perl_sitearch
        perl_archlib
@@ -231,19 +231,21 @@ import_rpm_macros() {
        export _cvsmailfeedback='%{?_cvsmailfeedback}%{!?_cvsmailfeedback:PLD Team <feedback@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 45dfc64e1cf88374ce5d25e95a792c0de3c81ebe..de5f96649ea324f5663cc703d6438a977efb6e65 100644 (file)
@@ -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 @@ rev=${r%% *}
 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 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|
 --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 @@ depspecname() {
 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 @@ init_builder() {
 
        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 @@ find_mirror() {
        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 @@ src_md5() {
                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 @@ src_md5() {
                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 @@ set_bconds_values() {
                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 @@ remove_build_requires() {
 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 @@ fetch_build_requires()
        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 @@ fetch_build_requires()
                                                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 @@ fetch_build_requires()
                                                                        ;;
                                                                *)
                                                                        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 @@ fetch_build_requires()
                                                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 @@ init_rpm_dir() {
        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 @@ while [ $# -gt 0 ]; do
                        COMMAND="show_bcond_args"
                        shift
                        ;;
+               --show-avail-bconds)
+                       COMMAND="show_avail_bconds"
+                       shift
+                       ;;
                --nodeps)
                        shift
                        RPMOPTS="${RPMOPTS} --nodeps"
@@ -2289,6 +2324,33 @@ case "$COMMAND" in
                        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 4a548a45e0aad030ffe8351d37a9d366cbb8176c..a9121ee3925899d439737c403a712bb5fc0a9ba0 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/awk -f
 # $Revision$, $Date$
 #
-# Copyright (C) 2000-2009 PLD-Team <feedback@pld-linux.org>
+# Copyright (C) 2000-2010 PLD-Team <feedback@pld-linux.org>
 # Authors:
 #      Sebastian Zagrodzki <zagrodzki@pld-linux.org>
 #      Jacek Konieczny <jajcus@pld-linux.org>
@@ -169,6 +169,17 @@ function mktemp(   _cmd, _tmpfile) {
        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 @@ function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowero
                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 @@ function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowero
 
        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 @@ function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowero
                                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 @@ function get_links(url,filename,   errno,link,oneline,retval,odp,wholeodp,lowero
                                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 @@ function process_source(number,lurl,name,version) {
        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 @@ function process_source(number,lurl,name,version) {
                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 @@ function process_source(number,lurl,name,version) {
                                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 @@ function process_source(number,lurl,name,version) {
 }
 
 # 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,10 +495,30 @@ function pear_upgrade(name, ver) {
        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);
        }
+       if (name == "vim") {
+               return vim_upgrade(name, ver);
+       }
 
 # this function checks if substitutions were valid, and if true:
 # processes each URL and tries to get current file list
This page took 0.074724 seconds and 4 git commands to generate.