diff options
| -rw-r--r-- | release/RELEASE_CONTENT | 11 | ||||
| -rwxr-xr-x | release/copyrc.sh | 79 |
2 files changed, 90 insertions, 0 deletions
diff --git a/release/RELEASE_CONTENT b/release/RELEASE_CONTENT new file mode 100644 index 0000000..3fb3799 --- /dev/null +++ b/release/RELEASE_CONTENT | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | # The release structure is defined here as: | ||
| 2 | # <path to artifact within build folder>:<destination path in release structure> | ||
| 3 | |||
| 4 | # atom-c3000 images | ||
| 5 | tmp/deploy/images/atom-c3000/enea-nfv-access-edgelink-netconf-atom-c3000.hddimg:atom-c3000/enea-nfv-access-edgelink-netconf-atom-c3000.hddimg | ||
| 6 | |||
| 7 | # xeon-d images | ||
| 8 | tmp/deploy/images/xeon-d/enea-nfv-access-edgelink-netconf-xeon-d.hddimg:xeon-d/enea-nfv-access-edgelink-netconf-xeon-d.hddimg | ||
| 9 | |||
| 10 | # documentation | ||
| 11 | doc/book-enea-nfv-access-guide-intel/book-enea-nfv-access-guide-intel.pdf:Documentation/book-enea-nfv-access-guide-intel.pdf | ||
diff --git a/release/copyrc.sh b/release/copyrc.sh new file mode 100755 index 0000000..7e9616d --- /dev/null +++ b/release/copyrc.sh | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # This script locates build artifacts in a provided list of directories and copies | ||
| 4 | # them into a release structure as defined in a release content definition file. | ||
| 5 | |||
| 6 | usage() { | ||
| 7 | cat <<EOF >&2 | ||
| 8 | |||
| 9 | Usage: | ||
| 10 | $(basename $0) [OPTIONS] -o <output directory> <build directory>... | ||
| 11 | |||
| 12 | OPTIONS: | ||
| 13 | -p Print the release structure without creating it | ||
| 14 | -r <file> Set release definition file (default: RELEASE_CONTENT) | ||
| 15 | |||
| 16 | EOF | ||
| 17 | exit | ||
| 18 | } | ||
| 19 | |||
| 20 | RC_def="./RELEASE_CONTENT" | ||
| 21 | |||
| 22 | while getopts "o:pr:" name; do | ||
| 23 | case $name in | ||
| 24 | o) RC_dir=$OPTARG ;; | ||
| 25 | r) RC_def=$OPTARG ;; | ||
| 26 | p) print=1 ;; | ||
| 27 | ?) usage ;; | ||
| 28 | esac | ||
| 29 | done | ||
| 30 | |||
| 31 | if [ ! "$RC_dir" ] && [ ! "$print" ]; then | ||
| 32 | echo "ERROR: Output directory not set" | ||
| 33 | usage | ||
| 34 | fi | ||
| 35 | |||
| 36 | if [ -d "$RC_dir" ]; then | ||
| 37 | echo "ERROR: Output directory $RC_dir already exists" | ||
| 38 | exit 1 | ||
| 39 | fi | ||
| 40 | |||
| 41 | if [ ! -f "$RC_def" ]; then | ||
| 42 | echo "ERROR: release definition file '$RC_def' does not exist" | ||
| 43 | exit 1 | ||
| 44 | fi | ||
| 45 | |||
| 46 | echo "Release definition: $RC_def" | ||
| 47 | echo -e "Output directory: $RC_dir\n" | ||
| 48 | |||
| 49 | shift $(( OPTIND - 1 )) | ||
| 50 | builddirs=("$@") | ||
| 51 | |||
| 52 | while read line; do | ||
| 53 | if [ -z "$line" ] || [[ $line = \#* ]]; then continue; fi | ||
| 54 | |||
| 55 | IFS=: read -r srcfile dstfile _ <<< $line | ||
| 56 | |||
| 57 | if [ ! -z "$print" ]; then | ||
| 58 | echo $RC_dir/$dstfile | ||
| 59 | continue | ||
| 60 | fi | ||
| 61 | |||
| 62 | found=0 | ||
| 63 | for srcdir in ${builddirs[@]}; do | ||
| 64 | if [ -f "$srcdir/$srcfile" ]; then | ||
| 65 | found=1 | ||
| 66 | mkdir -p "$RC_dir/$(dirname "$dstfile")" | ||
| 67 | cp -Lpv $srcdir/$srcfile $RC_dir/$dstfile | ||
| 68 | break | ||
| 69 | fi | ||
| 70 | done | ||
| 71 | |||
| 72 | if [ "$found" -eq "0" ]; then | ||
| 73 | echo "ERROR: File '$srcfile' not found" | ||
| 74 | exit 1 | ||
| 75 | fi | ||
| 76 | |||
| 77 | done < $RC_def | ||
| 78 | |||
| 79 | echo -e "\nDone, RC directory: $RC_dir" | ||
