diff options
Diffstat (limited to 'ci/utility')
-rw-r--r-- | ci/utility/check_git_repo.sh | 50 | ||||
-rw-r--r-- | ci/utility/collectd_build_rpm.sh | 39 | ||||
-rw-r--r-- | ci/utility/collectd_get_sources.sh | 29 | ||||
-rw-r--r-- | ci/utility/intel_cmt_cat_build_install_rpm.sh | 50 | ||||
-rw-r--r-- | ci/utility/package-list.sh | 28 |
5 files changed, 196 insertions, 0 deletions
diff --git a/ci/utility/check_git_repo.sh b/ci/utility/check_git_repo.sh new file mode 100644 index 00000000..f7ad0a8f --- /dev/null +++ b/ci/utility/check_git_repo.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +TARGET_DIR=$1 +REPO=$2 + +if [[ ! $1 ]] +then + echo "Test if target dir contains the given git repository" + echo "Usage: $0 <TARGET_DIR> <REPO_ADDRESS>" + exit 254 +fi + +cd $TARGET_DIR +if [[ $? != 0 ]] +then + echo "Directory is not existing" + exit 1 +fi + +git status &>/dev/null +if [[ $? != 0 ]] +then + echo "Not a git repo" + exit 2 +else + REMOTE=`git remote -vv | sed -e "2d" -r -e 's|^\S+\s(\S+)\s\S+$|\1|'` + if [[ "$REMOTE" == "$REPO" ]] + then + echo "YEP" + exit 0 + else + echo "Wrong repo" + exit 3 + fi +fi + +exit 255 diff --git a/ci/utility/collectd_build_rpm.sh b/ci/utility/collectd_build_rpm.sh new file mode 100644 index 00000000..d46a73e6 --- /dev/null +++ b/ci/utility/collectd_build_rpm.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $DIR/package-list.sh + +VERSION="VERSION_NOT_SET" + +cd $COLLECTD_DIR +VERSION=$( $COLLECTD_DIR/version-gen.sh | sed "s/\W$//g" ) +$COLLECTD_DIR/build.sh +$COLLECTD_DIR/configure +make dist + +cp $COLLECTD_DIR/collectd-$VERSION.tar.bz2 $RPM_WORKDIR/SOURCES/ + +sed --regexp-extended \ + --in-place=".bak" \ + --expression="s/Version:\s+\S+$/Version: $VERSION/g" \ + $COLLECTD_DIR/contrib/redhat/collectd.spec + +sed --regexp-extended \ + --in-place \ + --expression="s/without_intel_rdt:[0-9]/without_intel_rdt:1/g" \ + $COLLECTD_DIR/contrib/redhat/collectd.spec + +rpmbuild --define "_topdir $RPM_WORKDIR" -bb $COLLECTD_DIR/contrib/redhat/collectd.spec diff --git a/ci/utility/collectd_get_sources.sh b/ci/utility/collectd_get_sources.sh new file mode 100644 index 00000000..69108e4f --- /dev/null +++ b/ci/utility/collectd_get_sources.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $DIR/package-list.sh + +bash $DIR/check_git_repo.sh $COLLECTD_DIR $COLLECTD_REPO +if [[ $? != 0 ]] +then + rm -rf $COLLECTD_DIR + git clone --branch $COLLECTD_BRANCH $COLLECTD_REPO $COLLECTD_DIR +else + cd $COLLECTD_DIR + git reset HEAD --hard + git pull + git checkout -f $COLLECTD_BRANCH +fi diff --git a/ci/utility/intel_cmt_cat_build_install_rpm.sh b/ci/utility/intel_cmt_cat_build_install_rpm.sh new file mode 100644 index 00000000..d0e8954e --- /dev/null +++ b/ci/utility/intel_cmt_cat_build_install_rpm.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $DIR/package-list.sh + +VERSION="v0.1.5-1" + +bash $DIR/check_git_repo.sh $CMTCAT_DIR $CMTCAT_REPO +if [[ $? != 0 ]] +then + rm -rf $CMTCAT_DIR + git clone --branch $CMTCAT_BRANCH $CMTCAT_REPO $CMTCAT_DIR +else + cd $CMTCAT_DIR + git reset HEAD --hard + git pull + git checkout -f $CMTCAT_BRANCH +fi + +cd $CMTCAT_DIR +make +sudo make install + +wget https://github.com/01org/intel-cmt-cat/archive/${VERSION}.tar.gz --directory-prefix=$CMTCAT_DIR + +mv $CMTCAT_DIR/${VERSION}.tar.gz $RPM_WORKDIR/SOURCES/ + +rpmbuild --define "_topdir $RPM_WORKDIR" -bb $CMTCAT_DIR/rpm/intel-cmt-cat.spec + +rpm -q intel-cmt-cat +if [ $? -eq 0 ] +then + echo "*** intel-cmt-cat is already installed" +else + RPM_NAME=`ls -1 $RPM_DIR | grep -E "cmt-cat-[0-9]"` + rpm -ivf $RPM_DIR/$RPM_NAME +fi diff --git a/ci/utility/package-list.sh b/ci/utility/package-list.sh new file mode 100644 index 00000000..9f878431 --- /dev/null +++ b/ci/utility/package-list.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +WORKSPACE=${WORKSPACE:-`cd && pwd`} + +COLLECTD_DIR=$WORKSPACE/collectd +CMTCAT_DIR=$WORKSPACE/intel-cmt-cat +RPM_WORKDIR=$WORKSPACE/rpmbuild + +CMTCAT_REPO=https://github.com/01org/intel-cmt-cat.git +CMTCAT_BRANCH=master +COLLECTD_REPO=https://github.com/collectd/collectd.git +COLLECTD_BRANCH=master + +# Here rpms built could be taken from +RPM_DIR=$RPM_WORKDIR/RPMS/x86_64/ |