Re: [Qemu-devel] [PATCHv2 1/4] linux-headers: update to 3.6-rc3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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@xxxxxxxxxx>
> >>>> ---
> >>>>  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@xxxxxxxxxx>

--

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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux