-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
message(STATUS "You should put necessary cmake commands to prepare the external project's target") | ||
message(STATUS "We will provide a variable of name exteral_VERSION, and you should prepare a variable called external_target") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# This is a template script to install the external project | ||
# You should create a configuration folder and copy this script | ||
# to the folder for actual installation. | ||
config=$(basename "${BASH_SOURCE[0]}" .sh) | ||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" | ||
root="$script_dir/.." | ||
source_dir="$script_dir/../source" | ||
build_dir="$script_dir/../build/$config" | ||
install_dir="$script_dir/../install/$config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: OMDG # name for the external library, to help human recognize the external project | ||
uid: omdg # the unique identifier for the program the find the external project, you must make sure its value is different from any existing ids in the packages.yml file in OCP repo | ||
type: external # the current project type, could be external or toolkit, or starter | ||
licenses: ["Permissive"] # the external project's licenses | ||
default: # set some default values | ||
version: "1.0.0" # the default version to be installed if not specified in the command | ||
configuration: "default" # the default config if not specified | ||
scripts: ["prepare", "publish", "check"] # some scripts that you can run | ||
versions: # list of all versions, to make this easier for human to read there should be no hidden parts for each item | ||
- id: "1.0.0" # the version number this will be used in the tar.xz file's name | ||
default: "default" # override the default configurations | ||
scripts: ["prepare", "publish", "check"] # override the default scripts | ||
configurations: ["build","new_build"] | ||
scripts: # some scripts that developers may run | ||
- id: prepare # id is used as a reference for others to find this script | ||
run: scripts/prepare # run gives you the script to run (without extension) | ||
arguments: ["@version","@uid"] | ||
- id: publish | ||
run : scripts/publish | ||
arguments: ["@version","@uid"] | ||
- id: check | ||
run: scripts/check | ||
arguments: ["@version","@uid"] | ||
dependencies: # some dependencies that will be later referred by the configurations | ||
- id: "petsc" # id is how the dependencies can be later referred | ||
uid: "petsc" # uid is the unique identifier that we use to locate the tar.xz file | ||
type: external # | ||
default: | ||
version: "3.20.0" # you need to check the ocp.yml file for available versions | ||
configuration: "default" # check the corresponding ocp.yml file for available configurations | ||
configurations: # list of configs that is referred in by the versions | ||
- id: "default" # if no dependencies are listed, then use the default value | ||
run: configurations/default # must have a run to specify which script to run | ||
arguments: ["@version","@uid"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# This is the script to check whether the compressed file has required | ||
# structure | ||
|
||
version=${1} | ||
external_id=${2} | ||
|
||
xzfile="$external_id-$version.tar.xz" | ||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" | ||
|
||
# move to the root of the external repository | ||
cd $script_dir/.. | ||
|
||
# start the script | ||
rm ${external_id}-*.tar.xz | ||
echo "Remove previous tar.xz files" | ||
tar -cJf $xzfile ocp/ | ||
echo "Create external compressed file from ocp folder" | ||
|
||
# move back to the folder where you started | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
# You should modify this script to prepare the folder structure for external project source codes | ||
# The source code must be in ocp/external/external_id/version/source folder | ||
# get command line arguments | ||
version=${1} | ||
external_id=${2} | ||
|
||
# prepare necessary variables | ||
url="https://github.com/zhf-0/matrix/archive/refs/heads/main.zip" | ||
dir="ocp/external/$external_id/$version/source" | ||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" | ||
gz_file="$external_id-v$version.tar.gz" | ||
# move to the root of the external repository | ||
cd $script_dir/.. | ||
|
||
# start the script | ||
rm -rf *.tar.gz | ||
wget -O $gz_file $url | ||
echo "Download $external_id $version" | ||
rm -rf ocp | ||
echo "Remove previous ocp folder" | ||
mkdir -p "$dir" | ||
echo "Create ocp folder structure" | ||
tar -xzf $gz_file -C $dir --strip-components=1 | ||
echo "Extract files to ocp folder" | ||
cp -r configurations "$dir/.." | ||
echo "Copy all configurations to ocp folder" | ||
cp -r cmake "$dir/.." | ||
echo "Copy all cmake files to ocp folder" | ||
cp ocp.yml "$dir/.." | ||
echo "Copy ocp.yml to ocp folder" | ||
|
||
# move back to the folder where you started | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# This is the script to compress and publish the external project source code to | ||
# ocp-external bucket. You should not use it, because normal user only has read | ||
# permission to the bucket. To publish this external project, please submit an | ||
# issue in the OCP sdk repository. | ||
|
||
version=${1} | ||
external_id=${2} | ||
|
||
xzfile="$external_id-$version.tar.xz" | ||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" | ||
|
||
# move to the root of the external repository | ||
cd $script_dir/.. | ||
|
||
# start the script | ||
rm -rf ${external_id}-*.tar.xz | ||
echo "Remove previous tar.xz files" | ||
tar -cJf $xzfile ocp/ | ||
echo "Create external compressed file from ocp folder" | ||
rclone copy -P $xzfile ali:ocp-external/$external_id | ||
echo "Upload compressed file to ocp-external/$external_id" | ||
|
||
# move back to the folder where you started | ||
cd - |