Hello Michal-
Goldwyn, Petr and I were talking about how it is a bit time consuming to
add a quick fix to an osc branch of the kernel source and make sure the
.changes is updated and patches added to the tar ball.
So, I wrote a quick script based on scripts/log.sh that can ease this
workflow to look like this:
$ osc branch openSUSE:11.3/kernel-source
$ osc co home:philipsb:branches:openSUSE:11.3:Update:Test/kernel-source
$ mv ~/linux-2.6/driver-fix-for-something.patch .
$ vim series.conf # add patch to series.conf
$ ./log.sh
$ osc commit
The nice thing about this workflow is that it makes it easy to create a
quick testing Kernel based on a couple of patches without having to use
the git repo. I have used osc_wrapper, which is really great, but it
requires some knowledge of how our branches and tags work to checkout
the right tree to apply your patch on.
I guess it would need to be added to the rpm/ directory so it was
accessible from an osc checkout. Obviously we could figure out a way of
sharing code with scripts/log.sh.
What do you think?
Thanks,
Brandon
From 4dd13769f5b75aea1c16c796ce98c6c23b920458 Mon Sep 17 00:00:00 2001
From: Brandon Philips
Date: Mon, 19 Jul 2010 05:03:30 -0700
Subject: [PATCH] scripts: rpm/log.sh to create an osc branch workflow
Add a nice workflow for adding a patch or two to an osc branch of the
kernel.
$ osc co home:philipsb:branches:openSUSE:11.3:Update:Test/kernel-source
$ mv ~/linux-2.6/driver-fix-for-something.patch .
$ vim series.conf # add patch to series.conf
$ ./log.sh
$ osc commit
Signed-off-by: Brandon Philips
---
rpm/log.sh | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 170 insertions(+), 0 deletions(-)
create mode 100755 rpm/log.sh
diff --git a/rpm/log.sh b/rpm/log.sh
new file mode 100755
index 0000000..39f03e0
--- /dev/null
+++ b/rpm/log.sh
@@ -0,0 +1,170 @@
+#! /bin/sh
+
+#############################################################################
+# Copyright (c) 2004-2006,2008,2009 Novell, Inc.
+# 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
+#############################################################################
+
+# Construct a changes entry and commit log from a patch.
+
+if ! $using_git; then
+ echo "ERROR: not in a git working directory."
+ exit 1
+fi
+
+CHANGES=kernel-source.changes
+
+trap 'rm -rf "$tmpdir"' EXIT
+tmpdir=$(mktemp -d /tmp/${0##*/}.XXXXXX)
+message=$tmpdir/message
+
+log_entry() {
+ local entry=$1
+
+ echo "$entry" \
+ | fmt --width 65 \
+ | sed -e '1s/^/- /' -e '2,$s/^/ /' \
+ >> $message
+}
+
+
+patch_meta() {
+ local patch=$1
+
+ subject=$(formail -c -x Subject < "$patch" \
+ | sed -e 's, *\[[#/ A-Za-z0-9-]*\],,')
+ subject=${subject## }
+ subject=${subject%.}
+
+ set -- $(formail -c -x References -x Reference < "$patch")
+ references="$*"
+}
+
+patch_log_entry() {
+ local patch=$1 subject references old_subj old_ref old_patch="$tmpdir/old"
+
+ git show "HEAD:$patch" >"$old_patch" 2>/dev/null
+ patch_meta "$old_patch"
+ old_subj="$subject"
+ old_ref="$references"
+
+ patch_meta "$patch"
+
+ local msg
+ if test -z "$subject" -o "$subject" != "$old_subj"; then
+ msg="$subject${references:+ ($references)}"
+ elif test "$references" != "$old_ref"; then
+ if test -n "$references"; then
+ msg="Update references ($references)"
+ fi
+ else
+ msg="Refresh"
+ fi
+
+ log_entry "$patch: $msg${msg:+.}"
+}
+
+find_patches() {
+ osc diff series.conf \
+ | sed -n "s/^+\s*\(patches.*\)/\1/p"
+}
+
+for file in "$@" $(find_patches); do
+ dirname=$(dirname $file)
+ basename=$(basename $file)
+ archive=$dirname.tar.bz2
+
+ if [ ! -f $basename ]; then
+ echo "ERROR: $basename added to series.conf but doesn't exist in $PWD"
+ exit 1
+ fi
+
+ if [ ! -d $dirname ]; then
+ tar xvf $archive
+ fi
+
+ mv $basename $dirname
+ rm $archive
+ tar cfj $archive $dirname
+
+ files[${#files[@]}]=$file
+done
+
+if [ ${#files[@]} -eq 0 ]; then
+ echo "No modified files" >&2
+ exit 1
+fi
+
+for file in "${files[@]}"; do
+ if [ "${file:0:1}" = - ]; then
+ log_entry "${file:1}: Delete."
+ else
+ case "$file" in
+ config/*)
+ if [ -z "$configs_updated" ]; then
+ log_entry "Update config files."
+ configs_updated=1
+ fi
+ ;;
+
+ patches.*)
+ patch_log_entry "$file"
+ ;;
+
+ kabi/*/symvers-* | kabi/*/symtypes-* | kabi/*/symsets-* )
+ if [ -z "$symvers_updated" ]; then
+ log_entry "Update reference module symbol versions."
+ symvers_updated=1
+ fi
+ ;;
+
+ series.conf)
+ # don't log changes in there
+ ;;
+
+ *)
+ log_entry "$file: "
+ ;;
+ esac
+ fi
+done
+
+if [ ! -s $message ]; then
+ echo "- " >> $message
+fi
+
+if [ -z "$VC" ]; then
+ VC=vc
+ for search in $HOME/bin /work/src/bin scripts; do
+ if [ -x $search/$VC ]; then
+ VC=$search/$VC
+ break
+ fi
+ done
+fi
+
+if $VC $CHANGES $message; then
+ entry=$(sed -ne '1,2d' -e '/^--*$/!p' -e '/^--*$/q' $CHANGES)
+ entry=${entry##$'\n'}
+ entry=${entry%%$'\n'}
+fi
+
+for c in ls *.changes; do
+ [ $c = $CHANGES ] && continue
+ cp $CHANGES $c
+done
--
1.7.1
--
To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-kernel+help@opensuse.org