[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [stage1-xen (RFC) PATCH 04/10] build/fedora: Add `run`
On Mon, 21 Aug 2017, Rajiv Ranganath wrote: > From: Rajiv M Ranganath <rajiv.ranganath@xxxxxxxxxxx> This is great, just a couple of comments. Please split it into two scripts: one to build the dependecies (xen, qemu, etc.), and the other to build stage1-xen. Of course, you could have one `run' script that calls both scripts for convenience. That way, a user could call the dependency builder once on her system, then call the stage1-xen builder as many times as needed. The script will be more reusable. You won't like this final suggestion, but I'll try anyway :-) I would prefer if this script was in bash. I have nothing against python (in fact I know python better than other scripting languages) but I try to minimize the number of languages required to contribute to stage1-xen. But if it is python or nothing, I'll take python. > build/fedora/run | 87 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 87 insertions(+) > create mode 100755 build/fedora/run > > diff --git a/build/fedora/run b/build/fedora/run > new file mode 100755 > index 0000000..37e1dac > --- /dev/null > +++ b/build/fedora/run > @@ -0,0 +1,87 @@ > +#!/usr/bin/python2 > + > +import shlex > +import subprocess > +import sys > +import os > + > + > +# helper function to capture stdout from a long running process > +def subprocess_stdout(cmd, cwd, env): > + p = subprocess.Popen( > + shlex.split(cmd), cwd=cwd, env=env, stdout=subprocess.PIPE) > + while p.poll() is None: > + l = p.stdout.readline() > + sys.stdout.write(l) > + > + > +env = os.environ.copy() > + > +# build and install xen-unstable > +print "Cloning xen-unstable..." > +cmd = 'git clone git://xenbits.xen.org/xen.git' > +subprocess.check_output(shlex.split(cmd), cwd='/root') > + > +steps = [ > + './configure --prefix=/opt/xen-unstable > --with-system-qemu=/opt/xen-unstable/lib/xen/bin/qemu-system-i386 > --disable-stubdom --disable-qemu-traditional --disable-rombios > --sysconfdir=/opt/xen-unstable/etc --enable-rpath --disable-systemd', I think it is fine to install things under /opt by default, but I would like it to be configurable. A global variable at the top of the script to set the destination directory is good enough. > + 'make', > + 'make install BOOT_DIR=/opt/xen-unstable/boot > DEBUG_DIR=/opt/xen-unstable/lib/debug > EFI_DIR=/opt/xen-unstable/boot/efi/EFI/xen' > +] > +for cmd in steps: > + cwd = '/root/xen' > + subprocess_stdout(cmd, cwd, env) > + > +# build and install qemu-unstable > +print "Cloning qemu-unstable..." > +cmd = 'git clone git://git.qemu.org/qemu.git' > +subprocess.check_output(shlex.split(cmd), cwd='/root') > + > +steps = [ > + './configure --prefix=/opt/qemu-unstable --enable-xen > --target-list=i386-softmmu --extra-cflags="-I/opt/xen-unstable/include" > --extra-ldflags="-L/opt/xen-unstable/lib -Wl,-rpath,/opt/xen-unstable/lib" > --disable-kvm --enable-virtfs --enable-linux-aio', > + 'make', 'make install' Same here about the destination directory > +] > +for cmd in steps: > + cwd = '/root/qemu' > + subprocess_stdout(cmd, cwd, env) > + > +cmd = 'cp i386-softmmu/qemu-system-i386 > /opt/xen-unstable/lib/xen/bin/qemu-system-i386' > +subprocess.check_output(shlex.split(cmd), cwd='/root/qemu') > + > +# build rkt > +print "Cloning rkt..." > +cmd = 'git clone https://github.com/rkt/rkt.git' > +subprocess.check_output(shlex.split(cmd), cwd='/root') > + > +steps = [ > + './autogen.sh', './configure --disable-tpm --with-stage1-flavors=coreos', > + 'make' > +] > +for cmd in steps: > + cwd = '/root/rkt' > + subprocess_stdout(cmd, cwd, env) > + > +# build stage1-xen > +env['GOPATH'] = '/root/gopath' > +cwd = '/root/gopath/src/github.com/rkt/stage1-xen' > +cmd = 'bash build.sh' > +subprocess_stdout(cmd, cwd, env) > + > +# install build artifacts to `/opt/` > +steps = [ > + 'mkdir -p /opt/stage1-xen/bin', 'mkdir -p /opt/stage1-xen/aci', > + 'cp /root/rkt/build-rkt-1.28.1+git/target/bin/rkt > /opt/stage1-xen/bin/rkt', > + 'cp /root/gopath/src/github.com/rkt/stage1-xen/stage1-xen.aci > /opt/stage1-xen/aci/stage1-xen.aci', > + 'cp > /root/gopath/src/github.com/rkt/stage1-xen/build/fedora/source_path.sh > /opt/stage1-xen/bin/source_path.sh', > + 'cp -r > /root/gopath/src/github.com/rkt/stage1-xen/build/fedora/xen-unstable-runit > /opt/xen-unstable-runit' > +] > +for cmd in steps: > + cwd = '/root' > + subprocess_stdout(cmd, cwd, env) > + > +cwd = '/opt' > +cmd = 'tar zcvf /root/stage1-xen-build.tar.gz qemu-unstable/ stage1-xen/ > xen-unstable/ xen-unstable-runit/' > +subprocess_stdout(cmd, cwd, env) > + > +cwd = '/root' > +cmd = 'mv /root/stage1-xen-build.tar.gz /tmp' > +subprocess_stdout(cmd, cwd, env) > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |