kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Allow to override sync source
@ 2009-05-14 20:38 Jan Kiszka
  2009-05-17 19:31 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2009-05-14 20:38 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]

In order to allow sync'ing the kmod dir against arbitrary kernels trees,
extend the sync script to accept alternative paths and adjust the
Makefile accordingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 Makefile |    3 ++-
 sync     |   14 +++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 1e0420e..dad5f0b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ ORIGMODDIR = $(patsubst %/build,%/kernel,$(KERNELDIR))
 
 rpmrelease = devel
 
+KVM_VERSION = kvm-devel
 LINUX = ./linux-2.6
 
 ifeq ($(EXT_CONFIG_KVM_TRACE),y)
@@ -38,7 +39,7 @@ include $(MAKEFILE_PRE)
 .PHONY: sync
 
 sync:
-	./sync $(KVM_VERSION)
+	./sync -v $(KVM_VERSION) -l $(LINUX)
 
 install:
 	mkdir -p $(DESTDIR)/$(INSTALLDIR)
diff --git a/sync b/sync
index 4a89296..2e53a31 100755
--- a/sync
+++ b/sync
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, os, glob, os.path, shutil, re
+from optparse import OptionParser
 
 glob = glob.glob
 
@@ -8,12 +9,19 @@ def cmd(c):
     if os.system(c) != 0:
         raise Exception('command execution failed: ' + c)
 
-version = 'kvm-devel'
-if len(sys.argv) >= 2:
-    version = sys.argv[1]
+parser = OptionParser(usage='usage: %prog [-v version][-l linuxkernel]')
+parser.add_option('-v', action='store', type='string', dest='version')
+parser.add_option('-l', action='store', type='string', dest='linux')
+(options, args) = parser.parse_args()
 
+version = 'kvm-devel'
 linux = 'linux-2.6'
 
+if options.version:
+    version = options.version
+if options.linux:
+    linux = options.linux
+
 _re_cache = {}
 
 def re_cache(regexp):


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow to override sync source
  2009-05-14 20:38 [PATCH] Allow to override sync source Jan Kiszka
@ 2009-05-17 19:31 ` Avi Kivity
  2009-05-18  9:01   ` [PATCH v2] " Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2009-05-17 19:31 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm-devel

Jan Kiszka wrote:
> In order to allow sync'ing the kmod dir against arbitrary kernels trees,
> extend the sync script to accept alternative paths and adjust the
> Makefile accordingly.
>
> @@ -17,6 +17,7 @@ ORIGMODDIR = $(patsubst %/build,%/kernel,$(KERNELDIR))
>  
>  rpmrelease = devel
>  
> +KVM_VERSION = kvm-devel
>  LINUX = ./linux-2.6
>   

You're overriding ./configure here.  What was the motivation?

>  
> -version = 'kvm-devel'
> -if len(sys.argv) >= 2:
> -    version = sys.argv[1]
> +parser = OptionParser(usage='usage: %prog [-v version][-l linuxkernel]')
> +parser.add_option('-v', action='store', type='string', dest='version')
> +parser.add_option('-l', action='store', type='string', dest='linux')
>   

Please add help, and spaces around '='.

> +(options, args) = parser.parse_args()
>  
> +version = 'kvm-devel'
>  linux = 'linux-2.6'
>  
> +if options.version:
> +    version = options.version
> +if options.linux:
> +    linux = options.linux
> +
>   

Can replace this with set_defaults().

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] Allow to override sync source
  2009-05-17 19:31 ` Avi Kivity
@ 2009-05-18  9:01   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2009-05-18  9:01 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

Avi Kivity wrote:
> Jan Kiszka wrote:
>> In order to allow sync'ing the kmod dir against arbitrary kernels trees,
>> extend the sync script to accept alternative paths and adjust the
>> Makefile accordingly.
>>
>> @@ -17,6 +17,7 @@ ORIGMODDIR = $(patsubst %/build,%/kernel,$(KERNELDIR))
>>  
>>  rpmrelease = devel
>>  
>> +KVM_VERSION = kvm-devel
>>  LINUX = ./linux-2.6
>>   
> 
> You're overriding ./configure here.  What was the motivation?

I missed that this is provided via configure - dropped again.

> 
>>  
>> -version = 'kvm-devel'
>> -if len(sys.argv) >= 2:
>> -    version = sys.argv[1]
>> +parser = OptionParser(usage='usage: %prog [-v version][-l linuxkernel]')
>> +parser.add_option('-v', action='store', type='string', dest='version')
>> +parser.add_option('-l', action='store', type='string', dest='linux')
>>   
> 
> Please add help, and spaces around '='.

OK.

> 
>> +(options, args) = parser.parse_args()
>>  
>> +version = 'kvm-devel'
>>  linux = 'linux-2.6'
>>  
>> +if options.version:
>> +    version = options.version
>> +if options.linux:
>> +    linux = options.linux
>> +
>>   
> 
> Can replace this with set_defaults().
> 

Nice. Done below.

---------->

In order to allow sync'ing the kmod dir against arbitrary kernels trees,
extend the sync script to accept alternative paths and adjust the
Makefile accordingly.

Changes in v2:
 - drop KVM_VERSION override
 - make use of set_defaults
 - option help texts

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 Makefile |    2 +-
 sync     |   16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index a8e8e0b..8bd5b9b 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ include $(MAKEFILE_PRE)
 .PHONY: sync
 
 sync:
-	./sync $(KVM_VERSION)
+	./sync -v $(KVM_VERSION) -l $(LINUX)
 
 install:
 	mkdir -p $(DESTDIR)/$(INSTALLDIR)
diff --git a/sync b/sync
index 4a89296..f3f4d6a 100755
--- a/sync
+++ b/sync
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, os, glob, os.path, shutil, re
+from optparse import OptionParser
 
 glob = glob.glob
 
@@ -8,11 +9,16 @@ def cmd(c):
     if os.system(c) != 0:
         raise Exception('command execution failed: ' + c)
 
-version = 'kvm-devel'
-if len(sys.argv) >= 2:
-    version = sys.argv[1]
-
-linux = 'linux-2.6'
+parser = OptionParser(usage = 'usage: %prog [-v VERSION][-l LINUX]')
+parser.add_option('-v', action = 'store', type = 'string', dest = 'version', \
+                  help = 'kvm-kmod release version', default = 'kvm-devel')
+parser.add_option('-l', action = 'store', type = 'string', dest = 'linux', \
+                  help = 'Linux kernel tree to sync from', \
+                  default = 'linux-2.6')
+parser.set_defaults()
+(options, args) = parser.parse_args()
+version = options.version
+linux = options.linux
 
 _re_cache = {}
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-18  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14 20:38 [PATCH] Allow to override sync source Jan Kiszka
2009-05-17 19:31 ` Avi Kivity
2009-05-18  9:01   ` [PATCH v2] " Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).