rpms/kernel/devel built-in-where, 1.3, 1.4 find-provides, 1.3, 1.4 make-symsets, 1.3, 1.4

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed May 31 00:42:25 UTC 2006


Author: davej

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv23854

Added Files:
	built-in-where find-provides make-symsets 
Log Message:
bring back new scripts, this time with +x



Index: built-in-where
===================================================================
RCS file: built-in-where
diff -N built-in-where
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ built-in-where	31 May 2006 00:42:21 -0000	1.4
@@ -0,0 +1,32 @@
+#! /bin/bash
+
+# A lot of symbols are exported by the main kernel image. Find out
+# more precisely which built-in.o file defines them, and fill in
+# that information in Module.symvers. (The built-in.o files are
+# linked to gether form one or more object files in a directory.)
+#   We use this information to better group symbols by subsystems.
+#
+# Usage: built-in-where < Module.symvers
+
+unset LANG ${!LC_*}
+
+# Create a table of all symbol export in a built-in.o file, e.g.,
+#   mtrr_add	arch/i386/kernel/cpu/mtrr/built-in
+built_in_exports() {
+   for obj in $(find -name built-in.o -printf '%P\n'); do
+	nm $obj \
+	| sed -nre 's:(00000000)?([0-9a-f]+) A __crc_(.*):\3\t'"${obj%.o}:p"
+    done
+}
+
+# Join together the two tables, including all lines from the first
+# file that don't have a match in the second. Finally remove the
+# duplicate column.
+join -t $'\t' -1 2 -2 1 -a 1 \
+    <(sort -k2) \
+    <(built_in_exports | sort -k1) \
+| awk '
+BEGIN	{ FS = "\t" ; OFS = "\t" }
+NF == 3	{ print $2, $1, $3 }
+NF == 4	{ print $2, $1, $4 }
+'


Index: find-provides
===================================================================
RCS file: find-provides
diff -N find-provides
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ find-provides	31 May 2006 00:42:21 -0000	1.4
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+IFS=$'\n'
+filelist=($(cat))
+
+printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/find-provides "$@"
+
+for file in "${filelist[@]}"; do
+    case "$file" in
+    */symsets-*.tar.gz)
+	for symset in $(tar tfz "$file" | grep -v '/$'); do
+	    class=${symset##*/} ; class=${class%.*}
+	    echo "kernel($class) = ${symset##*.}"
+	done
+	;;
+   esac
+done


Index: make-symsets
===================================================================
RCS file: make-symsets
diff -N make-symsets
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ make-symsets	31 May 2006 00:42:21 -0000	1.4
@@ -0,0 +1,89 @@
+#! /bin/bash
+
+unset LANG ${!LC_*}
+
+# Usage: make-symsets symsets.tar.gz [old-symsets.tar.gz]
+#            < symvers.gz
+#
+# symsets.tar.gz
+#   Create this symbol set tarball.
+#
+# old-symsets.tar.gz
+#   Reuse all possible symbol sets from this tarball.
+
+tarball=$1
+old_tarball=$2
+
+# Classify all the symbols by the directory they live in
+unset ${!class_*}
+while read class line; do
+    class=class_${class//[^a-zA-Z0-9_]/_}
+    eval "$class[\${#$class[@]}]=\"$line\""
+done < <(
+    awk '
+    BEGIN { FS="\t" ; OFS="\t" }
+    { class=$3
+      sub(/\/[^/]+$/, "", class)
+      print class, $0
+    }
+    '
+)
+
+tmpdir=$(mktemp -t -d ${0##*/}.XXXXXX)
+trap "rm -rf $tmpdir" EXIT
+
+basename=$(basename ${tarball:-.} .tar.gz)
+
+# Save all the new sets, computer and output their hashes
+newdir=$tmpdir/new/$basename
+mkdir -p $newdir
+for class in ${!class_*} ; do
+    class=${class#class_}
+    eval "printf \"%s\\n\" \"\${class_$class[@]}\"" \
+    | sort -k2 \
+    > $newdir/tmp
+    set -- $(md5sum $newdir/tmp) ; set -- ${1:0:16}
+    mv $newdir/tmp $newdir/$class.$1
+    #echo "Provides: kernel($class) = $1"
+done
+
+if [ -n "$old_tarball" ]; then
+    # Reuse all sets of symbols from the old tarball that are
+    # still the same.
+    basename=$(basename $old_tarball .tar.gz)
+
+    olddir=$tmpdir/old/$basename
+    mkdir -p $tmpdir/old
+    zcat $old_tarball \
+    | tar xf - -C $tmpdir/old
+    if [ ! -d $olddir ]; then
+	echo "$old_tarball does not contain directory $basename"
+	exit 1
+    fi
+
+    shopt -s nullglob
+    for oldset in $olddir/* ; do
+	[ -e $newdir/${oldset#$olddir/} ] && continue
+	class=${oldset##*/} ; class=${class%.*}
+	set -- $newdir/$class.*
+	[ $# -eq 1 ] || continue
+	newset=$1
+	# '*' doesn't occur in either file.
+	if [ -z "$(join -t '*' -j 1 -v 1 "$oldset" "$newset")" ]; then
+	    keep_oldset[${#keep_oldset[@]}]=$oldset
+	    #echo "Provides: kernel($class) = ${oldset##*.}"
+	fi
+    done
+
+    if [ ${#keep_oldset[@]} -gt 0 ]; then
+	mv "${keep_oldset[@]}" $newdir/
+    fi
+fi
+
+# Store the generated sets in $tarball
+tar cf - -C $tmpdir/new $basename \
+| gzip -9 \
+> $tarball \
+|| exit 1
+
+# vim:shiftwidth=4 softtabstop=4




More information about the fedora-cvs-commits mailing list