1b0a86db1SAndrew Geissler#!/bin/bash -xe
2b0a86db1SAndrew Geissler#
3b0a86db1SAndrew Geissler# Purpose:
4b0a86db1SAndrew Geissler#  This script is responsible for setting up a openbmc/openbmc build
5b0a86db1SAndrew Geissler#  environment for a meta-* repository.
6b0a86db1SAndrew Geissler#
7b0a86db1SAndrew Geissler# Required Inputs:
8b0a86db1SAndrew Geissler#  WORKSPACE:      Directory which contains the extracted meta-*
9b0a86db1SAndrew Geissler#                  layer test is running against
10b0a86db1SAndrew Geissler#  GERRIT_PROJECT: openbmc/meta-* layer under test (i.e. openbmc/meta-phosphor)
11*bbd84558SAndrew Geissler#  GERRIT_BRANCH:  Branch under test (default is master)
12b0a86db1SAndrew Geissler
13b0a86db1SAndrew Geisslerexport LANG=en_US.UTF8
14b0a86db1SAndrew Geisslercd $WORKSPACE
15b0a86db1SAndrew Geissler
16*bbd84558SAndrew GeisslerGERRIT_BRANCH=${GERRIT_BRANCH:-"master"}
17*bbd84558SAndrew Geissler
18b0a86db1SAndrew Geissler# Grab this for the downstream job
19*bbd84558SAndrew Geissler# TODO - Need test repo to branch
20*bbd84558SAndrew Geissler# git clone https://github.com/openbmc/openbmc-test-automation.git --branch ${GERRIT_BRANCH} --single-branch
21*bbd84558SAndrew Geisslergit clone https://github.com/openbmc/openbmc-test-automation.git --branch master --single-branch
22b0a86db1SAndrew Geissler
23b0a86db1SAndrew Geisslerexport META_REPO=`basename $GERRIT_PROJECT`
24b0a86db1SAndrew Geissler
25b0a86db1SAndrew Geissler# Move the extracted meta layer to a dir based on it's meta-* name
26b0a86db1SAndrew Geisslermv $GERRIT_PROJECT $META_REPO
27b0a86db1SAndrew Geissler
28*bbd84558SAndrew Geissler# Remove openbmc dir in prep for full repo clone
29*bbd84558SAndrew Geisslerrm -rf openbmc
30*bbd84558SAndrew Geissler
31b0a86db1SAndrew Geissler# Clone openbmc/openbmc
32*bbd84558SAndrew Geisslergit clone https://github.com/openbmc/openbmc.git --branch ${GERRIT_BRANCH} --single-branch
33b0a86db1SAndrew Geissler
34b0a86db1SAndrew Geissler# Make sure meta-* directory is there
35b0a86db1SAndrew Geisslermkdir -p ./openbmc/$META_REPO/
36b0a86db1SAndrew Geissler
37b0a86db1SAndrew Geissler# Clean out the dir to handle delete/rename of files
38b0a86db1SAndrew Geisslerrm -rf ./openbmc/$META_REPO/*
39b0a86db1SAndrew Geissler
40b0a86db1SAndrew Geissler# Copy the extracted meta code into it
41b0a86db1SAndrew Geisslercp -Rf $META_REPO/* ./openbmc/$META_REPO/
42b0a86db1SAndrew Geissler
43b0a86db1SAndrew Geissler# Create a dummy commit so code update will pick it up
44b0a86db1SAndrew Geisslercd openbmc
45b0a86db1SAndrew Geisslergit add -A && git commit -m "Dummy commit to cause code update"
46