Giter VIP home page Giter VIP logo

xenserver-build-env's Introduction

xenserver-build-env

Build status Docker pulls

This docker config and collection of supporting scripts allows for creating a docker container to work on and build a XenServer package from an SRPM. It will build a Docker container with the right build environment (including some useful tools) and then install all of the build-dependencies of the given pacakge. You will then be in a chroot from which you can clone and build the source.

By default, the container references a yum repository that comes from the nightly snapshot uploads to xenserver.org.

Configuration

You'll need to install docker. Follow the instructions for your platform on https://www.docker.com/

Building

Either build the docker image yourself:

docker build -t xenserver/xenserver-build-env .

or pull from the Docker Hub:

docker pull xenserver/xenserver-build-env

Building packages

Install the dependencies of the package using yum:

yum-builddep xapi

then either download the SRPM using yumdownloader:

yumdownloader --source xapi
rpmbuild --rebuild xapi*

or clone the source from github or xenbits:

git clone git://github.com/xapi-project/xen-api
cd xen-api
./configure
make

Mounting repos from outside the container

If you'd like to develop using the tools on your host and preseve the changes to source and revision control but still use the container for building, you can do using by using a docker volume.

Once you have built your image you can run it with an extra argument to mount a directory from your host to a suitable point inside the container. For example, if I clone some repos into a directory on my host, say /work/code/, then I can mount it inside the container as follows:

docker run -i -t -v /work/code:/mnt/repos -u $(id -u) <IMAGE> /bin/bash

The -u flag uses the right UID inside so that changes made in the container are with the same UID as outside the container. Docker >=1.6 supports group IDs as well and both the group and user can be referenced by name.

Then the following format is available to set the UID/GID:

-u, --user=                Username or UID (format: <name|uid>[:<group|gid>])

xenserver-build-env's People

Contributors

edwintorok avatar frezzle avatar gaborigloi avatar johnelse avatar jonludlam avatar lindig avatar mseri avatar noncreature0714 avatar robhoes avatar simonjbeaumont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xenserver-build-env's Issues

System error: exec: "/usr/local/bin/init-container.sh": stat /usr/local/bin/init-container.sh: no such file or directory

Davids-MacBook-Pro-2:xenserver-build-env djs$ ./run.py -b trunk-ring3 -s xenopsd-0.10.1-1+s0+0.10.1+10+gf2c98e0.el7.centos.src.rpm 
Launching docker with args ['docker', 'run', '-e', 'XS_BRANCH=trunk-ring3', '-i', '-t', '-u', 'builder', '-v', '/tmp/docker-SRPMS/070601df-928e-4a74-a551-c098f603114b:/mnt/docker-SRPMS', 'xenserver/xenserver-build-env', '/usr/local/bin/init-container.sh']
Unable to find image 'xenserver/xenserver-build-env:latest' locally
Pulling repository xenserver/xenserver-build-env
94c96f3910dc: Download complete 
341996e79147: Download complete 
e3f2b74d5729: Download complete 
adb2b57c0799: Download complete 
fc6900d091ef: Download complete 
dbe5eb563e45: Download complete 
bde2c4ec4b85: Download complete 
8825fdb29c52: Download complete 
30a3cb7b3e8a: Download complete 
2b0ae2ac7a41: Download complete 
3325669c93f2: Download complete 
79ebe3737c7e: Download complete 
dffc128e8e6d: Download complete 
a6f602cc5682: Download complete 
0547115e9063: Download complete 
cac09cf93e83: Download complete 
Status: Downloaded newer image for xenserver/xenserver-build-env:latest
exec: "/usr/local/bin/init-container.sh": stat /usr/local/bin/init-container.sh: no such file or directory
FATA[0395] Error response from daemon: Cannot start container ba0d875933ec3b353fdf466e4154289e6986d5bd8829af0951d5ff2ab9fd3278: [8] System error: exec: "/usr/local/bin/init-container.sh": stat /usr/local/bin/init-container.sh: no such file or directory 

Cannot run build.sh to setup xenserver build env

Hi,

I am trying to build a xenserver build env, but after I added "DOCKER_OPTS="--dns 10.80.16.125 --dns 10.80.16.126 -s devicemapper" in /etc/default/docker file and restarted docker service, when I run build script, I got the following error message

sudo ./build.sh

