Browse Source

* replaced uname wrapper by a useful one, which doesn't not scream but

returns information which can be used during the build process. Also
	  replaced arch wrapper to use a template instead of hardcoded text on
	  Build-Tools


git-svn-id: svn://svn.opensde.net/opensde/opensde/trunk@21426 10447126-35f2-4685-b0cf-6dd780d3921f
misl/sde-wrapper
Alejandro Mery 17 years ago
parent
commit
6ba1da6af1
5 changed files with 163 additions and 46 deletions
  1. +3
    -1
      lib/parse-config
  2. +1
    -0
      scripts/Build-Pkg
  3. +7
    -45
      scripts/Build-Tools
  4. +16
    -0
      src/tools-source/arch_wrapper.in.sh
  5. +136
    -0
      src/tools-source/uname_wrapper.in.sh

+ 3
- 1
lib/parse-config

@ -3,7 +3,7 @@
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# #
# Filename: lib/parse-config # Filename: lib/parse-config
# Copyright (C) 2006 The OpenSDE Project
# Copyright (C) 2006 - 2007 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf # Copyright (C) 1998 - 2003 Clifford Wolf
# #
@ -119,6 +119,8 @@ export CMD_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
export CMD_WRAPPER_LOGFILE="" CMD_WRAPPER_DEBUG=0 CMD_WRAPPER_BYPASS=0 export CMD_WRAPPER_LOGFILE="" CMD_WRAPPER_DEBUG=0 CMD_WRAPPER_BYPASS=0
export CMD_WRAPPER_NOLOOP=0 ; unset CMD_WRAPPER_OTHERS_TMP export CMD_WRAPPER_NOLOOP=0 ; unset CMD_WRAPPER_OTHERS_TMP
export UNAME_WRAPPER_LOGFILE=""
if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ] if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ]
then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ; fi then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ; fi

+ 1
- 0
scripts/Build-Pkg

@ -260,6 +260,7 @@ if [ "$SDECFG_FLIST" = "flwrapper" -a -z "$FLWRAPPER" ] ; then
fi fi
export INSTALL_WRAPPER_LOGFILE="$builddir/install_wrapper.log" export INSTALL_WRAPPER_LOGFILE="$builddir/install_wrapper.log"
export CMD_WRAPPER_LOGFILE="$builddir/cmd_wrapper.log" export CMD_WRAPPER_LOGFILE="$builddir/cmd_wrapper.log"
export UNAME_WRAPPER_LOGFILE="$builddir/uname_wrapper.log"
if [ $norebuild = 1 -a -f $root/var/adm/logs/$stagelevel-$xpkg.log ] ; then if [ $norebuild = 1 -a -f $root/var/adm/logs/$stagelevel-$xpkg.log ] ; then
echo_pkg_deny $stagelevel $pkg "already built" echo_pkg_deny $stagelevel $pkg "already built"

+ 7
- 45
scripts/Build-Tools

