All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Anthony Liguori <anthony@codemonkey.ws>,
	"avi@redhat.com" <avi@redhat.com>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>,
	"gleb@redhat.com" <gleb@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCHv2 1/4] linux-headers: update to 3.6-rc3
Date: Mon, 27 Aug 2012 21:48:29 +0300	[thread overview]
Message-ID: <20120827184829.GA7025@redhat.com> (raw)
In-Reply-To: <503B8B5C.2010907@siemens.com>

On Mon, Aug 27, 2012 at 04:59:40PM +0200, Jan Kiszka wrote:
> On 2012-08-27 16:53, Michael S. Tsirkin wrote:
> > On Mon, Aug 27, 2012 at 02:48:57PM +0200, Jan Kiszka wrote:
> >> On 2012-08-27 14:42, Peter Maydell wrote:
> >>> On 27 August 2012 13:20, Michael S. Tsirkin <mst@redhat.com> wrote:
> >>>> Update linux-headers to version present in Linux 3.6-rc3.
> >>>> Header asm-x96_64/kvm_para.h update is needed for the new PV EOI
> >>>> feature.
> >>>>
> >>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >>>> ---
> >>>>  linux-headers/asm-s390/kvm.h      | 2 +-
> >>>>  linux-headers/asm-s390/kvm_para.h | 2 +-
> >>>>  linux-headers/asm-x86/kvm.h       | 1 +
> >>>>  linux-headers/asm-x86/kvm_para.h  | 7 +++++++
> >>>>  linux-headers/linux/kvm.h         | 3 +++
> >>>>  5 files changed, 13 insertions(+), 2 deletions(-)
> >>>
> >>> The latest version of update-linux-headers.sh should have caused
> >>> this update to include asm-generic/kvm_para.h, I think. Did the
> >>> script not pull that header in, or were you maybe using an old
> >>> version of the script or forgot to git add the new file?
> >>
> >> To be fair, that is hard to guess. We should add some magic to the
> >> update script to detect new files and maybe suggest them for addition.
> >>
> >> Jan
> > 
> > But why did you add a header to qemu without adding it
> > to git? That's a cleaner solution and needs no magic scripting.
> 
> Yes, this would have been appropriate. Still, a simple "git status -s
> linux-headers" run at the end of the update script can help reminding
> people in the future.
> 
> Jan


Yes. But it would be better if instead of duplicating
a list of files/directories, update-linux-headers.sh would
just look at what is under linux-headers and update
exactly that.

This removes any chance of error, and avoids the need
to tweak shell scripts each time we add a header.

As a bonus we do not blow away random stuff
developer might have under linux-headers.
Thoughts?
WFM

--->

scripts: better update headers

Be more careful when updating headers: only
update files we already have in git.
Also remove need to list files in this script.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

--

diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 9d2a4bc..6607e56 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -28,23 +28,33 @@ if [ -z "$output" ]; then
     output="$PWD"
 fi
 
-for arch in x86 powerpc s390; do
-    make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install
-
-    rm -rf "$output/linux-headers/asm-$arch"
-    mkdir -p "$output/linux-headers/asm-$arch"
-    for header in kvm.h kvm_para.h; do
-        cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
-    done
-    if [ $arch = x86 ]; then
-        cp "$tmpdir/include/asm/hyperv.h" "$output/linux-headers/asm-x86"
-    fi
-done
+IFS=$'\n'
+
+#get list of files
+dirs=`git ls-tree HEAD -- linux-headers/|grep tree|cut -f 2`
+if [ -z "$dirs" ]; then
+    echo "Unable to get list of directories under linux-headers/ to update"
+fi
 
