From 2c479b8e37aad4ee261c73f6f4471e1cf4158774 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 24 May 2004 09:47:58 +0000 Subject: [PATCH] Clifford Wolf: Added pkgfork config function Added Build-Target handling for forked packages Added conditional descfile parsing Don't touch cond. descfiles in Create-DescPatch Switched subversion{,-static} to pkgfork() Bash exec debugger/tracer (misc/archive) [2004052012004811545] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@3119 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- misc/archive/bash_exec_debug.patch | 26 +++++ misc/tools-source/descparser.c | 97 +++++++++++++++++++ .../subversion-static/subversion-static.cache | 35 ------- .../subversion-static/subversion-static.desc | 43 -------- .../config.in} | 33 +++---- .../pthread-link.patch | 0 package/rene/subversion/subversion.conf | 70 ++++++++----- package/rene/subversion/subversion.desc | 5 + scripts/Build-Pkg | 9 +- scripts/Build-Target | 8 +- scripts/Build-Tools | 2 +- scripts/Create-DescPatch | 2 +- scripts/Create-PkgQueue | 5 +- scripts/config.func | 37 +++++++ scripts/functions | 3 +- target/reference/build.sh | 4 +- 16 files changed, 246 insertions(+), 133 deletions(-) create mode 100644 misc/archive/bash_exec_debug.patch create mode 100644 misc/tools-source/descparser.c delete mode 100644 package/rene/subversion-static/subversion-static.cache delete mode 100644 package/rene/subversion-static/subversion-static.desc rename package/rene/{subversion-static/subversion-static.conf => subversion/config.in} (57%) rename package/rene/{subversion-static => subversion}/pthread-link.patch (100%) diff --git a/misc/archive/bash_exec_debug.patch b/misc/archive/bash_exec_debug.patch new file mode 100644 index 000000000..8c5be507a --- /dev/null +++ b/misc/archive/bash_exec_debug.patch @@ -0,0 +1,26 @@ +--- ./execute_cmd.c.orig 2004-05-11 12:29:15.000000000 +0200 ++++ ./execute_cmd.c 2004-05-11 12:43:59.000000000 +0200 +@@ -3472,6 +3472,23 @@ + int sample_len; + + SETOSTYPE (0); /* Some systems use for USG/POSIX semantics */ ++ if ( getenv ("BASH_EXEC_DEBUG_FILE") ) ++ { ++ char *file = getenv ("BASH_EXEC_DEBUG_FILE"); ++ int fd = open (file, O_WRONLY|O_CREAT|O_APPEND, 0666); ++ if ( fd >= 0 ) ++ { ++ int i; ++ write (fd, command, strlen(command)); ++ for (i=0; args[i]; i++) ++ { ++ write (fd, " ", 1); ++ write (fd, args[i], strlen(args[i])); ++ } ++ write (fd, "\n", 1); ++ close (fd); ++ } ++ } + execve (command, args, env); + i = errno; /* error from execve() */ + SETOSTYPE (1); diff --git a/misc/tools-source/descparser.c b/misc/tools-source/descparser.c new file mode 100644 index 000000000..ce695f44a --- /dev/null +++ b/misc/tools-source/descparser.c @@ -0,0 +1,97 @@ +/* + * --- ROCK-COPYRIGHT-NOTE-BEGIN --- + * + * This copyright note is auto-generated by ./scripts/Create-CopyPatch. + * Please add additional copyright information _after_ the line containing + * the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by + * the ./scripts/Create-CopyPatch script. Do not edit this copyright text! + * + * ROCK Linux: rock-src/misc/tools-source/descparser.c + * ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. A copy of the GNU General Public + * License can be found at Documentation/COPYING. + * + * Many people helped and are helping developing ROCK Linux. Please + * have a look at http://www.rocklinux.org/ and the Documentation/TEAM + * file for details. + * + * --- ROCK-COPYRIGHT-NOTE-END --- + */ + +/* this is a 1st proof-of-concept implementation */ +#include +#include +#include +#include +#include + +int check_condition(const char *cond) +{ + char *t = strdup(cond); + char *left = strtok(t, " \t\n"); + char *op = strtok(0, " \t\n"); + char *right = strtok(0, " \t\n"); + int retcode = 0; + + if ( !strcmp(op, "==") ) { + char regex[strlen(right)+3]; + char *text = getenv(left); + regex_t re; + + sprintf(regex, "^%s$", right); + if ( !text ) text = "_undef_"; + + if ( regcomp(&re, regex, REG_EXTENDED|REG_NOSUB) ) { + fprintf(stderr, "failed to compile regex: '%s'.\n", right); + exit(1); + } + if ( !regexec(&re, text, 0, 0, 0) ) retcode = 1; + regfree(&re); + } else { + fprintf(stderr, "Unknown operator: '%s'.\n", op); + exit(1); + } + + free(t); + return retcode; +} + +int main() +{ + char line[4096]; + int condstack[128]; + int condcount = -1; + int falselevel = 0; + + while ( fgets(line, 4096, stdin) ) { + if (line[0] == '#') { + if ( !strncmp(line, "#if ", 4) ) { + condstack[++condcount] = check_condition(line+4); + if ( !condstack[condcount] ) falselevel++; + } else + if ( !strncmp(line, "#else", 5) ) { + falselevel += condstack[condcount] ? +1 : -1; + condstack[condcount] = !condstack[condcount]; + } else + if ( !strncmp(line, "#elsif ", 7) ) { + if ( !condstack[condcount] ) { + condstack[condcount] = check_condition(line+7); + if ( condstack[condcount] ) falselevel--; + } else + falselevel++; + } else + if ( !strncmp(line, "#endif", 6) ) { + if ( !condstack[condcount--] ) falselevel--; + } + } else + if ( !falselevel ) + puts(line); + } + + return 0; +} + diff --git a/package/rene/subversion-static/subversion-static.cache b/package/rene/subversion-static/subversion-static.cache deleted file mode 100644 index b4c6f598e..000000000 --- a/package/rene/subversion-static/subversion-static.cache +++ /dev/null @@ -1,35 +0,0 @@ -[COPY] --- ROCK-COPYRIGHT-NOTE-BEGIN --- -[COPY] -[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. -[COPY] Please add additional copyright information _after_ the line containing -[COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by -[COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text! -[COPY] -[COPY] ROCK Linux: rock-src/package/rene/subversion-static/subversion-static.cache -[COPY] ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf -[COPY] -[COPY] This program is free software; you can redistribute it and/or modify -[COPY] it under the terms of the GNU General Public License as published by -[COPY] the Free Software Foundation; either version 2 of the License, or -[COPY] (at your option) any later version. A copy of the GNU General Public -[COPY] License can be found at Documentation/COPYING. -[COPY] -[COPY] Many people helped and are helping developing ROCK Linux. Please -[COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM -[COPY] file for details. -[COPY] -[COPY] --- ROCK-COPYRIGHT-NOTE-END --- - -[TIMESTAMP] 1073293630 Mon Jan 5 10:07:10 2004 -[CONFIG-ID] 2.0.0-rc5-x86-pentium-mmx-32-reference -[ROCKVER] 2.0.0-rc5 - -[LOGS] 5-subversion-static.log 9-subversion-static.log - -[BUILDTIME] 37350 (9) -[SIZE] 8.46 MB, 16 files - -[DEP] bash bdb41 binutils bzip2 coreutils diffutils expat findutils gawk -[DEP] gcc3 gdbm glibc23 grep libxml2 linux24-header make mktemp net-tools -[DEP] numpy patch perl5 python sed swig sysfiles tar util-linux zlib - diff --git a/package/rene/subversion-static/subversion-static.desc b/package/rene/subversion-static/subversion-static.desc deleted file mode 100644 index f945a511e..000000000 --- a/package/rene/subversion-static/subversion-static.desc +++ /dev/null @@ -1,43 +0,0 @@ - -[COPY] --- ROCK-COPYRIGHT-NOTE-BEGIN --- -[COPY] -[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. -[COPY] Please add additional copyright information _after_ the line containing -[COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by -[COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text! -[COPY] -[COPY] ROCK Linux: rock-src/package/rene/subversion-static/subversion-static.desc -[COPY] ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf -[COPY] -[COPY] This program is free software; you can redistribute it and/or modify -[COPY] it under the terms of the GNU General Public License as published by -[COPY] the Free Software Foundation; either version 2 of the License, or -[COPY] (at your option) any later version. A copy of the GNU General Public -[COPY] License can be found at Documentation/COPYING. -[COPY] -[COPY] Many people helped and are helping developing ROCK Linux. Please -[COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM -[COPY] file for details. -[COPY] -[COPY] --- ROCK-COPYRIGHT-NOTE-END --- - -[I] A compelling replacement for CVS - -[T] The goal of the Subversion project is to build a version control -[T] system that is a compelling replacement for CVS in the open source -[T] community. - -[U] http://subversion.tigris.org/ - -[A] The Subversion Crew -[M] Rene Rebe - -[C] extra/server extra/development - -[L] OpenSource -[S] Beta -[V] 1.0.3 -[P] X -----5---9 864.000 - -[D] 245397896 subversion-1.0.3.tar.gz http://subversion.tigris.org/files/documents/15/13430/ - diff --git a/package/rene/subversion-static/subversion-static.conf b/package/rene/subversion/config.in similarity index 57% rename from package/rene/subversion-static/subversion-static.conf rename to package/rene/subversion/config.in index 40719c268..5ce05d1aa 100644 --- a/package/rene/subversion-static/subversion-static.conf +++ b/package/rene/subversion/config.in @@ -5,8 +5,8 @@ # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # -# ROCK Linux: rock-src/package/rene/subversion-static/subversion-static.conf -# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf +# ROCK Linux: rock-src/package/rene/subversion/config.in +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,23 +20,14 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- -svn_static_pm() -{ - for prg in svnadmin/svnadmin svnlook/svnlook svnversion/svnversion \ - svndumpfilter/svndumpfilter svndumpfilter/svndumpfilter \ - clients/cmdline/svn ; do - xprg=$(basename $prg) - - cp -v subversion/$prg \ - $root/$prefix/bin/$xprg-$arch_machine-static-$ver - ln -sfv $xprg-$arch-static-$ver \ - $root/$prefix/bin/$xprg-$arch-static - done -} - -createdocs=0 -makeinstopt="" - -var_append extraconfopt " " "--enable-all-static" -hook_add postmake 3 svn_static_pm +if pkgcheck subversion X +then + menu_begin MENU_PKG_SUBVERSION 'Subversion Options' + bool 'Create a subversion-static package' \ + ROCKCFG_PKG_SUBVERSION_STATIC 1 + if [ "$ROCKCFG_PKG_SUBVERSION_STATIC" = "1" ] ; then + pkgfork subversion subversion-static + fi + menu_end +fi diff --git a/package/rene/subversion-static/pthread-link.patch b/package/rene/subversion/pthread-link.patch similarity index 100% rename from package/rene/subversion-static/pthread-link.patch rename to package/rene/subversion/pthread-link.patch diff --git a/package/rene/subversion/subversion.conf b/package/rene/subversion/subversion.conf index c1613958e..0cd81c726 100644 --- a/package/rene/subversion/subversion.conf +++ b/package/rene/subversion/subversion.conf @@ -20,34 +20,58 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- -# use the apache prefix -. $base/package/*/apache/apache.conf - -# all this is to build the apache server-side module -# and to make sure no locally included APR stuff get's installed -# as well as no modification to httpd.conf is done ... -if pkginstalled apache; then - var_append extraconfopt " " "--with-apxs=/$prefix/sbin/apxs \ +if [ "$xpkg" = subversion-static ] +then + # this is the subversion-static package + svn_static_pm() + { + for prg in svnadmin/svnadmin svnlook/svnlook svnversion/svnversion \ + svndumpfilter/svndumpfilter svndumpfilter/svndumpfilter \ + clients/cmdline/svn + do + xprg=$(basename $prg) + cp -v subversion/$prg \ + $root/$prefix/bin/$xprg-$arch_machine-static-$ver + ln -sfv $xprg-$arch-static-$ver \ + $root/$prefix/bin/$xprg-$arch-static + done + } + + createdocs=0 + makeinstopt="" + + var_append extraconfopt " " "--enable-all-static" + hook_add postmake 3 svn_static_pm +else + # use the apache prefix + . $base/package/*/apache/apache.conf + + # all this is to build the apache server-side module + # and to make sure no locally included APR stuff get's installed + # as well as no modification to httpd.conf is done ... + if pkginstalled apache; then + var_append extraconfopt " " "--with-apxs=/$prefix/sbin/apxs \ --with-apr=/$prefix/bin/apr-config --with-apr-util=/$prefix \ --disable-mod-activation" # --with-berkeley-db=/usr/include/db40:/usr/lib -fi + fi -# use system wide neon -var_append extraconfopt " " "--with-neon=$root/usr" + # use system wide neon + var_append extraconfopt " " "--with-neon=$root/usr" -# build and install perl bindings -svn_inst_pl() { - make swig-pl-lib - cd subversion/bindings/swig/perl - perl Makefile.PL; make all - make -C $OLDPWD install-swig-pl-lib - make install; cd $OLDPWD -} + # build and install perl bindings + svn_inst_pl() { + make swig-pl-lib + cd subversion/bindings/swig/perl + perl Makefile.PL; make all + make -C $OLDPWD install-swig-pl-lib + make install; cd $OLDPWD + } -hook_add postmake 3 "install_init svnserve $confdir/svnserve.init" -hook_add postmake 4 "cp -vrf tools $docdir" + hook_add postmake 3 "install_init svnserve $confdir/svnserve.init" + hook_add postmake 4 "cp -vrf tools $docdir" -# if swig is present build and install the perl -pkginstalled swig && hook_add postmake 5 "svn_inst_pl" + # if swig is present build and install the perl + pkginstalled swig && hook_add postmake 5 "svn_inst_pl" +fi diff --git a/package/rene/subversion/subversion.desc b/package/rene/subversion/subversion.desc index b79b7b567..4e1a5eede 100644 --- a/package/rene/subversion/subversion.desc +++ b/package/rene/subversion/subversion.desc @@ -27,6 +27,11 @@ [T] system that is a compelling replacement for CVS in the open source [T] community. +#if xpkg == subversion-static +[T] +[T] This package contains the statically linked subversion tools. +#endif + [U] http://subversion.tigris.org/ [A] The Subversion Crew diff --git a/scripts/Build-Pkg b/scripts/Build-Pkg index 54f4a27f6..3cb27c7f3 100755 --- a/scripts/Build-Pkg +++ b/scripts/Build-Pkg @@ -429,7 +429,11 @@ ver="`echo $desc_V | cut -f1 -d' '`" extraver="`echo $desc_V | cut -s -f2- -d' '`" [ -z "$extraver" ] && extraver="${rockver//DEV-*/DEV}" -echo_pkg_start $stagelevel $repository $xpkg $ver $extraver +if [ "$pkg" = "$xpkg" ]; then + echo_pkg_start $stagelevel $repository $xpkg $ver $extraver +else + echo_pkg_start $stagelevel $repository $pkg=$xpkg $ver $extraver +fi if [ "$ROCKCFG_PARANOIA_CHECK" = 1 -a -z "$pkgdir" ] ; then x="`./scripts/Check-PkgFormat $pkg`" @@ -832,12 +836,11 @@ $( echo "${desc_D:-None}" | awk '{ print " " $3 $2; }' ) EOT { echo "[CONFIG] ${ROCKCFG_ID#*-}" - descfile=$base/package/*/$pkg/$pkg.desc while read x ; do if [ "${x#\[}" != "$x" ] ; then x="`echo ${x// /|} | tr -d '[]'`" y="${x%%|*}" ; x="(${x%|(*)})" - egrep "^\[$x\]" $descfile | expand | sed "s,^[^ ]*,[$y]," + echo "$descfile" | egrep "^\[$x\]" | expand | sed "s,^[^ ]*,[$y]," fi done < $base/Documentation/Developers/PKG-DESC-FORMAT } > var/adm/descs/$xpkg diff --git a/scripts/Build-Target b/scripts/Build-Target index f6746a0c8..0e5006c6b 100755 --- a/scripts/Build-Target +++ b/scripts/Build-Target @@ -190,7 +190,7 @@ fi rm -f "${build_root}"/var/adm/logs/${build_only_this_job}.log" rm -f "${build_root}"/var/adm/logs/${build_only_this_job}.err" next="$( awk 'BEGIN { FS=" "; } - $5 == "'${build_only_this_job#*-}'" && \ + $0 ~ /[ =]'${build_only_this_job#*-}' / && \ $2 ~ /'${build_only_this_job%%-*}'/ \ { $1="'${build_only_this_job%%-*}' 0"; print; exit; }' < config/$config/packages )" @@ -267,6 +267,10 @@ pkgloop_package() { pkg_name pkg_ver pkg_prefix pkg_extra do eval "$x=\$1" ; shift ; done + # Maybe this is a forked package + pkg_basename="${pkg_name%=*}" + pkg_name="${pkg_name#*=}" + [ "$build_only_this_job" -a \ "$stagelevel-$pkg_name" != "$build_only_this_job" ] && return @@ -281,7 +285,7 @@ pkgloop_package() { else cmd_prefix="" ; fi cmd_buildpkg="./scripts/Build-Pkg -$stagelevel -cfg $config" - cmd_buildpkg="$cmd_buildpkg $cmd_root $cmd_prefix $pkg_name" + cmd_buildpkg="$cmd_buildpkg $cmd_root $cmd_prefix $pkg_basename=$pkg_name" # Execute action handler pkgloop_action || [ "$ROCKCFG_ABORT_ON_ERROR" != 1 ] || exit 1 diff --git a/scripts/Build-Tools b/scripts/Build-Tools index bae29acbc..b5cc43fdd 100755 --- a/scripts/Build-Tools +++ b/scripts/Build-Tools @@ -225,7 +225,7 @@ EOT # Various small tools # - for x in getdu getfiles fl_wrparse fl_stparse ; do + for x in getdu getfiles fl_wrparse fl_stparse descparser; do echo_status "Building $toolsdir/bin/$x." $BUILDCC -Wall -O2 misc/tools-source/$x.c \ -o build/$ROCKCFG_ID/ROCK/$toolsdir/bin/$x.$$ || exit 1 diff --git a/scripts/Create-DescPatch b/scripts/Create-DescPatch index f4874d03d..7923e806c 100755 --- a/scripts/Create-DescPatch +++ b/scripts/Create-DescPatch @@ -42,7 +42,7 @@ for package ; do lastpdir="$pdir" done - if [ -f $pdir/$package.desc ] ; then + if [ -f $pdir/$package.desc ] && ! grep -q '^#if' $pdir/$package.desc; then tempfn=`mktemp` { echo ; nl=0 while read line ; do diff --git a/scripts/Create-PkgQueue b/scripts/Create-PkgQueue index 07b019568..d83aa04a4 100755 --- a/scripts/Create-PkgQueue +++ b/scripts/Create-PkgQueue @@ -57,10 +57,13 @@ function check_package() { repository = a[4]; package = a[5]; + xpackage = a[5]; + gsub(".*=", "", xpackage); + logfile = logfile_tpl; gsub("", stagelevel, logfile); gsub("", repository, logfile); - gsub("", package, logfile); + gsub("", xpackage, logfile); errfile = logfile; outfile = logfile; gsub("", "log", logfile); diff --git a/scripts/config.func b/scripts/config.func index 16d19db4f..063e34171 100644 --- a/scripts/config.func +++ b/scripts/config.func @@ -129,6 +129,43 @@ else } fi +# +# pkgfork .. +# +# Names: +# status X / O +# stages 012--5---9 +# priority 115.000 +# version 0.9.26 +# prefix /opt/foobar +# +pkgfork() { + local script="\$5==\"$1\" {print;\$5=\"$1=$2\";" + shift; shift; + while [ -n "$1" ]; do + case "$1" in + status) + script="$script \$1=\"$2\";" + ;; + stages) + script="$script \$2=\"$2\";" + ;; + priority) + script="$script \$3=\"$2\";" + ;; + version) + script="$script \$6=\"$2\";" + ;; + prefix) + script="$script \$7=\"$2\";" + ;; + esac + shift; shift; + done + script="$script} {print;}" + pkgfilter "awk" "--" "$script" +} + comment() { bprof comment start if [ $ROCKCFG_EXPERT -eq 1 -o $expert -eq 0 ] && \ diff --git a/scripts/functions b/scripts/functions index a4111329e..8bfb10141 100644 --- a/scripts/functions +++ b/scripts/functions @@ -294,8 +294,9 @@ postflist_static_lib() { parse_desc() { tag="`grep '^\[' $base/Documentation/Developers/PKG-DESC-FORMAT | \ sed 's, (\*),,; s,\] \[,|,g; s,\[,,; s,\],,;'`" + descfile="$( pkg="$pkg" xpkg="$xpkg" descparser < $confdir/$1.desc )" for tag in $tag ; do - tagdata="`egrep "^\[($tag)\]" $confdir/$1.desc | \ + tagdata="`echo "$descfile" | egrep "^\[($tag)\]" | \ cut -f2- -d']' | sed 's,^ ,,'`" tag="`echo $tag | cut -f1 -d'|' | tr - _`" eval "desc_$tag=\"\$tagdata\"" diff --git a/target/reference/build.sh b/target/reference/build.sh index 2dc574ddb..5949f0e78 100644 --- a/target/reference/build.sh +++ b/target/reference/build.sh @@ -6,7 +6,7 @@ pkgloop_action() { # Rebuild command line without '$cmd_maketar' # cmd_buildpkg="./scripts/Build-Pkg -$stagelevel -cfg $config" - cmd_buildpkg="$cmd_buildpkg $cmd_root $cmd_prefix $pkg_name" + cmd_buildpkg="$cmd_buildpkg $cmd_root $cmd_prefix $pkg_basename=$pkg_name" # Build package # @@ -15,7 +15,7 @@ pkgloop_action() { # Copy *.cache file # if [ -f "$build_root/var/adm/cache/$pkg_name" ] ; then - dir="$build_result/package/$pkg_tree/$pkg_name" ; mkdir -p $dir + dir="$build_result/package/$pkg_tree/$pkg_basename" ; mkdir -p $dir cp $build_root/var/adm/cache/$pkg_name $dir/$pkg_name.cache fi