From f4444da5fa55e80755299bc87defab1d7153d188 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Fri, 25 Mar 2016 16:03:18 +0000 Subject: [PATCH 1/4] Fix install.sh to handle all the dependencies --- .travis.yml | 7 +------ Vagrantfile | 6 +----- install.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 16 deletions(-) mode change 100644 => 100755 install.sh diff --git a/.travis.yml b/.travis.yml index 7bb7272..bdbdc6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,5 @@ before_install: -- sudo pip install pep8 -- pep8 -- sudo apt-get update -qq -- sudo apt-get install -qq build-essential gawk git m4 -- sudo pip install fs pyyaml sandboxlib requests jsonschema -- sudo pip install bottle cherrypy riemann-client +- ./install.sh install: - sudo python setup.py install diff --git a/Vagrantfile b/Vagrantfile index c08b58e..057fe7a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -11,12 +11,8 @@ Vagrant.configure(2) do |config| end config.vm.provision "shell", inline: <<-SHELL - sudo apt-get update - sudo apt-get install -y build-essential gawk git m4 - sudo wget https://bootstrap.pypa.io/get-pip.py - sudo python get-pip.py; rm get-pip.py - sudo pip install fs pyyaml sandboxlib jsonschema requests bottle cd /src + ./ybd/install.sh git clone git://git.baserock.org/baserock/baserock/definitions echo "base: /src" > ybd/ybd.conf SHELL diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 4b79f6f..7cc9194 --- a/install.sh +++ b/install.sh @@ -1,9 +1,48 @@ -pip install fs pep8 +# Copyright (C) 2016 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# =*= License: GPL-2 =*= -cd .. +# +# This is a bash script which attempts to do a full install of ybd +# and default definitions from git.baserock.org. +# it's mainly intended for ci and automated test setups... +# -if [ ! -d definitions ] ; then - git clone http://git.baserock.org/git/baserock/baserock/definitions.git + +# install dependencies for debian, ubuntu +which apt-get 2>&1 > /dev/null +if [ $? -eq 0 ]; then + sudo apt-get -qq update + sudo apt-get -qq install build-essential gawk git m4 wget +fi + +# install for fedora +which dnf 2>&1 > /dev/null +if [ $? -eq 0 ]; then + sudo dnf install -y which make automake gcc gcc-c++ gawk git m4 wget +fi + +# FIXME: check the above installs worked? + +pip --version 2>&1 > /dev/null +if [ $? -ne 0 ]; then + wget https://bootstrap.pypa.io/get-pip.py + sudo python get-pip.py + sudo rm get-pip.py fi -cd definitions +sudo pip install fs pyyaml sandboxlib requests +sudo pip install jsonschema bottle cherrypy riemann-client +sudo pip install pep8 From 787cbce9ca00bcc0a1a95d21c2d1383d67a7a484 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Fri, 25 Mar 2016 16:38:02 +0000 Subject: [PATCH 2/4] Re-spell GitLab --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 581a89d..34c888c 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -Github: [![Build Status](https://travis-ci.org/devcurmudgeon/ybd.svg?branch=master)](https://travis-ci.org/devcurmudgeon/ybd) Gitlab: [![Build Status](https://gitlab.com/devcurmudgeon/ybd/badges/master/build.svg)](https://gitlab.com/devcurmudgeon/ybd/badges/master/build.svg) +Github: [![Build Status](https://travis-ci.org/devcurmudgeon/ybd.svg?branch=master)](https://travis-ci.org/devcurmudgeon/ybd) GitLab: [![Build Status](https://gitlab.com/devcurmudgeon/ybd/badges/master/build.svg)](https://gitlab.com/devcurmudgeon/ybd/badges/master/build.svg) ## ybd @@ -13,7 +13,7 @@ currently ybd understands the semantics of yaml [definitions](http://git.baserock.org/cgi-bin/cgit.cgi/baserock/baserock/definitions.git/tree/) from the [Baserock](http://wiki.baserock.org) project. -the total codebase for ybd is only ~ 2100 lines of Python. even so ybd can +the total codebase for ybd is only ~ 2200 lines of Python. even so ybd can repeatably build all systems in Baserock's definitions.git, i.e. all of the FOSS components required for Linux appliances up to and including, for example From 32dcaa7ae4da9b2d8307a52b7547ede19c5c3e21 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Fri, 25 Mar 2016 16:49:05 +0000 Subject: [PATCH 3/4] Update .gitlab-ci to use the new install.sh --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb4746d..cfc312d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,8 +24,8 @@ check_pep8: check_installation: stage: installation - script: "python setup.py install ; ./ybd.py" + script: "./ybd.py" check_cache_keys: stage: cache_keys - script: "echo 'mode: keys-only' > ./ybd.conf && ../ybd/ybd.py ci x86_64" + script: "export YBD_mode=keys-only > && ../ybd/ybd.py ci x86_64" From 72799e16ba2eaa65c236aab8b747a518b47d6897 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Fri, 25 Mar 2016 16:50:48 +0000 Subject: [PATCH 4/4] Write cache-key to ybd.result --- ybd/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ybd/__main__.py b/ybd/__main__.py index 2ec707d..90ff39c 100755 --- a/ybd/__main__.py +++ b/ybd/__main__.py @@ -60,7 +60,8 @@ defs.save_trees() if app.config.get('mode', 'normal') == 'keys-only': - print target['cache'] + with open('./ybd.result', 'w') as f: + f.write(target['cache'] +'\n') os._exit(0) sandbox.executor = sandboxlib.executor_for_platform()