All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Rajiv Ranganath <rajiv.ranganath@atihita.com>
Cc: sstabellini@kernel.org, xen-devel@lists.xen.org
Subject: Re: [stage1-xen PATCH v1 04/10] build/fedora: Add `run` and `components/*` scripts
Date: Wed, 6 Sep 2017 11:59:54 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1709061148100.26407@sstabellini-ThinkPad-X260> (raw)
In-Reply-To: <20170827030053.40527.90818.stgit@rajivs-macbook-pro.local>

On Sun, 27 Aug 2017, Rajiv Ranganath wrote:
> From: Rajiv M Ranganath <rajiv.ranganath@atihita.com>
> 
> Signed-off-by: Rajiv Ranganath <rajiv.ranganath@atihita.com>
> ---
>  build/fedora/components/qemu |   50 ++++++++++++++++++++++++++++++++++++
>  build/fedora/components/rkt  |   58 ++++++++++++++++++++++++++++++++++++++++++
>  build/fedora/components/xen  |   46 +++++++++++++++++++++++++++++++++
>  build/fedora/run             |   56 +++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 210 insertions(+)
>  create mode 100755 build/fedora/components/qemu
>  create mode 100755 build/fedora/components/rkt
>  create mode 100755 build/fedora/components/xen
>  create mode 100755 build/fedora/run
> 
> diff --git a/build/fedora/components/qemu b/build/fedora/components/qemu
> new file mode 100755
> index 0000000..6c89e2c
> --- /dev/null
> +++ b/build/fedora/components/qemu
> @@ -0,0 +1,50 @@
> +#!/usr/bin/python2
> +
> +import shlex
> +import subprocess
> +import sys
> +import os
> +
> +# Modify this if you would like to install Qemu elsewhere on your filesystem or
> +# a different version of Qemu
> +QEMU_PREFIX = '/opt/qemu-unstable'
> +QEMU_BRANCH = 'master'

I am not sure we want to checkout always the latest QEMU. It is a
running target. It makes sense to use one of the latest releases
instead, such as v2.10.0?


> +# This should correspond to your Xen install prefix
> +XEN_PREFIX = '/opt/xen-unstable'
> +
> +
> +# 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)
> +    if p.returncode != 0:
> +        sys.exit(1)

Is this the same as
  #!/bin/bash
  set -e
?

Please add a few words in the commit message about the benefit of this
approach of writing scripts.


> +env = os.environ.copy()
> +
> +# build and install qemu
> +print "Cloning qemu..."
> +cmd = "git clone --branch %(branch)s git://git.qemu.org/qemu.git" % {
> +    'branch': QEMU_BRANCH
> +}
> +subprocess.check_output(shlex.split(cmd), cwd='/root')
> +
> +steps = [
> +    "./configure --prefix=%(qemu_prefix)s --enable-xen --target-list=i386-softmmu --extra-cflags=\"-I%(xen_prefix)s/include\" --extra-ldflags=\"-L%(xen_prefix)s/lib -Wl,-rpath,%(xen_prefix)s/lib\" --disable-kvm --enable-virtfs --enable-linux-aio"
> +    % {
> +        'qemu_prefix': QEMU_PREFIX,
> +        'xen_prefix': XEN_PREFIX
> +    }, 'make', 'make install'
> +]
> +for cmd in steps:
> +    cwd = '/root/qemu'
> +    subprocess_stdout(cmd, cwd, env)
> +
> +cmd = "cp i386-softmmu/qemu-system-i386 %(xen_prefix)s/lib/xen/bin/qemu-system-i386" % {
> +    'xen_prefix': XEN_PREFIX
> +}
> +subprocess.check_output(shlex.split(cmd), cwd='/root/qemu')
> diff --git a/build/fedora/components/rkt b/build/fedora/components/rkt
> new file mode 100755
> index 0000000..edfdd1c
> --- /dev/null
> +++ b/build/fedora/components/rkt
> @@ -0,0 +1,58 @@
> +#!/usr/bin/python2
> +
> +import shlex
> +import subprocess
> +import sys
> +import os
> +
> +# `rkt` is installed in the same prefix as `stage1-xen`. Modify this if you
> +# would like to install rkt elsewhere on your filesystem.
> +STAGE1_XEN_PREFIX = '/opt/stage1-xen'
> +RKT_PREFIX = STAGE1_XEN_PREFIX
> +RKT_BRANCH = 'master'
> +
> +# Adjust this according to what RKT_BRANCH generates
> +RKT_BUILD_VER = 'rkt-1.28.1+git'

I think it would be best if git-checked out the tag (v1.28.1) so that we
are sure there are no version mismatches. In fact, I would remove
RKT_BRANCH and just use a single variable to specify the version to
clone and build.


> +# 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)
> +    if p.returncode != 0:
> +        sys.exi(1)
> +
> +
> +env = os.environ.copy()
> +
> +# build rkt
> +print "Cloning rkt..."
> +cmd = "git clone --branch %(branch)s https://github.com/rkt/rkt.git" % {
> +    'branch': RKT_BRANCH
> +}
> +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)
> +
> +# install rkt build artifacts to RKT_PREFIX
> +steps = [
> +    "mkdir -p %(prefix)s/bin" % {
> +        'prefix': RKT_PREFIX
> +    },
> +    "cp /root/rkt/build-%(build_ver)s/target/bin/rkt %(prefix)s/bin/rkt" % {
> +        'build_ver': RKT_BUILD_VER,
> +        'prefix': RKT_PREFIX
> +    }
> +]
> +for cmd in steps:
> +    cwd = '/root/rkt'
> +    subprocess_stdout(cmd, cwd, env)
> diff --git a/build/fedora/components/xen b/build/fedora/components/xen
> new file mode 100755
> index 0000000..95da9a6
> --- /dev/null
> +++ b/build/fedora/components/xen
> @@ -0,0 +1,46 @@
> +#!/usr/bin/python2
> +
> +import shlex
> +import subprocess
> +import sys
> +import os
> +
> +# Modify this if you would like to install Xen elsewhere on your filesystem or
> +# a different version of Xen
> +XEN_PREFIX = '/opt/xen-unstable'
> +XEN_BRANCH = 'master'

Same here, I think that for a stage1-xen CI-loop it's best to build and
test again a stable target. Thus, instead of master, I would use a tag
like RELEASE-4.9.0.


