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) 11bbd84558SAndrew Geissler# GERRIT_BRANCH: Branch under test (default is master) 12b0a86db1SAndrew Geissler 13b0a86db1SAndrew Geisslerexport LANG=en_US.UTF8 14*384d741bSPatrick Williamscd "$WORKSPACE" 15b0a86db1SAndrew Geissler 16bbd84558SAndrew GeisslerGERRIT_BRANCH=${GERRIT_BRANCH:-"master"} 17bbd84558SAndrew Geissler 18b0a86db1SAndrew Geissler# Grab this for the downstream job 19bbd84558SAndrew Geissler# TODO - Need test repo to branch 20bbd84558SAndrew Geissler# git clone https://github.com/openbmc/openbmc-test-automation.git --branch ${GERRIT_BRANCH} --single-branch 21bbd84558SAndrew Geisslergit clone https://github.com/openbmc/openbmc-test-automation.git --branch master --single-branch 22b0a86db1SAndrew Geissler 23*384d741bSPatrick WilliamsMETA_REPO=$(basename "$GERRIT_PROJECT") 24*384d741bSPatrick Williamsexport META_REPO 25b0a86db1SAndrew Geissler 26b0a86db1SAndrew Geissler# Move the extracted meta layer to a dir based on it's meta-* name 27*384d741bSPatrick Williamsmv "$GERRIT_PROJECT" "$META_REPO" 28b0a86db1SAndrew Geissler 29bbd84558SAndrew Geissler# Remove openbmc dir in prep for full repo clone 30bbd84558SAndrew Geisslerrm -rf openbmc 31bbd84558SAndrew Geissler 32b0a86db1SAndrew Geissler# Clone openbmc/openbmc 33*384d741bSPatrick Williamsgit clone https://github.com/openbmc/openbmc.git --branch "${GERRIT_BRANCH}" --single-branch 34b0a86db1SAndrew Geissler 35b0a86db1SAndrew Geissler# Make sure meta-* directory is there 36*384d741bSPatrick Williamsmkdir -p ./openbmc/"$META_REPO"/ 37b0a86db1SAndrew Geissler 38b0a86db1SAndrew Geissler# Clean out the dir to handle delete/rename of files 39*384d741bSPatrick Williamsrm -rf ./openbmc/"$META_REPO"/* 40b0a86db1SAndrew Geissler 41b0a86db1SAndrew Geissler# Copy the extracted meta code into it 42*384d741bSPatrick Williamscp -Rf "$META_REPO"/* ./openbmc/"$META_REPO"/ 43b0a86db1SAndrew Geissler 44b0a86db1SAndrew Geissler# Create a dummy commit so code update will pick it up 45b0a86db1SAndrew Geisslercd openbmc 46b0cb2a32SAndrew Geisslergit add -A && git commit --allow-empty -m "Dummy commit to cause code update" 47