* [PATCH] allow building spice from git
@ 2011-06-26 19:55 Alon Levy
2011-06-26 19:55 ` [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd Alon Levy
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Alon Levy @ 2011-06-26 19:55 UTC (permalink / raw)
To: autotest; +Cc: kvm
Hi,
These patches refactor the kvm_installer and add two repositories, spice-protocol
and spice.
I'm not sure what the best way is to achieve the next points I need to do:
1. Installing pre built qxl drivers into images. I'd assume there is already support for
installing virtio? is the unattended install for windows used for that?
2. Running a spice client. Is there already support for running some long lived
process while a vm is running, and controlling it?
I would possibly like to also build qxl drivers - it is doable from linux using
wine and ddk, and possibly with mingw (the former I already use). Is something
similar being done for virtio drivers?
Alon Levy (4):
kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd
kvm_installer: introduce GitRepo helper class
kvm_installer: build spice from git
client/tests/kvm/build.cfg.sample: add commented spice parameters
client/tests/kvm/build.cfg.sample | 8 ++
client/virt/kvm_installer.py | 188 +++++++++++++++++++------------------
client/virt/kvm_vm.py | 3 +
3 files changed, 106 insertions(+), 93 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd
2011-06-26 19:55 [PATCH] allow building spice from git Alon Levy
@ 2011-06-26 19:55 ` Alon Levy
2011-06-28 1:50 ` Lucas Meneghel Rodrigues
2011-06-28 1:56 ` Lucas Meneghel Rodrigues
2011-06-26 19:55 ` [PATCH] kvm_installer: introduce GitRepo helper class Alon Levy
` (4 subsequent siblings)
5 siblings, 2 replies; 11+ messages in thread
From: Alon Levy @ 2011-06-26 19:55 UTC (permalink / raw)
To: autotest; +Cc: kvm
build/lib can contain libspice-server.so built from git.
---
client/virt/kvm_vm.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 3fa4b1a..48a1fc5 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -403,6 +403,9 @@ class VM(virt_vm.BaseVM):
# Set the X11 display parameter if requested
if params.get("x11_display"):
qemu_cmd += "DISPLAY=%s " % params.get("x11_display")
+ # Update LD_LIBRARY_PATH for built libraries (libspice-server)
+ qemu_cmd += "LD_LIBRARY_PATH=%s " % (
+ os.path.abspath(os.path.join(self.root_dir, 'build/lib')))
# Add the qemu binary
qemu_cmd += qemu_binary
# Add the VM's name
--
1.7.5.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] kvm_installer: introduce GitRepo helper class
2011-06-26 19:55 [PATCH] allow building spice from git Alon Levy
2011-06-26 19:55 ` [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd Alon Levy
@ 2011-06-26 19:55 ` Alon Levy
2011-06-28 1:52 ` Lucas Meneghel Rodrigues
2011-06-26 19:55 ` [PATCH] kvm_installer: build spice from git Alon Levy
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Alon Levy @ 2011-06-26 19:55 UTC (permalink / raw)
To: autotest; +Cc: kvm
Will allow adding further git repositories more easily later.
---
client/virt/kvm_installer.py | 163 ++++++++++++++++++-----------------------
1 files changed, 72 insertions(+), 91 deletions(-)
diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py
index 54829f4..df47fc0 100644
--- a/client/virt/kvm_installer.py
+++ b/client/virt/kvm_installer.py
@@ -598,6 +598,38 @@ class SourceDirInstaller(BaseInstaller):
if self.save_results:
virt_installer.save_build(self.srcdir, self.results_dir)
+class GitRepo(object):
+ def __init__(self, installer, prefix,
+ srcdir, build_steps=[], repo_param=None):
+ params = installer.params
+ self.installer = installer
+ self.repo = params.get(repo_param or (prefix + '_repo'))
+ self.branch = params.get(prefix + '_branch', 'master')
+ self.lbranch = params.get(prefix + '_lbranch', 'master')
+ self.commit = params.get(prefix + '_commit', None)
+ self.patches = params.get(prefix + '_patches', [])
+ self.build_steps = build_steps
+ self.srcdir = os.path.join(self.installer.srcdir, srcdir)
+
+
+ def fetch_and_patch(self):
+ if not self.repo:
+ return
+ virt_utils.get_git_branch(self.repo, self.branch, self.srcdir,
+ self.commit, self.lbranch)
+ os.chdir(self.srcdir)
+ for patch in self.patches:
+ utils.get_file(patch, os.path.join(self.srcdir,
+ os.path.basename(patch)))
+ utils.system('patch -p1 < %s' % os.path.basename(patch))
+
+
+ def build(self):
+ os.chdir(self.srcdir)
+ for step in self.build_steps:
+ logging.info(step)
+ utils.run(step)
+
class GitInstaller(SourceDirInstaller):
def _pull_code(self):
@@ -605,120 +637,69 @@ class GitInstaller(SourceDirInstaller):
Retrieves code from git repositories.
"""
params = self.params
+ make_jobs = utils.count_cpus()
+ cfg = 'PKG_CONFIG_PATH="%s/lib/pkgconfig:%s/share/pkgconfig" ./configure' % (
+ self.prefix, self.prefix)
- kernel_repo = params.get("git_repo")
- user_repo = params.get("user_git_repo")
- kmod_repo = params.get("kmod_repo")
+ self.kernel = GitRepo(installer=self, prefix='kernel',
+ repo_param='git_repo', srcdir='kvm')
+ self.kmod = GitRepo(installer=self, prefix='kmod', srcdir="kvm_kmod")
+ if params.get('kernel_git_repo'):
+ cfg += ' --kerneldir=%s' % self.host_kernel_srcdir
+ self.kernel.build_steps = [cfg,
+ 'make clean',
+ 'make -C kernel LINUX=%s sync' % self.kernel.srcdir]
+ self.kmod.build_steps=[cfg,
+ 'make clean',
+ 'make sync LINUX=%s' % self.kernel.srcdir,
+ 'make']
- kernel_branch = params.get("kernel_branch", "master")
- user_branch = params.get("user_branch", "master")
- kmod_branch = params.get("kmod_branch", "master")
+ self.userspace = GitRepo(installer=self, prefix='user',
+ repo_param='user_git_repo', srcdir='kvm_userspace')
- kernel_lbranch = params.get("kernel_lbranch", "master")
- user_lbranch = params.get("user_lbranch", "master")
- kmod_lbranch = params.get("kmod_lbranch", "master")
+ p = os.path.join(self.userspace.srcdir, 'configure')
+ self.configure_options = virt_installer.check_configure_options(p)
- kernel_commit = params.get("kernel_commit", None)
- user_commit = params.get("user_commit", None)
- kmod_commit = params.get("kmod_commit", None)
+ cfg = cfg + ' --prefix=%s' % self.prefix
+ if "--disable-strip" in self.configure_options:
+ cfg += ' --disable-strip'
+ if self.extra_configure_options:
+ cfg += ' %s' % self.extra_configure_options
- kernel_patches = eval(params.get("kernel_patches", "[]"))
- user_patches = eval(params.get("user_patches", "[]"))
- kmod_patches = eval(params.get("user_patches", "[]"))
+ self.userspace.build_steps=[cfg, 'make clean', 'make -j %s' % make_jobs]
- if not user_repo:
+ if not self.userspace.repo:
message = "KVM user git repository path not specified"
logging.error(message)
raise error.TestError(message)
- userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
- virt_utils.get_git_branch(user_repo, user_branch, userspace_srcdir,
- user_commit, user_lbranch)
- self.userspace_srcdir = userspace_srcdir
-
- if user_patches:
- os.chdir(self.userspace_srcdir)
- for patch in user_patches:
- utils.get_file(patch, os.path.join(self.userspace_srcdir,
- os.path.basename(patch)))
- utils.system('patch -p1 < %s' % os.path.basename(patch))
-
- if kernel_repo:
- kernel_srcdir = os.path.join(self.srcdir, "kvm")
- virt_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir,
- kernel_commit, kernel_lbranch)
- self.kernel_srcdir = kernel_srcdir
- if kernel_patches:
- os.chdir(self.kernel_srcdir)
- for patch in kernel_patches:
- utils.get_file(patch, os.path.join(self.userspace_srcdir,
- os.path.basename(patch)))
- utils.system('patch -p1 < %s' % os.path.basename(patch))
- else:
- self.kernel_srcdir = None
-
- if kmod_repo:
- kmod_srcdir = os.path.join (self.srcdir, "kvm_kmod")
- virt_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir,
- kmod_commit, kmod_lbranch)
- self.kmod_srcdir = kmod_srcdir
- if kmod_patches:
- os.chdir(self.kmod_srcdir)
- for patch in kmod_patches:
- utils.get_file(patch, os.path.join(self.userspace_srcdir,
- os.path.basename(patch)))
- utils.system('patch -p1 < %s' % os.path.basename(patch))
- else:
- self.kmod_srcdir = None
-
- p = os.path.join(self.userspace_srcdir, 'configure')
- self.configure_options = virt_installer.check_configure_options(p)
-
+ for repo in [self.userspace, self.kernel, self.kmod]:
+ if not repo.repo:
+ continue
+ repo.fetch_and_patch()
def _build(self):
- make_jobs = utils.count_cpus()
- cfg = './configure'
- if self.kmod_srcdir:
+ if self.kmod.repo:
logging.info('Building KVM modules')
- os.chdir(self.kmod_srcdir)
- module_build_steps = [cfg,
- 'make clean',
- 'make sync LINUX=%s' % self.kernel_srcdir,
- 'make']
- elif self.kernel_srcdir:
+ self.kmod.build()
+ elif self.kernel.repo:
logging.info('Building KVM modules')
- os.chdir(self.userspace_srcdir)
- cfg += ' --kerneldir=%s' % self.host_kernel_srcdir
- module_build_steps = [cfg,
- 'make clean',
- 'make -C kernel LINUX=%s sync' % self.kernel_srcdir]
- else:
- module_build_steps = []
+ self.kernel.build()
- for step in module_build_steps:
- utils.run(step)
logging.info('Building KVM userspace code')
- os.chdir(self.userspace_srcdir)
- cfg += ' --prefix=%s' % self.prefix
- if "--disable-strip" in self.configure_options:
- cfg += ' --disable-strip'
- if self.extra_configure_options:
- cfg += ' %s' % self.extra_configure_options
- utils.system(cfg)
- utils.system('make clean')
- utils.system('make -j %s' % make_jobs)
+ self.userspace.build()
def _install(self):
- if self.kernel_srcdir:
- os.chdir(self.userspace_srcdir)
+ if self.kernel:
+ os.chdir(self.userspace.srcdir)
# the kernel module install with --prefix doesn't work, and DESTDIR
# wouldn't work for the userspace stuff, so we clear WANT_MODULE:
utils.system('make install WANT_MODULE=')
# and install the old-style-kmod modules manually:
- self._install_kmods_old_userspace(self.userspace_srcdir)
- elif self.kmod_srcdir:
+ self._install_kmods_old_userspace(self.userspace.srcdir)
+ elif self.kmod:
# if we have a kmod repository, it is easier:
# 1) install userspace:
os.chdir(self.userspace_srcdir)
@@ -728,7 +709,7 @@ class GitInstaller(SourceDirInstaller):
else:
# if we don't have kmod sources, we just install
# userspace:
- os.chdir(self.userspace_srcdir)
+ os.chdir(self.userspace.srcdir)
utils.system('make install')
if self.path_to_roms:
--
1.7.5.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] kvm_installer: build spice from git
2011-06-26 19:55 [PATCH] allow building spice from git Alon Levy
2011-06-26 19:55 ` [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd Alon Levy
2011-06-26 19:55 ` [PATCH] kvm_installer: introduce GitRepo helper class Alon Levy
@ 2011-06-26 19:55 ` Alon Levy
2011-06-26 19:55 ` [PATCH] client/tests/kvm/build.cfg.sample: add commented spice parameters Alon Levy
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Alon Levy @ 2011-06-26 19:55 UTC (permalink / raw)
To: autotest; +Cc: kvm
---
client/virt/kvm_installer.py | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py
index df47fc0..b7f6291 100644
--- a/client/virt/kvm_installer.py
+++ b/client/virt/kvm_installer.py
@@ -654,6 +654,20 @@ class GitInstaller(SourceDirInstaller):
'make sync LINUX=%s' % self.kernel.srcdir,
'make']
+ self.spice_protocol = GitRepo(installer=self, prefix='spice_protocol',
+ srcdir='spice-protocol',
+ build_steps= ['./autogen.sh',
+ './configure --prefix=%s' % self.prefix,
+ 'make clean',
+ 'make -j %s' % (make_jobs),
+ 'make install'])
+
+ self.spice = GitRepo(installer=self, prefix='spice', srcdir='spice',
+ build_steps= ['PKG_CONFIG_PATH="%s/lib/pkgconfig:%s/share/pkgconfig" CXXFLAGS=-Wl,--add-needed ./autogen.sh --prefix=%s' % (self.prefix, self.prefix, self.prefix),
+ 'make clean',
+ 'make -j %s' % (make_jobs),
+ 'make install'])
+
self.userspace = GitRepo(installer=self, prefix='user',
repo_param='user_git_repo', srcdir='kvm_userspace')
@@ -673,7 +687,7 @@ class GitInstaller(SourceDirInstaller):
logging.error(message)
raise error.TestError(message)
- for repo in [self.userspace, self.kernel, self.kmod]:
+ for repo in [self.userspace, self.kernel, self.kmod, self.spice_protocol, self.spice]:
if not repo.repo:
continue
repo.fetch_and_patch()
@@ -686,6 +700,13 @@ class GitInstaller(SourceDirInstaller):
logging.info('Building KVM modules')
self.kernel.build()
+ if self.spice_protocol.repo:
+ logging.info('Building Spice-protocol')
+ self.spice_protocol.build()
+
+ if self.spice.repo:
+ logging.info('Building Spice')
+ self.spice.build()
logging.info('Building KVM userspace code')
self.userspace.build()
--
1.7.5.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] client/tests/kvm/build.cfg.sample: add commented spice parameters
2011-06-26 19:55 [PATCH] allow building spice from git Alon Levy
` (2 preceding siblings ...)
2011-06-26 19:55 ` [PATCH] kvm_installer: build spice from git Alon Levy
@ 2011-06-26 19:55 ` Alon Levy
2011-06-26 20:05 ` [PATCH] allow building spice from git Alon Levy
2011-06-26 23:49 ` Lucas Meneghel Rodrigues
5 siblings, 0 replies; 11+ messages in thread
From: Alon Levy @ 2011-06-26 19:55 UTC (permalink / raw)
To: autotest; +Cc: kvm
---
client/tests/kvm/build.cfg.sample | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/client/tests/kvm/build.cfg.sample b/client/tests/kvm/build.cfg.sample
index a43c0e9..245ffb6 100644
--- a/client/tests/kvm/build.cfg.sample
+++ b/client/tests/kvm/build.cfg.sample
@@ -78,6 +78,14 @@ variants:
# kmod_lbranch = kmod_lbranch_name
# kmod_commit = kmod_commit_name
# kmod_patches = ['http://foo.com/patch1', 'http://foo.com/patch2']
+ # spice_repo = git://anongit.freedesktop.org/spice/spice
+ # spice_branch = master
+ # spice_lbranch = master
+ # spice_patches = []
+ # spice_protocol_repo = git://anongit.freedesktop.org/spice/spice-protocol
+ # spice_protocol_branch = master
+ # spice_protocol_lbranch = master
+ # spice_protocol_patches = []
# In some cases, you might want to provide a ROM dir, so ROM
# files can be copied from there to your source based install
# path_to_rom_images = /usr/share/kvm
--
1.7.5.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] allow building spice from git
@ 2011-06-26 20:04 Alon Levy
0 siblings, 0 replies; 11+ messages in thread
From: Alon Levy @ 2011-06-26 20:04 UTC (permalink / raw)
To: autotest; +Cc: kvm
Hi,
These patches refactor the kvm_installer and add two repositories, spice-protocol
and spice.
I'm not sure what the best way is to achieve the next points I need to do:
1. Installing pre built qxl drivers into images. I'd assume there is already support for
installing virtio? is the unattended install for windows used for that?
2. Running a spice client. Is there already support for running some long lived
process while a vm is running, and controlling it?
I would possibly like to also build qxl drivers - it is doable from linux using
wine and ddk, and possibly with mingw (the former I already use). Is something
similar being done for virtio drivers?
Alon Levy (4):
kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd
kvm_installer: introduce GitRepo helper class
kvm_installer: build spice from git
client/tests/kvm/build.cfg.sample: add commented spice parameters
client/tests/kvm/build.cfg.sample | 8 ++
client/virt/kvm_installer.py | 188 +++++++++++++++++++------------------
client/virt/kvm_vm.py | 3 +
3 files changed, 106 insertions(+), 93 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] allow building spice from git
2011-06-26 19:55 [PATCH] allow building spice from git Alon Levy
` (3 preceding siblings ...)
2011-06-26 19:55 ` [PATCH] client/tests/kvm/build.cfg.sample: add commented spice parameters Alon Levy
@ 2011-06-26 20:05 ` Alon Levy
2011-06-26 23:49 ` Lucas Meneghel Rodrigues
5 siblings, 0 replies; 11+ messages in thread
From: Alon Levy @ 2011-06-26 20:05 UTC (permalink / raw)
To: autotest; +Cc: kvm
On Sun, Jun 26, 2011 at 09:55:20PM +0200, Alon Levy wrote:
Sent before confirming my registration to autotest, am sending again, sorry
for the double post.
> Hi,
>
> These patches refactor the kvm_installer and add two repositories, spice-protocol
> and spice.
>
> I'm not sure what the best way is to achieve the next points I need to do:
>
> 1. Installing pre built qxl drivers into images. I'd assume there is already support for
> installing virtio? is the unattended install for windows used for that?
>
> 2. Running a spice client. Is there already support for running some long lived
> process while a vm is running, and controlling it?
>
> I would possibly like to also build qxl drivers - it is doable from linux using
> wine and ddk, and possibly with mingw (the former I already use). Is something
> similar being done for virtio drivers?
>
> Alon Levy (4):
> kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd
> kvm_installer: introduce GitRepo helper class
> kvm_installer: build spice from git
> client/tests/kvm/build.cfg.sample: add commented spice parameters
>
> client/tests/kvm/build.cfg.sample | 8 ++
> client/virt/kvm_installer.py | 188 +++++++++++++++++++------------------
> client/virt/kvm_vm.py | 3 +
> 3 files changed, 106 insertions(+), 93 deletions(-)
>
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] allow building spice from git
2011-06-26 19:55 [PATCH] allow building spice from git Alon Levy
` (4 preceding siblings ...)
2011-06-26 20:05 ` [PATCH] allow building spice from git Alon Levy
@ 2011-06-26 23:49 ` Lucas Meneghel Rodrigues
5 siblings, 0 replies; 11+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-06-26 23:49 UTC (permalink / raw)
To: Alon Levy; +Cc: autotest, kvm
Hi Alon!
On Sun, Jun 26, 2011 at 4:55 PM, Alon Levy <alevy@redhat.com> wrote:
> Hi,
>
> These patches refactor the kvm_installer and add two repositories, spice-protocol
> and spice.
>
> I'm not sure what the best way is to achieve the next points I need to do:
>
> 1. Installing pre built qxl drivers into images. I'd assume there is already support for
> installing virtio? is the unattended install for windows used for that?
Yes, there is. I need to do some documentation on how to enable the
virtio drivers install. I haven't so far because it involves some
setup that we can't easily automate. Will fix this.
For more details, we work from the assumption there is a virtio
drivers cd with the virtio drivers, then:
1) For Win XP, 2003: We put viostor and netKVM drivers on the
unattended floppy and inform on the unattended install file where to
find those drivers.
2) For Win 2008 and later: We just point on the unattended install
file the paths on the virtio cd where the drivers are.
In both cases, we do it in a way that the windows installer knows
where to find and install the drivers.
> 2. Running a spice client. Is there already support for running some long lived
> process while a vm is running, and controlling it?
Yes, aexpect is precisely this mechanism. The qemu instances are run
on an aexpect subprocess, that outlives tests and can be controlled
and checked for output. We also use this for controlling tcpdump
instances and other userspace programs.
>
> I would possibly like to also build qxl drivers - it is doable from linux using
> wine and ddk, and possibly with mingw (the former I already use). Is something
> similar being done for virtio drivers?
Well, no, but I'll be happy to help adding this support. rss.exe and
finish.exe are already generated using mingw, however, we ship binary
versions of it on the autotest tree because they are small and save
yet-another-complicated-setup for users.
--
Lucas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd
2011-06-26 19:55 ` [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd Alon Levy
@ 2011-06-28 1:50 ` Lucas Meneghel Rodrigues
2011-06-28 1:56 ` Lucas Meneghel Rodrigues
1 sibling, 0 replies; 11+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-06-28 1:50 UTC (permalink / raw)
To: Alon Levy; +Cc: autotest, kvm
On Sun, Jun 26, 2011 at 4:55 PM, Alon Levy <alevy@redhat.com> wrote:
> build/lib can contain libspice-server.so built from git.
> ---
> client/virt/kvm_vm.py | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
> index 3fa4b1a..48a1fc5 100644
> --- a/client/virt/kvm_vm.py
> +++ b/client/virt/kvm_vm.py
> @@ -403,6 +403,9 @@ class VM(virt_vm.BaseVM):
> # Set the X11 display parameter if requested
> if params.get("x11_display"):
> qemu_cmd += "DISPLAY=%s " % params.get("x11_display")
> + # Update LD_LIBRARY_PATH for built libraries (libspice-server)
> + qemu_cmd += "LD_LIBRARY_PATH=%s " % (
> + os.path.abspath(os.path.join(self.root_dir, 'build/lib')))
^ Better to check whether the lib directory actually exists before
trying to append LD_LIBRARY_PATH to the command. This details, and
some other on the following paths were fixed in the version that went
upstream.
Thanks Alon!
> # Add the qemu binary
> qemu_cmd += qemu_binary
> # Add the VM's name
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Lucas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kvm_installer: introduce GitRepo helper class
2011-06-26 19:55 ` [PATCH] kvm_installer: introduce GitRepo helper class Alon Levy
@ 2011-06-28 1:52 ` Lucas Meneghel Rodrigues
0 siblings, 0 replies; 11+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-06-28 1:52 UTC (permalink / raw)
To: Alon Levy; +Cc: autotest, kvm
On Sun, Jun 26, 2011 at 4:55 PM, Alon Levy <alevy@redhat.com> wrote:
> Will allow adding further git repositories more easily later.
> ---
> client/virt/kvm_installer.py | 163 ++++++++++++++++++-----------------------
> 1 files changed, 72 insertions(+), 91 deletions(-)
>
> diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py
> index 54829f4..df47fc0 100644
> --- a/client/virt/kvm_installer.py
> +++ b/client/virt/kvm_installer.py
> @@ -598,6 +598,38 @@ class SourceDirInstaller(BaseInstaller):
> if self.save_results:
> virt_installer.save_build(self.srcdir, self.results_dir)
>
> +class GitRepo(object):
> + def __init__(self, installer, prefix,
> + srcdir, build_steps=[], repo_param=None):
> + params = installer.params
> + self.installer = installer
> + self.repo = params.get(repo_param or (prefix + '_repo'))
> + self.branch = params.get(prefix + '_branch', 'master')
> + self.lbranch = params.get(prefix + '_lbranch', 'master')
> + self.commit = params.get(prefix + '_commit', None)
> + self.patches = params.get(prefix + '_patches', [])
^ Here as the config system gives us strings rather than python data
types, we have to eval the string that comes from it. Fixed on the
version that went upstream.
> + self.build_steps = build_steps
> + self.srcdir = os.path.join(self.installer.srcdir, srcdir)
> +
> +
> + def fetch_and_patch(self):
> + if not self.repo:
> + return
> + virt_utils.get_git_branch(self.repo, self.branch, self.srcdir,
> + self.commit, self.lbranch)
> + os.chdir(self.srcdir)
> + for patch in self.patches:
> + utils.get_file(patch, os.path.join(self.srcdir,
> + os.path.basename(patch)))
> + utils.system('patch -p1 < %s' % os.path.basename(patch))
> +
> +
> + def build(self):
> + os.chdir(self.srcdir)
> + for step in self.build_steps:
> + logging.info(step)
> + utils.run(step)
> +
>
> class GitInstaller(SourceDirInstaller):
> def _pull_code(self):
> @@ -605,120 +637,69 @@ class GitInstaller(SourceDirInstaller):
> Retrieves code from git repositories.
> """
> params = self.params
> + make_jobs = utils.count_cpus()
> + cfg = 'PKG_CONFIG_PATH="%s/lib/pkgconfig:%s/share/pkgconfig" ./configure' % (
> + self.prefix, self.prefix)
>
> - kernel_repo = params.get("git_repo")
> - user_repo = params.get("user_git_repo")
> - kmod_repo = params.get("kmod_repo")
> + self.kernel = GitRepo(installer=self, prefix='kernel',
> + repo_param='git_repo', srcdir='kvm')
> + self.kmod = GitRepo(installer=self, prefix='kmod', srcdir="kvm_kmod")
> + if params.get('kernel_git_repo'):
> + cfg += ' --kerneldir=%s' % self.host_kernel_srcdir
> + self.kernel.build_steps = [cfg,
> + 'make clean',
> + 'make -C kernel LINUX=%s sync' % self.kernel.srcdir]
> + self.kmod.build_steps=[cfg,
> + 'make clean',
> + 'make sync LINUX=%s' % self.kernel.srcdir,
> + 'make']
>
> - kernel_branch = params.get("kernel_branch", "master")
> - user_branch = params.get("user_branch", "master")
> - kmod_branch = params.get("kmod_branch", "master")
> + self.userspace = GitRepo(installer=self, prefix='user',
> + repo_param='user_git_repo', srcdir='kvm_userspace')
>
> - kernel_lbranch = params.get("kernel_lbranch", "master")
> - user_lbranch = params.get("user_lbranch", "master")
> - kmod_lbranch = params.get("kmod_lbranch", "master")
> + p = os.path.join(self.userspace.srcdir, 'configure')
> + self.configure_options = virt_installer.check_configure_options(p)
>
> - kernel_commit = params.get("kernel_commit", None)
> - user_commit = params.get("user_commit", None)
> - kmod_commit = params.get("kmod_commit", None)
> + cfg = cfg + ' --prefix=%s' % self.prefix
> + if "--disable-strip" in self.configure_options:
> + cfg += ' --disable-strip'
> + if self.extra_configure_options:
> + cfg += ' %s' % self.extra_configure_options
>
> - kernel_patches = eval(params.get("kernel_patches", "[]"))
> - user_patches = eval(params.get("user_patches", "[]"))
> - kmod_patches = eval(params.get("user_patches", "[]"))
> + self.userspace.build_steps=[cfg, 'make clean', 'make -j %s' % make_jobs]
>
> - if not user_repo:
> + if not self.userspace.repo:
> message = "KVM user git repository path not specified"
> logging.error(message)
> raise error.TestError(message)
>
> - userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
> - virt_utils.get_git_branch(user_repo, user_branch, userspace_srcdir,
> - user_commit, user_lbranch)
> - self.userspace_srcdir = userspace_srcdir
> -
> - if user_patches:
> - os.chdir(self.userspace_srcdir)
> - for patch in user_patches:
> - utils.get_file(patch, os.path.join(self.userspace_srcdir,
> - os.path.basename(patch)))
> - utils.system('patch -p1 < %s' % os.path.basename(patch))
> -
> - if kernel_repo:
> - kernel_srcdir = os.path.join(self.srcdir, "kvm")
> - virt_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir,
> - kernel_commit, kernel_lbranch)
> - self.kernel_srcdir = kernel_srcdir
> - if kernel_patches:
> - os.chdir(self.kernel_srcdir)
> - for patch in kernel_patches:
> - utils.get_file(patch, os.path.join(self.userspace_srcdir,
> - os.path.basename(patch)))
> - utils.system('patch -p1 < %s' % os.path.basename(patch))
> - else:
> - self.kernel_srcdir = None
> -
> - if kmod_repo:
> - kmod_srcdir = os.path.join (self.srcdir, "kvm_kmod")
> - virt_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir,
> - kmod_commit, kmod_lbranch)
> - self.kmod_srcdir = kmod_srcdir
> - if kmod_patches:
> - os.chdir(self.kmod_srcdir)
> - for patch in kmod_patches:
> - utils.get_file(patch, os.path.join(self.userspace_srcdir,
> - os.path.basename(patch)))
> - utils.system('patch -p1 < %s' % os.path.basename(patch))
> - else:
> - self.kmod_srcdir = None
> -
> - p = os.path.join(self.userspace_srcdir, 'configure')
> - self.configure_options = virt_installer.check_configure_options(p)
> -
> + for repo in [self.userspace, self.kernel, self.kmod]:
> + if not repo.repo:
> + continue
> + repo.fetch_and_patch()
>
> def _build(self):
> - make_jobs = utils.count_cpus()
> - cfg = './configure'
> - if self.kmod_srcdir:
> + if self.kmod.repo:
> logging.info('Building KVM modules')
> - os.chdir(self.kmod_srcdir)
> - module_build_steps = [cfg,
> - 'make clean',
> - 'make sync LINUX=%s' % self.kernel_srcdir,
> - 'make']
> - elif self.kernel_srcdir:
> + self.kmod.build()
> + elif self.kernel.repo:
> logging.info('Building KVM modules')
> - os.chdir(self.userspace_srcdir)
> - cfg += ' --kerneldir=%s' % self.host_kernel_srcdir
> - module_build_steps = [cfg,
> - 'make clean',
> - 'make -C kernel LINUX=%s sync' % self.kernel_srcdir]
> - else:
> - module_build_steps = []
> + self.kernel.build()
>
> - for step in module_build_steps:
> - utils.run(step)
>
> logging.info('Building KVM userspace code')
> - os.chdir(self.userspace_srcdir)
> - cfg += ' --prefix=%s' % self.prefix
> - if "--disable-strip" in self.configure_options:
> - cfg += ' --disable-strip'
> - if self.extra_configure_options:
> - cfg += ' %s' % self.extra_configure_options
> - utils.system(cfg)
> - utils.system('make clean')
> - utils.system('make -j %s' % make_jobs)
> + self.userspace.build()
>
>
> def _install(self):
> - if self.kernel_srcdir:
> - os.chdir(self.userspace_srcdir)
> + if self.kernel:
> + os.chdir(self.userspace.srcdir)
> # the kernel module install with --prefix doesn't work, and DESTDIR
> # wouldn't work for the userspace stuff, so we clear WANT_MODULE:
> utils.system('make install WANT_MODULE=')
> # and install the old-style-kmod modules manually:
> - self._install_kmods_old_userspace(self.userspace_srcdir)
> - elif self.kmod_srcdir:
> + self._install_kmods_old_userspace(self.userspace.srcdir)
> + elif self.kmod:
> # if we have a kmod repository, it is easier:
> # 1) install userspace:
> os.chdir(self.userspace_srcdir)
> @@ -728,7 +709,7 @@ class GitInstaller(SourceDirInstaller):
> else:
> # if we don't have kmod sources, we just install
> # userspace:
> - os.chdir(self.userspace_srcdir)
> + os.chdir(self.userspace.srcdir)
> utils.system('make install')
>
> if self.path_to_roms:
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Lucas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd
2011-06-26 19:55 ` [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd Alon Levy
2011-06-28 1:50 ` Lucas Meneghel Rodrigues
@ 2011-06-28 1:56 ` Lucas Meneghel Rodrigues
1 sibling, 0 replies; 11+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-06-28 1:56 UTC (permalink / raw)
To: Alon Levy; +Cc: autotest, kvm
Here are the commits from your patchset with the small corrections:
http://autotest.kernel.org/changeset/5456
http://autotest.kernel.org/changeset/5457
http://autotest.kernel.org/changeset/5458
http://autotest.kernel.org/changeset/5459
Let's figure out how to accomplish what you need to do next. Thanks!
Lucas
On Sun, Jun 26, 2011 at 4:55 PM, Alon Levy <alevy@redhat.com> wrote:
> build/lib can contain libspice-server.so built from git.
> ---
> client/virt/kvm_vm.py | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
> index 3fa4b1a..48a1fc5 100644
> --- a/client/virt/kvm_vm.py
> +++ b/client/virt/kvm_vm.py
> @@ -403,6 +403,9 @@ class VM(virt_vm.BaseVM):
> # Set the X11 display parameter if requested
> if params.get("x11_display"):
> qemu_cmd += "DISPLAY=%s " % params.get("x11_display")
> + # Update LD_LIBRARY_PATH for built libraries (libspice-server)
> + qemu_cmd += "LD_LIBRARY_PATH=%s " % (
> + os.path.abspath(os.path.join(self.root_dir, 'build/lib')))
> # Add the qemu binary
> qemu_cmd += qemu_binary
> # Add the VM's name
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Lucas
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-06-28 1:56 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-26 19:55 [PATCH] allow building spice from git Alon Levy
2011-06-26 19:55 ` [PATCH] kvm_vm: add build/lib to LD_LIBRARY_PATH for qemu_cmd Alon Levy
2011-06-28 1:50 ` Lucas Meneghel Rodrigues
2011-06-28 1:56 ` Lucas Meneghel Rodrigues
2011-06-26 19:55 ` [PATCH] kvm_installer: introduce GitRepo helper class Alon Levy
2011-06-28 1:52 ` Lucas Meneghel Rodrigues
2011-06-26 19:55 ` [PATCH] kvm_installer: build spice from git Alon Levy
2011-06-26 19:55 ` [PATCH] client/tests/kvm/build.cfg.sample: add commented spice parameters Alon Levy
2011-06-26 20:05 ` [PATCH] allow building spice from git Alon Levy
2011-06-26 23:49 ` Lucas Meneghel Rodrigues
-- strict thread matches above, loose matches on Subject: below --
2011-06-26 20:04 Alon Levy
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.