Sending build context to Docker daemon 24.06 kB
Sending build context to Docker daemon
Step 0 : FROM xenserver/xenserver-base
Pulling repository xenserver/xenserver-base
341996e79147: Download complete
Status: Downloaded newer image for xenserver/xenserver-base:latest
---> 341996e79147
Step 1 : MAINTAINER John Else [email protected]
---> Running in b61312e4dad7
---> 84ceb7156562
Removing intermediate container b61312e4dad7
Step 2 : COPY files/yum.conf /etc/yum.conf
---> 6c638d82fbab
Removing intermediate container 85001f1af008
Step 3 : RUN mkdir -p /etc/yum.repos.d.xs
---> Running in c6dd7db30020
---> d3693d5e1076
Removing intermediate container c6dd7db30020
Step 4 : COPY files/Citrix.repo.in /tmp/Citrix.repo.in
---> 3bd36c5ae68b
Removing intermediate container 4158ae7e08e0
Step 5 : COPY files/RPM-GPG-KEY-Citrix-6.6 /etc/pki/rpm-gpg/RPM-GPG-KEY-Citrix-6.6
---> 2a4943d8dbf4
Removing intermediate container 4954b2344a4d
Step 6 : RUN yum install -y git make mercurial mock rpm-build rpm-python sudo yum-utils
---> Running in 49750d8c5407
Loaded plugins: fastestmirror
Loaded plugins: fastestmirror
http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/os/x86_64/repodata/repomd.xml: (28, 'Resolving timed out after 30386 milliseconds')
Trying other mirror.
http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://www.uk.xensource.com/linux/distros/CentOS/7.0.1406/os/x86_64/repodata/repomd.xml: (28, 'Resolving timed out after 30387 milliseconds')
Trying other mirror.
...
One of the configured repositories failed (base),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Disable the repository, so yum won't use it by default. Yum will then
    just ignore the repository until you permanently enable it again or use
    --enablerepo for temporary usage:

        yum-config-manager --disable base

 4. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=base.skip_if_unavailable=true

...

Could you help to check what is problem?

No such package(s): xapi

Im trying to run this docker image but got this error:

[root@f27c8393a480 ~]# yum-builddep xapi
Loaded plugins: fastestmirror, ovl
Enabling base-source repository
Enabling epel-source repository
Enabling extras-source repository
Enabling updates-source repository
Loading mirror speeds from cached hostfile
 * base: centos.unixheads.org
 * epel: fedora-epel.mirror.lstn.net
 * epel-source: fedora-epel.mirror.lstn.net
 * extras: ftpmirror.your.org
 * updates: mirror.tzulo.com
Checking for new repos for mirrors
No such package(s): xapi
[root@f27c8393a480 ~]# yumdownloader --source xapi
Loaded plugins: fastestmirror, ovl
Enabling epel-source repository
Enabling updates-source repository
Enabling base-source repository
Enabling extras-source repository
Loading mirror speeds from cached hostfile
 * base: centos.unixheads.org
 * epel: fedora-epel.mirror.lstn.net
 * epel-source: fedora-epel.mirror.lstn.net
 * extras: ftpmirror.your.org
 * updates: mirror.tzulo.com
No Match for argument xapi
Nothing to download
[root@f27c8393a480 ~]#

Am I missing something?

This doesn't work on Debian

Debian has no XAPI package to install the builddeps from. What are the dependencies? Then maybe, I can grab them manually.

./run.py should allow docker to be on the path

Currently it's hardcoded to /usr/bin/docker, but on OS X with home-brew it will be in /usr/local, resulting in:

Davids-MacBook-Pro-2:xenserver-build-env djs$ ./run.py -b trunk-ring3 -s xenopsd-0.10.1-1+s0+0.10.1+10+gf2c98e0.el7.centos.src.rpm 
Launching docker with args ['docker', 'run', '-e', 'XS_BRANCH=trunk-ring3', '-i', '-t', '-u', 'builder', '-v', '/tmp/docker-SRPMS/cb5b5f30-a4e0-4165-9b75-396a2985d570:/mnt/docker-SRPMS', 'xenserver/xenserver-build-env', '/usr/local/bin/init-container.sh']
Traceback (most recent call last):
  File "./run.py", line 63, in <module>
    main()
  File "./run.py", line 60, in main
    os.execv(DOCKER_PATH, docker_args)
OSError: [Errno 2] No such file or directory

Davids-MacBook-Pro-2:xenserver-build-env djs$ which docker
/usr/local/bin/docker

Davids-MacBook-Pro-2:xenserver-build-env djs$ docker info
Containers: 0
Images: 0
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
 Dirperm1 Supported: true
Execution Driver: native-0.2
Kernel Version: 4.0.2-boot2docker
Operating System: Boot2Docker 1.6.1 (TCL 5.4); master : 43209d4 - Thu May  7 22:06:28 UTC 2015
CPUs: 8
Total Memory: 1.957 GiB
Name: boot2docker
ID: BEP4:HKY5:6ONE:HMKY:FDCE:MCR2:FX25:NIXO:KFFX:MR65:Z4L5:HCFT
Debug mode (server): true
Debug mode (client): false
Fds: 10
Goroutines: 16
System Time: Tue May 12 11:04:21 UTC 2015
EventsListeners: 0
Init SHA1: 2dabfc43e5f856a0712787a6ff78ceaf791cc9e7
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.