blob: 4ce317bb32f0934bc4724bc2a82968ebb181de04 [file] [log] [blame]
Andrew Geisslerb0a86db2019-01-04 14:40:47 -06001#!/bin/bash -xe
2#
3# Purpose:
4# This script is responsible for setting up a openbmc/openbmc build
5# environment for a meta-* repository.
6#
7# Required Inputs:
8# WORKSPACE: Directory which contains the extracted meta-*
9# layer test is running against
10# GERRIT_PROJECT: openbmc/meta-* layer under test (i.e. openbmc/meta-phosphor)
Andrew Geisslerbbd84552019-01-17 20:05:21 -060011# GERRIT_BRANCH: Branch under test (default is master)
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060012
13export LANG=en_US.UTF8
Patrick Williams384d7412020-11-06 16:15:41 -060014cd "$WORKSPACE"
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060015
Andrew Geisslerbbd84552019-01-17 20:05:21 -060016GERRIT_BRANCH=${GERRIT_BRANCH:-"master"}
17
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060018# Grab this for the downstream job
Andrew Geisslerbbd84552019-01-17 20:05:21 -060019# TODO - Need test repo to branch
20# git clone https://github.com/openbmc/openbmc-test-automation.git --branch ${GERRIT_BRANCH} --single-branch
21git clone https://github.com/openbmc/openbmc-test-automation.git --branch master --single-branch
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060022
Patrick Williams384d7412020-11-06 16:15:41 -060023META_REPO=$(basename "$GERRIT_PROJECT")
24export META_REPO
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060025
26# Move the extracted meta layer to a dir based on it's meta-* name
Patrick Williams384d7412020-11-06 16:15:41 -060027mv "$GERRIT_PROJECT" "$META_REPO"
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060028
Andrew Geisslerbbd84552019-01-17 20:05:21 -060029# Remove openbmc dir in prep for full repo clone
30rm -rf openbmc
31
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060032# Clone openbmc/openbmc
Patrick Williams384d7412020-11-06 16:15:41 -060033git clone https://github.com/openbmc/openbmc.git --branch "${GERRIT_BRANCH}" --single-branch
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060034
35# Make sure meta-* directory is there
Patrick Williams384d7412020-11-06 16:15:41 -060036mkdir -p ./openbmc/"$META_REPO"/
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060037
38# Clean out the dir to handle delete/rename of files
Patrick Williams384d7412020-11-06 16:15:41 -060039rm -rf ./openbmc/"$META_REPO"/*
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060040
41# Copy the extracted meta code into it
Patrick Williams384d7412020-11-06 16:15:41 -060042cp -Rf "$META_REPO"/* ./openbmc/"$META_REPO"/
Andrew Geisslerb0a86db2019-01-04 14:40:47 -060043
44# Create a dummy commit so code update will pick it up
45cd openbmc
Andrew Geisslerb0cb2a32019-12-16 13:52:33 -060046git add -A && git commit --allow-empty -m "Dummy commit to cause code update"