@ -3,7 +3,7 @@
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# #
# Filename: scripts/Build-Tools # Filename: scripts/Build-Tools
# Copyright (C) 2006 The OpenSDE Project
# Copyright (C) 2006 - 2007 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf # Copyright (C) 1998 - 2003 Clifford Wolf
# #
@ -201,51 +201,13 @@ EOT
done done
# #
echo_status "Building $toolsdir/wrapper/{uname,arch}." echo_status "Building $toolsdir/wrapper/{uname,arch}."
cat << EOT > build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/uname.$$
#!/bin/sh
arch=\$(echo \${arch_machine//-*/} | sed -e 's/sparcv.*/sparc/' -e 's/powerpc/ppc/')
echo "You should not call uname during the build!" >&2
if [ -z "\$1" ]; then
echo "Linux"
else
# shorten long options
opts=" \$(echo \$* | sed 's/--all/-a/;s/--kernel-name/-s/;s/--nodename/-n/;
s/--kernel-release/-r/;s/--kernel-version/-v/;
s/--machine/-m/;s/--processor/-p/;')"
# expand combined options
opts=" \$(echo \$opts | sed 's/[^-]/ -&/g ; s/- //g ; s/-a/-m -n -r -s -v/')"
str=
newopts="\${opts// -s/}"
[ "\$newopts" != "\$opts" ] && str="\$str Linux"
opts="\$newopts"; newopts="\${opts// -n/}"
[ "\$newopts" != "\$opts" ] && str="\$str \$(hostname)"
opts="\$newopts"; newopts="\${opts// -r/}"
[ "\$newopts" != "\$opts" ] && str="\$str 2.6.18-inside-sandbox"
opts="\$newopts"; newopts="\${opts// -v/}"
[ "\$newopts" != "\$opts" ] && str="\$str #1: SMP $(date)"
opts="\$newopts"; newopts="\${opts// -m/}"
[ "\$newopts" != "\$opts" ] && str="\$str \$arch"
opts="\$newopts"; newopts="\${opts// -p/}"
[ "\$newopts" != "\$opts" ] && str="\$str unknown"
echo \${str:1} # skip the leading blank ,-)
if [ "\$newopts" ]; then
echo "Unknown option:\$newopts" >&2
exit 1
fi
fi
EOT
cat << EOT > build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/arch.$$
#!/bin/sh
echo "You should not call arch during the build!" >&2
echo "$(echo $arch | arch2uname)"
EOT
chmod +x build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/{uname,arch}.$$
mv build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/uname.$$ \
build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/uname
mv build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/arch.$$ \
build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/arch
sed -e "s,@@ARCH_MACHINE@@,$arch_machine,g" \
src/tools-source/uname_wrapper.in.sh > build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/uname
sed -e "s,@@ARCH@@,$( echo $arch | arch2uname ),g" \
src/tools-source/arch_wrapper.in.sh > build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/arch
chmod +x build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/{uname,arch}
wrappers="$wrappers uname arch" wrappers="$wrappers uname arch"
# #
echo_status "Building $toolsdir/wrapper/install_wrapper." echo_status "Building $toolsdir/wrapper/install_wrapper."

+ 16
- 0
src/tools-source/arch_wrapper.in.sh

@ -0,0 +1,16 @@
#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: src/tools-source/arch_wrapper.in.sh
# 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 ---
echo @@ARCH@@

+ 136
- 0
src/tools-source/uname_wrapper.in.sh

@ -0,0 +1,136 @@
#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: src/tools-source/uname_wrapper.in.sh
# 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 ---
# command line arguments
opts=asnrvmpio
longopts=all,kernel-name,nodename,kernel-release,kernel-version,machine,processor,hardware-platform,operating-system
# command line settings
os=
machine=
nodename=
processor=
hardware=
kernel_name=
kernel_release=
kernel_version=
# validate arguments
[ $# -gt 0 ] || set -- -s
output=
oldopts="$@"
if [ -z "$UNAME_WRAPPER_LOGFILE" ]; then
cat >> /tmp/uname.log <<EOT
$$ uname $oldopts
broken environment
$( set )
--
EOT
fi
newopts=$( getopt -o $opts -l $longopts -- "$@" )
if [ $? -ne 0 ]; then
cat >> $UNAME_WRAPPER_LOGFILE <<-EOT
$$ uname $oldopts -> $newopts
failed to parse options.
--
EOT
exit 1
fi
set -- $newopts
while [ $# -gt 0 ]; do
case "$1" in
-a|--all)
os=yes
machine=yes
nodename=yes
processor=yes
hardware=yes
kernel_name=yes
kernel_release=yes
kernel_version=yes
;;
-o|--operating-system) os=yes ;;
-m|--machine) machine=yes ;;
-n|--nodename) nodename=yes ;;
-p|--processor) processor=yes ;;
-i|--hardware-platform) hardware=yes ;;
-s|--kernel-name) kernel_name=yes ;;
-r|--kernel-release) kernel_release=yes ;;
-v|--kernel-version) kernel_version=yes ;;
--) shift; break ;;
esac
shift
done
# kernel name - Linux
[ -z "$kernel_name" ] || output="$output Linux"
# network node hostname - `hostname`
[ -z "$nodename" ] || output="$output $( hostname )"
# kernel release - TODO: try to guess something useful
if [ -n "$kernel_release" ]; then
ver= ver0=
# do i have kernel sources?
if [ -L $root/usr/src/linux ]; then
ver=$( readlink $root/usr/src/linux | cut -d- -f2- )
elif [ -r $root/var/adm/packages/linux26 ]; then
ver0=$( sed -n -e 's,^Package Name and Version: [^ ]\+ \([^ ]\+\) .*,\1,p' $root/var/adm/packages/linux26 )
ver=$( ls -1t $root/boot/vmlinuz_${ver0}* | sed -e 's,.*/vmlinuz_\(.*\),\1,' | tail -n 1 )
elif [ -r $root/var/adm/packages/linux-header ]; then
ver0=$( sed -n -e 's,^Package Name and Version: [^ ]\+ \([^ ]\+\) .*,\1,p' $root/var/adm/packages/linux-header )
fi
if [ -z "$ver" -a -n "$ver0" ]; then
ver="$ver0-inside-sandbox"
elif [ -z "$ver" -a -z "$ver0" ]; then
ver="2.6.18-wrapper-could-not-guess"
fi
output="$output $ver"
fi
# kernel version - #1 SMP Fri Nov 24 23:49:57 CLST 2006
[ -z "$kernel_version" ] || output="$output #1 SMP $(date)"
# machine hardware name - $arch_machine
[ -z "$machine" ] || output="$output @@ARCH_MACHINE@@"
# processor type - FIXME: unknown
[ -z "$processor" ] || output="$output unknown"
# hardware platform - FIXME: unknown
[ -z "$hardware" ] || output="$output unknown"
# operating system - GNU/Linux
[ -z "$os" ] || output="$output GNU/Linux"
# remove the heading space
output=$( echo $output )
cat >> $UNAME_WRAPPER_LOGFILE <<EOT
$$ uname $oldopts
$output
--
EOT
echo "$output"

Loading…
Cancel
Save