[Oracleasm-commits] jlbec commits r324 - in trunk/vendor: rhel4
sles9
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Nov 22 00:05:03 CST 2005
Author: jlbec
Date: 2005-11-22 00:05:02 -0600 (Tue, 22 Nov 2005)
New Revision: 324
Modified:
trunk/vendor/rhel4/Vendor.make
trunk/vendor/rhel4/kernel.guess
trunk/vendor/sles9/Vendor.make
trunk/vendor/sles9/kernel.guess
Log:
o Taught kernel.guess how to find targetrs
o Teach Vendor.make about make packages
Modified: trunk/vendor/rhel4/Vendor.make
===================================================================
--- trunk/vendor/rhel4/Vendor.make 2005-11-22 04:54:56 UTC (rev 323)
+++ trunk/vendor/rhel4/Vendor.make 2005-11-22 06:05:02 UTC (rev 324)
@@ -19,3 +19,5 @@
include $(TOPDIR)/vendor/common/Vendor.make
+
+packages: $(shell $(TOPDIR)/vendor/rhel4/kernel.guess targets) support_rpm
Modified: trunk/vendor/rhel4/kernel.guess
===================================================================
--- trunk/vendor/rhel4/kernel.guess 2005-11-22 04:54:56 UTC (rev 323)
+++ trunk/vendor/rhel4/kernel.guess 2005-11-22 06:05:02 UTC (rev 324)
@@ -3,7 +3,24 @@
RHEL4_KERNEL_BASE="/usr/src/kernels"
+#
+# This is a simple mapping of architectures to kernel flavors. One
+# entry per architecture, <arch>:<flavor1>[,<flavor> ...]
+#
+# This is used when detecting kernels to build packages for. A kernel
+# is only built if build trees for all flavors are installed.
+#
+# Unique to redhat, empty types (the 'default' kernel) are allowed.
+# Be careful parsing this!
+#
+RHEL4_KERNEL_TYPES="
+ i686:,smp,hugemem
+ x86_64:,smp
+ ia64:
+ ppc64:
+"
+
guess_rhel4_arch()
{
# This appears to DTRT (i686 on x86, ppc64 on pSeries).
@@ -103,6 +120,84 @@
done
}
+# For a given KVER, see if all the -devel packages exist
+validate_target()
+{
+ KVER="$1"
+ ARCH="$2"
+ TYPELIST="$3"
+
+ typelist="${TYPELIST#$ARCH:}"
+ while :
+ do
+ type="${typelist%%,*}"
+ VERDIR="$(validate_version ${KVER}${type})"
+ if [ -z "$VERDIR" ]
+ then
+ return 1
+ fi
+
+ # This loop walks the list of types being careful of the empty
+ # typename
+ tmp="${typelist#*,}"
+ if [ -z "$tmp" -o "$tmp" = "$typelist" ]
+ then
+ break
+ fi
+ typelist="$tmp"
+ done
+
+ return 0
+}
+
+find_targets()
+{
+ # Pre-calculate ARCH and TYPELIST, at least
+ ARCH="$(guess_rhel4_arch)"
+ if [ -z "$ARCH" ]
+ then
+ return
+ fi
+
+ TYPELIST=
+ for typelist in $RHEL4_KERNEL_TYPES
+ do
+ TARCH=$(echo "$typelist" | cut -f1 -d:)
+ if [ "$TARCH" = "$ARCH" ]
+ then
+ TYPELIST="$typelist"
+ break
+ fi
+ done
+
+ if [ -z "$TYPELIST" ]
+ then
+ return
+ fi
+
+ ls -1 -t "$RHEL4_KERNEL_BASE" | while read kdir
+ do
+ case "$kdir" in
+ 2.6.9-5.EL*)
+ # Missing get_sb_pseudo()
+ continue
+ ;;
+ *)
+ ;;
+ esac
+
+ KVER="$(verfromdir "${RHEL4_KERNEL_BASE}/${kdir}")"
+ if ! validate_dir "$KVER" "$kdir"
+ then
+ continue
+ fi
+ if validate_target "$KVER" "$ARCH" "$TYPELIST"
+ then
+ echo "rhel4_${KVER}_rpm"
+ fi
+ done
+}
+
case "$1" in
include|build)
if [ -n "$2" ]
@@ -126,6 +221,7 @@
fi
;;
targets)
+ find_targets
;;
"")
echo "Missing operation" >&2
Modified: trunk/vendor/sles9/Vendor.make
===================================================================
--- trunk/vendor/sles9/Vendor.make 2005-11-22 04:54:56 UTC (rev 323)
+++ trunk/vendor/sles9/Vendor.make 2005-11-22 06:05:02 UTC (rev 324)
@@ -20,3 +20,5 @@
include $(TOPDIR)/vendor/common/Vendor.make
+
+packages: $(shell $(TOPDIR)/vendor/sles9/kernel.guess targets) support_rpm
Modified: trunk/vendor/sles9/kernel.guess
===================================================================
--- trunk/vendor/sles9/kernel.guess 2005-11-22 04:54:56 UTC (rev 323)
+++ trunk/vendor/sles9/kernel.guess 2005-11-22 06:05:02 UTC (rev 324)
@@ -7,6 +7,10 @@
# a list here of the mappings. It's pretty simple. One entry per
# architecture, <arch>:<flavor1>[,<flavor> ...]
#
+# Anyway, we can even reuse this when detecting kernels to build
+# packages for. A kernel is only built if build trees for all flavors
+# are installed.
+#
SLES9_KERNEL_TYPES="
x86_64:default,smp
ppc64:pseries64,iseries64,pmac64
@@ -151,6 +155,11 @@
# Find the most recent valid kernel
ls -1 -t "$SLES9_KERNEL_BASE" | while read kdir
do
+ if [ -L "${SLES9_KERNEL_BASE}/${kdir}" -o ! -d "${SLES9_KERNEL_BASE}/${kdir}" ]
+ then
+ continue
+ fi
+
case "$kdir" in
*-obj)
;;
@@ -176,6 +185,72 @@
done
}
+validate_target()
+{
+ DIR="$1"
+ ARCH="$2"
+ types="$3"
+ for type in $types
+ do
+ KVER="`verfromdir "${SLES9_KERNEL_BASE}/${kdir}/${ARCH}/${type}"`"
+ if ! validate_dir "$KVER" "$kdir/${ARCH}/${type}"
+ then
+ return 1
+ fi
+ done
+
+ return 0
+}
+
+find_targets()
+{
+ ARCH="$(guess_sles9_arch)"
+ if [ -z "$ARCH" ]
+ then
+ return
+ fi
+
+ types=
+ for typelist in $SLES9_KERNEL_TYPES
+ do
+ TARCH=$(echo $typelist | cut -f1 -d:)
+ if [ "$TARCH" = "$ARCH" ]
+ then
+ types=$(echo $typelist | cut -f2 -d: | sed -e 's/,/ /g')
+ break
+ fi
+ done
+
+ if [ -z "$types" ]
+ then
+ return
+ fi
+
+ ls -1 -t "$SLES9_KERNEL_BASE" | while read kdir
+ do
+ # Avoid the symlinks
+ if [ -L "${SLES9_KERNEL_BASE}/${kdir}" -o ! -d "${SLES9_KERNEL_BASE}/${kdir}" ]
+ then
+ continue
+ fi
+ case "$kdir" in
+ linux-*-obj)
+ if validate_target "$kdir" "$ARCH" "$types"
+ then
+ KVER="${kdir#linux-}"
+ KVER="${KVER%-obj}"
+ if rpm -q "kernel-syms-${KVER}" 1>/dev/null 2>&1
+ then
+ echo "sles9_${KVER}_rpm"
+ fi
+ fi
+ ;;
+ *)
+ ;;
+ esac
+ done
+}
+
case "$1" in
include|build)
if [ -n "$2" ]
@@ -199,6 +274,7 @@
fi
;;
targets)
+ find_targets
;;
"")
echo "Missing operation" >&2
More information about the Oracleasm-commits
mailing list