Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKernel Build Daemon <kbuild@suse.de>2015-04-23 07:14:46 +0200
committerKernel Build Daemon <kbuild@suse.de>2015-04-23 07:14:46 +0200
commit51a0d8810aead58c9b4e1b8e04df1cfaf5071654 (patch)
treefbbc8582ce4dd713d9550ecb74fb63d903b9e71a
parentf051a5e0a6efc30260bc865812c79e63d2f05b86 (diff)
parent424ce42b97fc91de291bff7854e97f13b0520372 (diff)
Merge branch 'SLE11-SP3' into SLE11-SP4
-rwxr-xr-xscripts/check-patch39
-rwxr-xr-xscripts/check-patchfmt96
-rwxr-xr-xscripts/osc_wrapper10
-rwxr-xr-xscripts/refresh97
-rwxr-xr-xscripts/run_oldconfig.sh48
-rwxr-xr-xscripts/sequence-patch.sh23
6 files changed, 173 insertions, 140 deletions
diff --git a/scripts/check-patch b/scripts/check-patch
index bd7171186e..a104f55ee3 100755
--- a/scripts/check-patch
+++ b/scripts/check-patch
@@ -31,22 +31,6 @@ usage()
echo " $0 --stdin [--relaxed] [name]"
}
-# Extract the header of a patch
-patch_header()
-{
- local patch_file=$1
-
- /usr/bin/gawk '
- /^--- / { exit }
- /^Index:[ \t]|^diff[ \t]|^==*$|^RCS file: |^retrieving revision [0-9]+(\.[0-9]+)*$/ \
- { eat = eat $0 "\n"
- next }
- { print eat $0
- eat = "" }
- ' "$patch_file"
-}
-
-
moan()
{
echo "$*" >&2
@@ -56,7 +40,7 @@ moan()
check_patch()
{
local filename=$1 content=$2
- local header="$(patch_header "$content")"
+ local header="$(sed '/^--- /,$ d' "$content")"
local required_headers="Subject From"
if ! $relaxed; then
@@ -114,6 +98,19 @@ while :; do
esac
done
+# We might be called via a symlink in .git/hooks
+for f in scripts/check-patchfmt ../scripts/check-patchfmt ${0%/*}/check-patchfmt
+do
+ if test -x "$f"; then
+ check2=$f
+ break
+ fi
+done
+if test -z "$check2"; then
+ echo "Warning: could not find scripts/check-patchfmt" >&2
+ check2=:
+fi
+
bad=0
if $stdin; then
case $# in
@@ -132,6 +129,9 @@ if $stdin; then
trap "rm -f $content" EXIT
cat >"$content"
check_patch "$filename" "$content"
+ if ! $check2 --stdin "$filename" <"$content" && ! $relaxed; then
+ bad=2
+ fi
else
if test $# -eq 0; then
echo "No patches given" >&2
@@ -140,10 +140,13 @@ else
fi
for filename in "$@"; do
check_patch "$filename" "$filename"
+ if ! $check2 "$filename" && ! $relaxed; then
+ bad=2
+ fi
done
fi
-if test $bad -gt 0; then
+if test $bad -eq 1; then
echo "For more information, see the Patch Headers chapter in the README file." >&2
fi
diff --git a/scripts/check-patchfmt b/scripts/check-patchfmt
new file mode 100755
index 0000000000..2763737ae1
--- /dev/null
+++ b/scripts/check-patchfmt
@@ -0,0 +1,96 @@
+#!/usr/bin/perl
+
+#############################################################################
+# Copyright (c) 2015 Micro Focus
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, contact Novell, Inc.
+#
+# To contact Novell about this file by physical or electronic mail,
+# you may find current contact information at www.novell.com
+#############################################################################
+
+# Check that the a patch is in the format produced by scripts/refresh_patch.sh
+
+use strict;
+use warnings;
+
+my $errors = 0;
+my %reported;
+our $file;
+
+sub err {
+ return if ($reported{"$file:$_[0]"}++);
+ print STDERR "$file:$.: error: @_\n";
+ $errors = 1;
+}
+
+sub check_filename {
+ my $filename = shift;
+
+ if ($filename !~ m:^(/dev/null\b|[ab]/):) {
+ err("Patch not in -p ab format");
+ }
+ if ($filename =~ /\s\S/) {
+ err("Timestamp after filename");
+ }
+}
+
+sub do_patch {
+ my $fh = shift;
+ my @prev = ("", "", "");
+
+ while (my $cur = <$fh>) {
+ chomp($cur);
+ next unless ($cur =~ /^\+\+\+ /);
+ next if ($prev[0] !~ /^--- /);
+ (my $new = $cur) =~ s/^\+\+\+ //;
+ (my $old = $prev[0]) =~ s/^--- //;
+ check_filename($new);
+ check_filename($old);
+ if ($prev[1] =~ /^={20}/ && $prev[2] =~ /^Index: /) {
+ err("Superfluous Index: line in patch");
+ }
+ } continue {
+ unshift(@prev, $cur);
+ if (scalar(@prev) > 3) {
+ pop(@prev);
+ }
+ }
+}
+
+if (!@ARGV) {
+ die "Usage: $0 <patch>...\n";
+}
+if ($ARGV[0] eq "--stdin") {
+ shift;
+ $file = "<stdin>";
+ if (scalar(@ARGV)) {
+ $file = $ARGV[0];
+ }
+ open(my $fh, '-');
+ do_patch($fh);
+ close($fh);
+} else {
+ for $file (@ARGV) {
+ open(my $fh, '<', $file) or die "$file: $!\n";
+ do_patch($fh);
+ close($fh);
+ }
+}
+
+if ($errors) {
+ printf STDERR ("Please refresh the patch%s using scripts/refresh_patch.sh\n", (scalar(@ARGV) > 1 ? "es" : ""));
+ exit(1);
+}
+exit(0);
diff --git a/scripts/osc_wrapper b/scripts/osc_wrapper
index af522f62c1..811d1f4ff0 100755
--- a/scripts/osc_wrapper
+++ b/scripts/osc_wrapper
@@ -43,9 +43,15 @@ try_spec()
find_spec()
{
- local spec
+ local spec machine=$(uname -m)
- case $(uname -m) in
+ case "$machine" in
+ i?86 | x86_64)
+ if try_spec kernel-smp.spec; then
+ return 0
+ fi
+ esac
+ case "$machine" in
i?86)
if try_spec kernel-pae.spec; then
return 0
diff --git a/scripts/refresh b/scripts/refresh
deleted file mode 100755
index ce8895ee22..0000000000
--- a/scripts/refresh
+++ /dev/null
@@ -1,97 +0,0 @@
-#! /bin/sh
-
-# Extract the description of a patch.
-patch_description() {
- local patch_file=$1
-
- if [ -e "$patch_file" -o -z "$patch_file" ]
- then
- awk '
- $1 == "***" || $1 == "---" { exit }
- /^Index:[ \t]|^diff[ \t]|^==*$/ \
- { eat = eat $0 "\n"
- next }
- { print eat $0
- eat = "" }
- ' $patch_file
- fi
-}
-
-usage() {
- echo "Usage: ${0##*/} <patch> <tree-1> [<tree-2>]"
- exit 2
-}
-
-if [ $# -lt 2 -o $# -gt 3 ]; then
- usage
-fi
-
-patch=$1
-
-if [ ! -d "$2" ]; then
- echo "$2 is not a directory" >&2
- exit 1
-fi
-
-if [ $# -eq 2 ]; then
- if [ -d "$2.orig" ]; then
- tree1=$2.orig
- tree2=$2
- label=$tree2
- elif [ -d "${2%.*}.orig" ]; then
- tree1=${2%.*}.orig
- tree2=$2
- label=${tree2%.*}
- elif [ -d "${2%.*}" ]; then
- tree1=${2%.*}
- tree2=$2
- label=${2%.*}
- else
- echo "Could not guess name of second tree" >&2
- exit 1
- fi
-else
- if [ ! -d "$3" ]; then
- echo "$3 is not a directory" >&2
- exit 1
- fi
- tree1=$2
- tree2=$3
-fi
-
-if [ "$tree1" -ef "$tree2" ]; then
- echo "$tree1 and $tree2 are the same directory" >&2
- exit 1
-fi
-
-tree1=${tree1%/}
-tree2=${tree2%/}
-
-basename=${patch##*/}
-dir=${patch%/*}
-if [ "$basename" = "$patch" ]; then
- dir=.
-fi
-
-tmp=$(mktemp "$dir/.$basename.XXXXXX")
-trap 'rm -f $tmp' EXIT
-
-if [ -f "$patch" ]; then
- echo "Refreshing patch $patch ($tree1 => $tree2)"
- patch_description $patch > $tmp
-else
- echo "Creating patch $patch ($tree1 => $tree2)"
-fi
-
-# escape slashes
-re_tree1=${tree1//\//\\\/}
-re_tree2=${tree2//\//\\\/}
-re_label=${label//\//\\\/}
-
-EXCLUDE="--exclude='*.orig' --exclude='*.rej' --exclude='*~'"
-diff -Nur -p $EXCLUDE "$tree1" "$tree2" \
-| sed -e "s/^diff .* $re_tree1\/\(.*\) $re_tree2.*/Index: \1\n===================================================================/" \
- -e "s/^--- $re_tree1\([^$'\t']*\).*/--- $label.orig\1/" \
- -e "s/^+++ $re_tree2\([^$'\t']*\).*/+++ $label\1/" \
->> "$tmp"
-cat "$tmp" > "$patch"
diff --git a/scripts/run_oldconfig.sh b/scripts/run_oldconfig.sh
index 7ac6af99f7..505bfc1eaa 100755
--- a/scripts/run_oldconfig.sh
+++ b/scripts/run_oldconfig.sh
@@ -23,7 +23,7 @@
#########################################################
# dirty scroll region tricks ...
-use_region=0
+use_region=false
function _region_init_ () {
echo -ne '\x1b[H\033[J' # clear screen
@@ -39,7 +39,10 @@ function _region_fini_ () {
function _region_msg_ () {
local msg="$*"
- if test "$use_region" != "0"; then
+ if $silent; then
+ return
+ fi
+ if $use_region; then
echo -ne '\x1b7' # save cursor
echo -ne '\x1b[0;0H' # move cursor
echo -e "##\x1b[K" # message
@@ -53,6 +56,14 @@ function _region_msg_ () {
fi
}
+info()
+{
+ if $silent; then
+ return
+ fi
+ echo "$@"
+}
+
set_var()
{
local name=$1 val=$2 config config_files
@@ -64,10 +75,10 @@ set_var()
esac
config_files=$(${prefix}scripts/guards $CONFIG_SYMBOLS < ${prefix}config.conf)
if [ -n "$set_flavor" ] ; then
- echo "appending $name=$val to all -$set_flavor config files listed in config.conf"
+ info "appending $name=$val to all -$set_flavor config files listed in config.conf"
config_files=$(printf "%s\n" $config_files | grep "/$set_flavor\$")
else
- echo "appending $name=$val to all config files listed in config.conf"
+ info "appending $name=$val to all config files listed in config.conf"
fi
for config in $config_files; do
if test -L "${prefix}config/$config"; then
@@ -84,7 +95,9 @@ set_var()
function _cleanup_() {
test -d "$TMPDIR" && rm -rf $TMPDIR
- test "$use_region" != 0 && _region_fini_
+ if $use_region; then
+ _region_fini_
+ fi
}
TMPDIR=
trap _cleanup_ EXIT
@@ -96,6 +109,7 @@ cpu_arch=
mode=oldconfig
option=
value=
+silent=false
until [ "$#" = "0" ] ; do
case "$1" in
y|-y|--yes)
@@ -140,12 +154,16 @@ until [ "$#" = "0" ] ; do
set_flavor="vanilla"
shift
;;
+ -s|--silent)
+ silent=true
+ shift
+ ;;
-h|--help)
cat <<EOF
${0##*/} does either:
* run make oldconfig to clean up the .config files
- * modify kernel .config files in the CVS tree
+ * modify kernel .config files in the GIT tree
run it with no options in your SCRATCH_AREA $SCRATCH_AREA, like
patches/scripts/${0##*/}
@@ -169,6 +187,8 @@ FOO
FOO=X
CONFIG_FOO
CONFIG_FOO=X
+
+Run with -s|--silent in both modes to suppress most output
EOF
exit 1
;;
@@ -215,8 +235,10 @@ menuconfig)
*)
case "$TERM" in
linux* | xterm* | screen*)
- use_region=1
- _region_init_
+ if tty -s && ! $silent; then
+ use_region=true
+ _region_init_
+ fi
esac
esac
@@ -336,6 +358,9 @@ for config in $config_files; do
MAKE_ARGS="ARCH=$cpu_arch"
;;
esac
+ if $silent; then
+ MAKE_ARGS="$MAKE_ARGS -s"
+ fi
config="${prefix}config/$config"
cat $config | \
@@ -349,7 +374,7 @@ for config in $config_files; do
> .config
for f in $TMPDIR/reuse/{all,$cpu_arch-all,all-$flavor}; do
if test -e "$f"; then
- echo "Reusing choice for ${f##*/}"
+ info "Reusing choice for ${f##*/}"
cat "$f" >>.config
fi
done
@@ -375,7 +400,8 @@ for config in $config_files; do
make $MAKE_ARGS oldconfig
esac
ask_reuse_config $config .config
- if ! diff -U0 $config .config; then
- sed '/^# Linux kernel version:/d' < .config > $config
+ if ! $silent; then
+ diff -U0 $config .config
fi
+ cp .config $config
done
diff --git a/scripts/sequence-patch.sh b/scripts/sequence-patch.sh
index 48fdc65b15..759a2e6987 100755
--- a/scripts/sequence-patch.sh
+++ b/scripts/sequence-patch.sh
@@ -307,11 +307,18 @@ if test -z "$CONFIG"; then
if test "$VANILLA_ONLY" = 1 || $VANILLA; then
CONFIG=$(uname -m)-vanilla
else
- CONFIG=$(uname -m)-default
- case "$CONFIG" in
- i?86-*)
- CONFIG=i386-pae
+ machine=$(uname -m)
+ case "$machine" in
+ i?86)
+ machine=i386
esac
+ if test -e "config/$machine/smp"; then
+ CONFIG=$machine-smp
+ elif test -e "config/$machine/pae"; then
+ CONFIG=$machine-pae
+ else
+ CONFIG=$machine-default
+ fi
fi
fi
@@ -374,14 +381,6 @@ if [ ! -r series.conf ]; then
echo "Configuration file \`series.conf' not found"
exit 1
fi
-if [ -e scripts/check-patches ]; then
- scripts/check-patches || {
- echo "Inconsistencies found."
- echo "Please clean up series.conf and/or the patches directories!"
- read
- }
-fi
-
if $have_arch_patches; then
if [ -z "$ARCH_SYMBOLS" ]; then
if [ -x ./arch-symbols ]; then