-rm -rf "$output/linux-headers/linux"
-mkdir -p "$output/linux-headers/linux"
-for header in kvm.h kvm_para.h vhost.h virtio_config.h virtio_ring.h; do
-    cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
+for d in $dirs; do
+    a=${d/#linux-headers\//}
+    case "$a" in
+        asm-*)
+            arch=${a/asm-/}
+            make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install
+            files=`git ls-tree -r HEAD -- "$d" |cut -f 2`
+            for dst in $files; do
+                src=include/asm/${dst/linux-headers\/asm-$arch\//}
+                cp -f "$tmpdir/$src" "$output/$dst" || exit 2
+            done ;;
+        *) 
+            make -C "$linux" INSTALL_HDR_PATH="$tmpdir" headers_install
+            files=`git ls-tree -r HEAD -- "$d" |cut -f 2`
+            for dst in $files; do
+                src=include/${dst/linux-headers\//}
+                cp -f "$tmpdir/$src" "$output/$dst" || exit 2
+            done ;;
+    esac
 done
 if [ -L "$linux/source" ]; then
     cp "$linux/source/COPYING" "$output/linux-headers"
-- 
MST

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"gleb@redhat.com" <gleb@redhat.com>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"avi@redhat.com" <avi@redhat.com>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [PATCHv2 1/4] linux-headers: update to 3.6-rc3
Date: Mon, 27 Aug 2012 21:48:29 +0300	[thread overview]
Message-ID: <20120827184829.GA7025@redhat.com> (raw)
In-Reply-To: <503B8B5C.2010907@siemens.com>

On Mon, Aug 27, 2012 at 04:59:40PM +0200, Jan Kiszka wrote:
> On 2012-08-27 16:53, Michael S. Tsirkin wrote:
> > On Mon, Aug 27, 2012 at 02:48:57PM +0200, Jan Kiszka wrote:
> >> On 2012-08-27 14:42, Peter Maydell wrote:
> >>> On 27 August 2012 13:20, Michael S. Tsirkin <mst@redhat.com> wrote:
> >>>> Update linux-headers to version present in Linux 3.6-rc3.
> >>>> Header asm-x96_64/kvm_para.h update is needed for the new PV EOI
> >>>> feature.
> >>>>
> >>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >>>> ---
> >>>>  linux-headers/asm-s390/kvm.h      | 2 +-
> >>>>  linux-headers/asm-s390/kvm_para.h | 2 +-
> >>>>  linux-headers/asm-x86/kvm.h       | 1 +
> >>>>  linux-headers/asm-x86/kvm_para.h  | 7 +++++++
> >>>>  linux-headers/linux/kvm.h         | 3 +++
> >>>>  5 files changed, 13 insertions(+), 2 deletions(-)
> >>>
> >>> The latest version of update-linux-headers.sh should have caused
> >>> this update to include asm-generic/kvm_para.h, I think. Did the
> >>> script not pull that header in, or were you maybe using an old
> >>> version of the script or forgot to git add the new file?
> >>
> >> To be fair, that is hard to guess. We should add some magic to the
> >> update script to detect new files and maybe suggest them for addition.
> >>
> >> Jan
> > 
> > But why did you add a header to qemu without adding it
> > to git? That's a cleaner solution and needs no magic scripting.
> 
> Yes, this would have been appropriate. Still, a simple "git status -s
> linux-headers" run at the end of the update script can help reminding
> people in the future.
> 
> Jan


Yes. But it would be better if instead of duplicating
a list of files/directories, update-linux-headers.sh would
just look at what is under linux-headers and update
exactly that.

This removes any chance of error, and avoids the need
to tweak shell scripts each time we add a header.

As a bonus we do not blow away random stuff
developer might have under linux-headers.
Thoughts?
WFM

--->

scripts: better update headers

Be more careful when updating headers: only
update files we already have in git.
Also remove need to list files in this script.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

--

diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 9d2a4bc..6607e56 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -28,23 +28,33 @@ if [ -z "$output" ]; then
     output="$PWD"
 fi
 
-for arch in x86 powerpc s390; do
-    make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install
-
-    rm -rf "$output/linux-headers/asm-$arch"
-    mkdir -p "$output/linux-headers/asm-$arch"
-    for header in kvm.h kvm_para.h; do
-        cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
-    done
-    if [ $arch = x86 ]; then
-        cp "$tmpdir/include/asm/hyperv.h" "$output/linux-headers/asm-x86"
-    fi
-done
+IFS=$'\n'
+
+#get list of files
+dirs=`git ls-tree HEAD -- linux-headers/|grep tree|cut -f 2`
+if [ -z "$dirs" ]; then
+    echo "Unable to get list of directories under linux-headers/ to update"
+fi
 
-rm -rf "$output/linux-headers/linux"
-mkdir -p "$output/linux-headers/linux"
-for header in kvm.h kvm_para.h vhost.h virtio_config.h virtio_ring.h; do
-    cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
+for d in $dirs; do
+    a=${d/#linux-headers\//}
+    case "$a" in
+        asm-*)
+            arch=${a/asm-/}
+            make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install
+            files=`git ls-tree -r HEAD -- "$d" |cut -f 2`
+            for dst in $files; do
+                src=include/asm/${dst/linux-headers\/asm-$arch\//}
+                cp -f "$tmpdir/$src" "$output/$dst" || exit 2
+            done ;;
+        *) 
+            make -C "$linux" INSTALL_HDR_PATH="$tmpdir" headers_install
+            files=`git ls-tree -r HEAD -- "$d" |cut -f 2`
+            for dst in $files; do
+                src=include/${dst/linux-headers\//}
+                cp -f "$tmpdir/$src" "$output/$dst" || exit 2
+            done ;;
+    esac
 done
 if [ -L "$linux/source" ]; then
     cp "$linux/source/COPYING" "$output/linux-headers"
-- 
MST

  reply	other threads:[~2012-08-27 18:47 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-27 12:20 [PATCHv2 0/4] migrate PV EOI MSR Michael S. Tsirkin
2012-08-27 12:20 ` [Qemu-devel] " Michael S. Tsirkin
2012-08-27 12:20 ` [PATCHv2 1/4] linux-headers: update to 3.6-rc3 Michael S. Tsirkin
2012-08-27 12:20   ` [Qemu-devel] " Michael S. Tsirkin
2012-08-27 12:42   ` Peter Maydell
2012-08-27 12:42     ` Peter Maydell
2012-08-27 12:48     ` Jan Kiszka
2012-08-27 12:48       ` Jan Kiszka
2012-08-27 14:53       ` Michael S. Tsirkin
2012-08-27 14:53         ` Michael S. Tsirkin
2012-08-27 14:59         ` Jan Kiszka
2012-08-27 14:59           ` [Qemu-devel] " Jan Kiszka
2012-08-27 18:48           ` Michael S. Tsirkin [this message]
2012-08-27 18:48             ` Michael S. Tsirkin
2012-08-27 14:50     ` Michael S. Tsirkin
2012-08-27 14:50       ` Michael S. Tsirkin
2012-08-27 12:20 ` [PATCHv2 2/4] pc: refactor compat code Michael S. Tsirkin
2012-08-27 12:20   ` [Qemu-devel] " Michael S. Tsirkin
2012-08-28 16:23   ` Marcelo Tosatti
2012-08-28 16:23     ` [Qemu-devel] " Marcelo Tosatti
2012-08-28 16:31     ` Michael S. Tsirkin
2012-08-28 16:31       ` [Qemu-devel] " Michael S. Tsirkin
2012-08-28 16:37       ` Marcelo Tosatti
2012-08-28 16:37         ` [Qemu-devel] " Marcelo Tosatti
2012-08-28 21:29         ` Michael S. Tsirkin
2012-08-28 21:29           ` [Qemu-devel] " Michael S. Tsirkin
2012-08-27 12:20 ` [PATCHv2 3/4] cpuid: disable pv eoi for 1.1 and older compat types Michael S. Tsirkin
2012-08-27 12:20   ` [Qemu-devel] " Michael S. Tsirkin
2012-08-27 18:58   ` Blue Swirl
2012-08-27 18:58     ` [Qemu-devel] " Blue Swirl
2012-08-27 19:06     ` Michael S. Tsirkin
2012-08-27 19:06       ` Michael S. Tsirkin
2012-08-27 19:12       ` Blue Swirl
2012-08-27 19:12         ` Blue Swirl
2012-08-27 19:24         ` Michael S. Tsirkin
2012-08-27 19:24           ` Michael S. Tsirkin
2012-08-27 19:40           ` Blue Swirl
2012-08-27 19:40             ` Blue Swirl
2012-08-28 15:46             ` Michael S. Tsirkin
2012-08-28 15:46               ` Michael S. Tsirkin
2012-08-28 17:02               ` malc
2012-08-28 17:02                 ` malc
2012-08-28 21:50                 ` Michael S. Tsirkin
2012-08-28 21:50                   ` [Qemu-devel] " Michael S. Tsirkin
2012-08-28 19:13   ` Anthony Liguori
2012-08-28 19:13     ` [Qemu-devel] " Anthony Liguori
2012-08-28 19:40     ` Eduardo Habkost
2012-08-28 19:40       ` [Qemu-devel] " Eduardo Habkost
2012-08-28 21:41       ` Michael S. Tsirkin
2012-08-28 21:41         ` Michael S. Tsirkin
2012-08-28 21:40     ` Michael S. Tsirkin
2012-08-28 21:40       ` [Qemu-devel] " Michael S. Tsirkin
2012-08-27 12:20 ` [PATCHv2 4/4] kvm: get/set PV EOI MSR Michael S. Tsirkin
2012-08-27 12:20   ` [Qemu-devel] " Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120827184829.GA7025@redhat.com \
    --to=mst@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.