forked from Seagate/cortx-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bash script for creating py-utils test rpm. (Seagate#692)
* Bash script for creating test rpm. Signed-off-by: Veerendra Garikipati <[email protected]> * updating copyright year to 2022 Signed-off-by: Veerendra Garikipati <[email protected]> Co-authored-by: Sachin Punadikar <[email protected]> Signed-off-by: suryakumar.kumaravelan <[email protected]>
- Loading branch information
1 parent
171df19
commit a15afba
Showing
6 changed files
with
103 additions
and
15 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,77 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2022 Seagate Technology LLC and/or its Affiliates | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# For any questions about this software or licensing, | ||
# please email [email protected] or [email protected]. | ||
|
||
set -e | ||
PROG_NAME=$(basename "$0") | ||
BASE_DIR=$(realpath $(dirname "$0")/../py-utils/test) | ||
BUILD_NUMBER= | ||
GIT_VER= | ||
|
||
#Following Install_path should be in sync with cortx.conf.sample config file. | ||
INSTALL_PATH=/opt/seagate | ||
|
||
usage() { | ||
echo """usage: $PROG_NAME [-v version] [-g git_version] [-b build_number]""" 1>&2; | ||
exit 1; | ||
} | ||
|
||
# Check for passed in arguments | ||
while getopts ":g:v:b:" o; do | ||
case "${o}" in | ||
v) | ||
VER=${OPTARG} | ||
;; | ||
g) | ||
GIT_VER=${OPTARG} | ||
;; | ||
b) | ||
BUILD_NUMBER=${OPTARG} | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
done | ||
|
||
[ -z $"$GIT_VER" ] && GIT_VER="$(git rev-parse --short HEAD)" \ | ||
|| GIT_VER="${GIT_VER}_$(git rev-parse --short HEAD)" | ||
[ -z "$VER" ] && VER="1.0.0" | ||
[ -z "$BUILD_NUMBER" ] && BUILD_NUMBER=1 | ||
REL="${BUILD_NUMBER}_${GIT_VER}" | ||
|
||
# Change cwd to py-utils/test | ||
cd "$BASE_DIR" | ||
|
||
# Create version file | ||
echo $VER > VERSION | ||
/bin/chmod +rx VERSION | ||
|
||
# Update install_path in test-post-install | ||
sed -i -e "s|<INSTALL_PATH>|${INSTALL_PATH}|g" test-post-install | ||
|
||
# Update install_path in test-post-uninstall | ||
sed -i -e "s|<INSTALL_PATH>|${INSTALL_PATH}|g" test-post-uninstall | ||
|
||
echo "Creating cortx-py-utils-test RPM with version $VER, release $REL" | ||
|
||
# Create the rpm | ||
/bin/python3.6 setup.py bdist_rpm --requires cortx-py-utils \ | ||
--release="$REL" --post-install test-post-install \ | ||
--post-uninstall test-post-uninstall | ||
if [ $? -ne 0 ]; then | ||
echo "build failed" | ||
exit 1 | ||
fi |
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
Empty file.
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 |
---|---|---|
|
@@ -13,22 +13,23 @@ | |
# For any questions about this software or licensing, | ||
# please email [email protected] or [email protected]. | ||
|
||
from setuptools import setup | ||
import os | ||
import sys | ||
from setuptools import setup | ||
|
||
|
||
if not os.path.isfile("./VERSION"): | ||
print("error: VERSION file not found!", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
# Get the version string from command line | ||
version = "1.0.0" | ||
for arg in sys.argv: | ||
if arg.startswith("--version") or arg.startswith("-v"): | ||
version = arg.split("=")[1] | ||
sys.argv.remove(arg) | ||
# Fetch version | ||
with open("VERSION") as v_file: | ||
utils_version = v_file.read().strip() | ||
|
||
|
||
setup( | ||
name="cortx-py-utils-test", | ||
version=version, | ||
version=utils_version, | ||
url="https://github.com/Seagate/cortx-utils/py-utils/test", | ||
license="Seagate", | ||
author="Seagate Foundation Team", | ||
|
@@ -61,6 +62,7 @@ | |
], | ||
package_data={ | ||
"": [ | ||
"VERSION", | ||
"plans/*.pln", | ||
"ha_dm/*.json", | ||
"ha_dm/test_schema/*.json", | ||
|
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 |
---|---|---|
|
@@ -14,8 +14,8 @@ | |
# For any questions about this software or licensing, | ||
# please email [email protected] or [email protected]. | ||
|
||
# Replace /opt/seagate with cortx installation path example: /opt/seagate | ||
install_path=/opt/seagate | ||
## Replace INSTALL_PATH with cortx installation path. example: /opt/seagate | ||
install_path=<INSTALL_PATH> | ||
cortx_path=$install_path/cortx/ | ||
utils_path=$cortx_path/utils | ||
|
||
|
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 |
---|---|---|
|
@@ -14,9 +14,14 @@ | |
# For any questions about this software or licensing, | ||
# please email [email protected] or [email protected]. | ||
|
||
## Replace INSTALL_PATH with cortx installation path. example: /opt/seagate | ||
install_path=<INSTALL_PATH> | ||
cortx_path=$install_path/cortx/ | ||
utils_path=$cortx_path/utils | ||
|
||
# Take action only in case of un-install | ||
if [ $1 == 0 ] | ||
then | ||
# Remove the files we have created | ||
/bin/rm -f /opt/seagate/cortx/utils/bin/run_test | ||
# Removes the files created by test rpm | ||
/bin/rm -f $utils_path/bin/run_test | ||
fi |