> +# 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)
> +    if p.returncode != 0:
> +        sys.exit(1)
> +
> +
> +env = os.environ.copy()
> +
> +# build and install xen
> +print "Cloning xen..."
> +cmd = "git clone --branch %(branch)s git://xenbits.xen.org/xen.git" % {
> +    'branch': XEN_BRANCH
> +}
> +subprocess.check_output(shlex.split(cmd), cwd='/root')
> +
> +steps = [
> +    "./configure --prefix=%(prefix)s --with-system-qemu=%(prefix)s/lib/xen/bin/qemu-system-i386 --disable-stubdom --disable-qemu-traditional --disable-rombios --sysconfdir=%(prefix)s/etc --enable-rpath --disable-systemd"
> +    % {
> +        'prefix': XEN_PREFIX
> +    }, 'make',
> +    "make install BOOT_DIR=%(prefix)s/boot DEBUG_DIR=%(prefix)s/lib/debug EFI_DIR=%(prefix)s/boot/efi/EFI/xen"
> +    % {
> +        'prefix': XEN_PREFIX
> +    }
> +]
> +for cmd in steps:
> +    cwd = '/root/xen'
> +    subprocess_stdout(cmd, cwd, env)
> diff --git a/build/fedora/run b/build/fedora/run
> new file mode 100755
> index 0000000..6cb6417
> --- /dev/null
> +++ b/build/fedora/run
> @@ -0,0 +1,56 @@
> +#!/usr/bin/python2
> +
> +import shlex
> +import subprocess
> +import sys
> +import os
> +
> +# This scripts calls out to `xen`, `qemu` and `rkt` scripts in the
> +# `components/` directory within a container. It is expected that components
> +# directory is present at the same directory level as run script.
> +STAGE1_XEN_COMPONENTS = ['xen', 'qemu', 'rkt']
> +
> +
> +# 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)
> +    if p.returncode != 0:
> +        sys.exit(1)
> +
> +
> +env = os.environ.copy()
> +
> +dirname = os.path.dirname(os.path.realpath(__file__))
> +steps = [os.path.join(dirname, 'components', x) for x in STAGE1_XEN_COMPONENTS]
> +for cmd in steps:
> +    cwd = '/root'
> +    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/stage1-xen/aci` and create a tarball
> +steps = [
> +    'mkdir -p /opt/stage1-xen/aci',
> +    '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@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-09-06 18:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-27  3:00 [stage1-xen PATCH v1 00/10] Add Fedora support Rajiv Ranganath
2017-08-27  3:00 ` [stage1-xen PATCH v1 01/10] .gitignore: Add Rajiv Ranganath
2017-09-06 18:42   ` Stefano Stabellini
2017-08-27  3:00 ` [stage1-xen PATCH v1 02/10] build/fedora: Add `buildroot-README.md` Rajiv Ranganath
2017-09-06 18:43   ` Stefano Stabellini
2017-08-27  3:00 ` [stage1-xen PATCH v1 03/10] build/fedora: Add `buildroot-Dockerfile` Rajiv Ranganath
2017-09-06 18:43   ` Stefano Stabellini
2017-08-27  3:00 ` [stage1-xen PATCH v1 04/10] build/fedora: Add `run` and `components/*` scripts Rajiv Ranganath
2017-09-06 18:59   ` Stefano Stabellini [this message]
2017-09-09  2:04     ` Rajiv Ranganath
2017-09-11 20:06       ` Stefano Stabellini
2017-09-13  5:17         ` Rajiv Ranganath
2017-09-13 21:23           ` Stefano Stabellini
2017-08-27  3:01 ` [stage1-xen PATCH v1 05/10] build/fedora: Add `source_path.sh` Rajiv Ranganath
2017-08-27  3:01 ` [stage1-xen PATCH v1 06/10] build/fedora: Add `xen-unstable-runit/*` scripts Rajiv Ranganath
2017-09-06 18:40   ` Stefano Stabellini
2017-09-09  1:51     ` Rajiv Ranganath
2017-09-11 20:20       ` Stefano Stabellini
2017-09-11 23:08         ` Andrew Cooper
2017-09-13  5:09           ` Rajiv Ranganath
2017-08-27  3:01 ` [stage1-xen PATCH v1 07/10] .circleci/config.yml: Add Rajiv Ranganath
2017-09-06 19:05   ` Stefano Stabellini
2017-08-27  3:01 ` [stage1-xen PATCH v1 08/10] README.md: Add CircleCI badge Rajiv Ranganath
2017-09-06 18:44   ` Stefano Stabellini
2017-08-27  3:01 ` [stage1-xen PATCH v1 09/10] build/fedora: Add `RUNNING_STAGE1_XEN.md` Rajiv Ranganath
2017-09-06 19:14   ` Stefano Stabellini
2017-09-09  2:10     ` Rajiv Ranganath
2017-09-09  2:52       ` Rajiv Ranganath
2017-09-11 20:07       ` Stefano Stabellini
2017-08-27  3:01 ` [stage1-xen PATCH v1 10/10] BUILDING.md: Add Fedora instructions Rajiv Ranganath
2017-09-06 19:07   ` Stefano Stabellini

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=alpine.DEB.2.10.1709061148100.26407@sstabellini-ThinkPad-X260 \
    --to=sstabellini@kernel.org \
    --cc=rajiv.ranganath@atihita.com \
    --cc=xen-devel@lists.xen.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.