OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

90 lines
1.9 KiB

#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: bin/sde-list-pkg
# 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
list_usage() {
local progname=${0##*/}
cat <<EOT
Usage: $progname [--arch <arch>]
$progname [--cfg <config>]
EOT
}
list_arch() {
local repo= arch="$1"
local files=
if [ ! -s $SDEROOT/architecture/$arch/archtest.out ]; then
echo_error "wrong architecture ($arch) specified, aborting."
list_usage
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
files=$( ls -1d $repo/*/*.desc 2> /dev/null )
if [ -n "$files" ]; then
gawk -f ./lib/sde-package/package-list.awk -v "arch=$arch" $files
fi
done | sort -k 3
}
list_desc() {
echo_abort 1 "Not yet implemented"
}
arch=
config=
mode=
shortopts=a:c:
longopts=arch:,cfg:
options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
if [ $? -ne 0 ]; then
list_usage
exit -1
fi
# load new arguments list
eval set -- "$options"
# arguments
while [ $# -gt 0 ]; do
case "$1" in
-a|--arch) mode=arch
arch="$2"; shift ;;
-c|--cfg) mode=desc
config="$2"; shift ;;
--) shift; break ;;
*) echo_abort 1 "Unknown argument '$1', aborting."
esac
shift
done
case "$mode" in
arch) list_arch "$arch" ;;
desc) list_desc "$config" ;;
*) list_usage ;;
esac