diff --git a/misc/tools-source/config_helper.c b/misc/tools-source/config_helper.c index 4f784f3fa..25c0fa6ec 100644 --- a/misc/tools-source/config_helper.c +++ b/misc/tools-source/config_helper.c @@ -357,19 +357,20 @@ int pkgfork(char *pkgname, char *xpkg, char** opt) } } } + return 0; } int cfghlp_builtin(WORD_LIST *list) { - char *args[10]; + char *args[50]; int i; - for (i=0; i<9 && list; i++) { + for (i=0; i<50 && list; i++) { args[i] = list->word->word; list = list->next; } - for (; i<10; i++) { + for (; i<50; i++) { args[i] = ""; } diff --git a/scripts/Config b/scripts/Config index bc9d75038..357b32fc8 100755 --- a/scripts/Config +++ b/scripts/Config @@ -139,6 +139,10 @@ if [ ! -e config/$config ] ; then $0 -oldconfig $profile $nobashmod -cfg $config fi +# From scripts/parse-config +base=$(pwd -P) + +. scripts/functions . scripts/config.func mkdir -p config/$config diff --git a/scripts/config.func b/scripts/config.func index 02646e79c..83a46a4d0 100644 --- a/scripts/config.func +++ b/scripts/config.func @@ -114,8 +114,17 @@ then # unflag CORE # pkgfork() { - local script="\$5==\"$1\" {print;\$5=\"$1=$2\";" - shift; shift; + local pkg=$1 xpkg=$2 script ; shift 2 + + parse_desc package/*/$pkg/$pkg.desc P V + + extraver=$( echo $desc_V 0 | cut -f2 -d" " ) + + script="\$5==\"$pkg\" {print; \$1=\"${desc_P%% *}\"; \ + \$2=\"$( echo $desc_P | cut -f2 -d" ")\"; \ + \$3=\"${desc_P##* }\"; \$5=\"$pkg=$xpkg\"; \ + \$6=\"${desc_V%% *}\"; \$7=\"$extraver\";" + while [ -n "$1" ]; do case "$1" in status) @@ -177,8 +186,16 @@ else return $ret } pkgfork() { + local pkg=$1 xpkg=$2 extraver ; shift 2 + bprof pkgfork start - cfghlp pkgfork "$@" + parse_desc package/*/$pkg/$pkg.desc P V + + extraver=$( echo $desc_V 0 | cut -f2 -d" " ) + + cfghlp pkgfork $pkg $xpkg status ${desc_P%% *} priority ${desc_P##* } \ + stages $( echo $desc_P | cut -f2 -d" ") \ + version ${desc_V%% *} extraversion $extraver $@ bprof pkgfork stop } fi diff --git a/scripts/functions b/scripts/functions index ee8fdbb3c..5761c9b5c 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,3 +1,4 @@ +#!/bin/bash # --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. @@ -346,27 +347,35 @@ postflist_libs() { fi } -# Parse the *.desc file. Use the description from PKG-DESC-FORMAT and -# save the tag data in $desc_*. +# parse_desc [ [ [ ... ] ] ] +# Parse the *.desc file and save the tag data in $desc_*. If no tags are +# given, use all tags from PKG-DESC-FORMAT. # parse_desc() { - parser="$( which descparser )" + local descfilename=$1 ; shift + local parser="$( which descparser )" tag tagdata + [ -z "${parser}" ] && parser="$base/src/descparser" if [ ! -x "${parser}" ] ; then mkdir -p $base/src cc -o $base/src/descparser $base/misc/tools-source/descparser.c fi [ ! -x "${parser}" ] && abort "Couldn't find \`descparser'! Please run ./scripts/Build-Tools!" - tag="`grep '^\[' $base/Documentation/Developers/PKG-DESC-FORMAT | \ - sed 's, (\*),,; s,\] \[,|,g; s,\[,,; s,\],,;'`" - descfile="$( pkg="$pkg" xpkg="$xpkg" $parser < $1 )" + + tag="$( + prog="" ; for x ; do + prog="$prog /\(^\||\)$x\(|\|$\)/ { p ; d } ;" + done + [ "$prog" != "" ] && prog="$prog d" + sed "/^\[/! d; s, (\*),,; s,\] \[,|,g; s,\[,,; s,\],,; $prog" \ + $base/Documentation/Developers/PKG-DESC-FORMAT + )" + + descfile="$( pkg="$pkg" xpkg="$xpkg" $parser < $descfilename )" for tag in $tag ; do - tagdata="`echo "$descfile" | egrep "^\[($tag)\]" | \ - cut -f2- -d']' | sed 's,^ ,,'`" - tag="`echo $tag | cut -f1 -d'|' | tr - _`" - if eval "[ -z \"\$desc_$tag\" ]"; then - eval "desc_$tag=\"\$tagdata\"" - fi + tagdata="`sed -e"s,^\[\(${tag//|/\\|/}\)\] ,,p ; d" <<< "$descfile"`" + tag="`sed -e"s,|.*,, ; s,-,_,g" <<< "$tag"`" + eval "desc_$tag=\"\$tagdata\"" done }