Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 1 | #!/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 Geissler | bbd8455 | 2019-01-17 20:05:21 -0600 | [diff] [blame] | 11 | # GERRIT_BRANCH: Branch under test (default is master) |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 12 | |
| 13 | export LANG=en_US.UTF8 |
Patrick Williams | 384d741 | 2020-11-06 16:15:41 -0600 | [diff] [blame^] | 14 | cd "$WORKSPACE" |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 15 | |
Andrew Geissler | bbd8455 | 2019-01-17 20:05:21 -0600 | [diff] [blame] | 16 | GERRIT_BRANCH=${GERRIT_BRANCH:-"master"} |
| 17 | |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 18 | # Grab this for the downstream job |
Andrew Geissler | bbd8455 | 2019-01-17 20:05:21 -0600 | [diff] [blame] | 19 | # TODO - Need test repo to branch |
| 20 | # git clone https://github.com/openbmc/openbmc-test-automation.git --branch ${GERRIT_BRANCH} --single-branch |
| 21 | git clone https://github.com/openbmc/openbmc-test-automation.git --branch master --single-branch |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 22 | |
Patrick Williams | 384d741 | 2020-11-06 16:15:41 -0600 | [diff] [blame^] | 23 | META_REPO=$(basename "$GERRIT_PROJECT") |
| 24 | export META_REPO |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 25 | |
| 26 | # Move the extracted meta layer to a dir based on it's meta-* name |
Patrick Williams | 384d741 | 2020-11-06 16:15:41 -0600 | [diff] [blame^] | 27 | mv "$GERRIT_PROJECT" "$META_REPO" |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 28 | |
Andrew Geissler | bbd8455 | 2019-01-17 20:05:21 -0600 | [diff] [blame] | 29 | # Remove openbmc dir in prep for full repo clone |
| 30 | rm -rf openbmc |
| 31 | |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 32 | # Clone openbmc/openbmc |
Patrick Williams | 384d741 | 2020-11-06 16:15:41 -0600 | [diff] [blame^] | 33 | git clone https://github.com/openbmc/openbmc.git --branch "${GERRIT_BRANCH}" --single-branch |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 34 | |
| 35 | # Make sure meta-* directory is there |
Patrick Williams | 384d741 | 2020-11-06 16:15:41 -0600 | [diff] [blame^] | 36 | mkdir -p ./openbmc/"$META_REPO"/ |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 37 | |
| 38 | # Clean out the dir to handle delete/rename of files |
Patrick Williams | 384d741 | 2020-11-06 16:15:41 -0600 | [diff] [blame^] | 39 | rm -rf ./openbmc/"$META_REPO"/* |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 40 | |
| 41 | # Copy the extracted meta code into it |
Patrick Williams | 384d741 | 2020-11-06 16:15:41 -0600 | [diff] [blame^] | 42 | cp -Rf "$META_REPO"/* ./openbmc/"$META_REPO"/ |
Andrew Geissler | b0a86db | 2019-01-04 14:40:47 -0600 | [diff] [blame] | 43 | |
| 44 | # Create a dummy commit so code update will pick it up |
| 45 | cd openbmc |
Andrew Geissler | b0cb2a3 | 2019-12-16 13:52:33 -0600 | [diff] [blame] | 46 | git add -A && git commit --allow-empty -m "Dummy commit to cause code update" |