From 34b8b51e0de2f1922dd21985e9815ffbae143523 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Fri, 18 May 2007 17:18:21 +0000 Subject: [PATCH] * converted scripts/Create-PkgList into lib/sde-package/package-list.awk * introduced `sde list pkg` to list the default package list for a given architecture, used by Config and some toys. git-svn-id: svn://svn.opensde.net/opensde/opensde/trunk@21082 10447126-35f2-4685-b0cf-6dd780d3921f --- bin/sde-list | 73 +++++++++++++++++++ lib/sde-list.hlp | 15 ++++ .../sde-package/package-list.awk | 23 ++---- scripts/Check-Deps-1 | 4 +- scripts/Config | 5 +- scripts/Create-FlatPriPatch | 9 ++- 6 files changed, 103 insertions(+), 26 deletions(-) create mode 100755 bin/sde-list create mode 100644 lib/sde-list.hlp rename scripts/Create-PkgList => lib/sde-package/package-list.awk (83%) diff --git a/bin/sde-list b/bin/sde-list new file mode 100755 index 0000000..5369d91 --- /dev/null +++ b/bin/sde-list @@ -0,0 +1,73 @@ +#!/bin/sh +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: bin/sde-list +# Copyright (C) 2007 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# 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; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +#Description: generate lists needed by other commands + +set -e + +[ -n "$SDEROOT" ] || + export SDEROOT=$( cd "${0%/*}/.."; pwd -P ) + +. $SDEROOT/lib/libsde.in + +sde_list_package() { + local repo= + + if [ -n "$arch" -a ! -d $SDEROOT/architecture/$arch/ ]; then + echo_error "wrong architecture ($arch) specified, aborting." + sde_list_help + return 1 + fi + + # the .awk file needs complete $SDEROOT relative .desc locations + cd $SDEROOT + # NOTE: protection again command line overflow + for repo in package/*; do + [ ! -d "$repo/" ] || + gawk -f ./lib/sde-package/package-list.awk -v "arch=$arch" $( ls -1d $repo/*/*.desc 2> /dev/null ) + done | sort -k 3 +} + +sde_list_help() { + . $SDEROOT/lib/sde-help.in + help_command list +} + +option=help +arch= + +# discriminator +if [ $# -gt 0 ]; then + option="$1"; shift +fi + +# arguments +while [ $# -gt 0 ]; do + case "$1" in + --arch) arch="$2"; shift ;; + *) echo_abort 1 "Unknown argument '$1', aborting." + esac + shift +done + +# multiplex +case "$option" in + package|pkg) sde_list_package ;; + help) sde_list_help ;; + *) echo_error "Unknown discriminator '$option'." + sde_list_help + exit 1 ;; +esac + diff --git a/lib/sde-list.hlp b/lib/sde-list.hlp new file mode 100644 index 0000000..33d7c47 --- /dev/null +++ b/lib/sde-list.hlp @@ -0,0 +1,15 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: lib/sde-list.hlp +# Copyright (C) 2007 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# 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; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +Usage: sde list [pkg|package] [--arch ] diff --git a/scripts/Create-PkgList b/lib/sde-package/package-list.awk similarity index 83% rename from scripts/Create-PkgList rename to lib/sde-package/package-list.awk index a5e94a4..8216c64 100755 --- a/scripts/Create-PkgList +++ b/lib/sde-package/package-list.awk @@ -1,8 +1,8 @@ -#!/bin/bash -# --- T2-COPYRIGHT-NOTE-BEGIN --- +# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # -# T2 SDE: scripts/Create-PkgList +# Filename: lib/sde-package/package-list.awk +# Copyright (C) 2007 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # @@ -12,19 +12,10 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. A copy of the # GNU General Public License can be found in the file COPYING. -# --- T2-COPYRIGHT-NOTE-END --- +# --- SDE-COPYRIGHT-NOTE-END --- -if [ $# -ne 1 -o ! -d architecture/"$1" ] ; then - echo "Usage: $0 [ ]" - [ $# -eq 0 ] || - echo " '$1' is not a valid architecture" - exit 1 -fi 1>&2 - -gawk ' -BEGIN { - arch="'$1'"; -} +# Usage: gawk -f lib/sde-package/package-list.awk -v arch=$arch +# function print_package() { print defset, stages, pri, pkgtree, @@ -94,5 +85,3 @@ FNR == 1 { pkgtree=""; } } - -' package/*/*/*.desc | sort -k3 diff --git a/scripts/Check-Deps-1 b/scripts/Check-Deps-1 index c91122e..2ff6702 100755 --- a/scripts/Check-Deps-1 +++ b/scripts/Check-Deps-1 @@ -3,7 +3,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: scripts/Check-Deps-1 -# Copyright (C) 2006 The OpenSDE Project +# Copyright (C) 2006 - 2007 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # @@ -55,7 +55,7 @@ BEGIN { present=""; errors=""; - system("mkdir -p tmp ; ./scripts/Create-PkgList > tmp/pkg_list"); + system("mkdir -p tmp ; ./bin/sde-list package > tmp/pkg_list"); depfile_tpl = "package///.cache"; for (stagelevel=0; stagelevel<9; stagelevel++) { diff --git a/scripts/Config b/scripts/Config index cde2b34..19a3b82 100755 --- a/scripts/Config +++ b/scripts/Config @@ -3,7 +3,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: scripts/Config -# Copyright (C) 2006 The OpenSDE Project +# Copyright (C) 2006 - 2007 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # @@ -175,8 +175,7 @@ spacer="" ; expert=0 ; tabspace="5" ; tabspace_list="" commentnr=0 ; editfilenr=0 bprof mkpkglist start -cmd="./scripts/Create-PkgList" -cmd="$cmd $SDECFG_ARCH" +cmd="./bin/sde-list package --arch '$SDECFG_ARCH'" if [ "$cmd" != "`cat $cfgtmpdir/config.pcache.cmd 2> /dev/null`" ] ; then eval "$cmd" | tee $cfgtmpdir/config.pcache.data > $cfgtmpdir/config/packages diff --git a/scripts/Create-FlatPriPatch b/scripts/Create-FlatPriPatch index be85fea..43c397a 100755 --- a/scripts/Create-FlatPriPatch +++ b/scripts/Create-FlatPriPatch @@ -1,8 +1,9 @@ #!/bin/bash -# --- T2-COPYRIGHT-NOTE-BEGIN --- +# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # -# T2 SDE: scripts/Create-FlatPriPatch +# Filename: scripts/Create-FlatPriPatch +# Copyright (C) 2007 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # # More information can be found in the files COPYING and README. @@ -11,12 +12,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. A copy of the # GNU General Public License can be found in the file COPYING. -# --- T2-COPYRIGHT-NOTE-END --- +# --- SDE-COPYRIGHT-NOTE-END --- tempfile=`mktemp` counter=1000 -for pkg in $( ./scripts/Create-PkgList | cut -f4,5 -d' ' | tr ' ' / ) +for pkg in $( ./bin/sde-list package | cut -f4,5 -d' ' | tr ' ' / ) do xcounter="${counter%?}.${counter#???}00" [ $pkg = base/t2-debug ] && xcounter=999.900