?mode=patch&uid=2007010217272596480
Open Patch: 2007010217272596480 (by stf)
+ stf
Votecheck 'core-strong': Missing 1 qualified vote(s) (clifford, fake, teha)
scripts/config.func
scripts/functions
scripts/Config
Votecheck 'unmatched': Missing 1 qualified vote(s) (clifford, fake, teha)
misc/tools-source/config_helper.c
Stefan Fiedler:
Re-read tags for forked packages from .desc files in pkgfork(); this
ensures correct info about forked packages in config/.../packages.
scripts/functions, parse_desc(): assign values to existing desc_$tag
variables; allow for parsing only given tags.
misc/tools-source/config_helper.c: parse at most 50 arguments.
Rediffed: $descfile in parse_desc() should stay a global variable,
var/adm/descs/ file creation depends on it.
Rediffed: keep full path to PKG-DESC-FORMAT in parse_desc()
Stefan Fiedler:
Re-read tags for forked packages from .desc files in pkgfork(); this
ensures correct info about forked packages in config/.../packages.
scripts/functions, parse_desc(): assign values to existing desc_$tag
variables; allow for parsing only given tags.
misc/tools-source/config_helper.c: parse at most 50 arguments.
Rediffed: $descfile in parse_desc() should stay a global variable,
var/adm/descs/ file creation depends on it.
Rediffed: keep full path to PKG-DESC-FORMAT in parse_desc()
--- scripts/config.func (Revision 53)
+++ scripts/config.func (Revision 54)
@@ -114,8 +114,17 @@
# 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 @@
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
--- scripts/functions (Revision 53)
+++ scripts/functions (Revision 54)
@@ -1,3 +1,4 @@
+#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
@@ -346,27 +347,35 @@
fi
}
-# Parse the *.desc file. Use the description from PKG-DESC-FORMAT and
-# save the tag data in $desc_*.
+# parse_desc <desc file> [ <tag1> [ <tag2> [ ... ] ] ]
+# 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
}
--- misc/tools-source/config_helper.c (Revision 53)
+++ misc/tools-source/config_helper.c (Revision 54)
@@ -356,19 +356,20 @@
}
}
}
+
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] = "";
}
--- scripts/Config (Revision 54)
+++ scripts/Config (Revision 55)
@@ -151,6 +151,10 @@
fi
bprof main start
+# From scripts/parse-config
+base=$(pwd -P)
+
+. scripts/functions
. scripts/config.func
current=""
[Download this patch]