Commit 8766cf14 authored by Yuan Gao's avatar Yuan Gao
Browse files

Update rpm changelog for v1.23-2, fix circleCI build issue

parent 47506a75
......@@ -10,23 +10,18 @@ commands:
runtest:
steps:
- checkout
- restore_cache:
key: efs-utils-{{ .Branch }}-{{ checksum "requirements.txt" }}
- run:
name: Install Python dependencies in a virtual env
command: |
python -m pip install --user virtualenv
python -m virtualenv ~/.env/efs-utils
source ~/.env/efs-utils/bin/activate
sudo pip install --upgrade pip
pip install virtualenv
virtualenv -p $(which python) ~/efs-utils-virtualenv
source ~/efs-utils-virtualenv/bin/activate
pip install -r requirements.txt
- save_cache:
key: efs-utils-{{ .Branch }}-{{ checksum "requirements.txt" }}
paths:
- ~/.env/efs-utils
- run:
name: Run all tests
command: |
source ~/.env/efs-utils/bin/activate
source ~/efs-utils-virtualenv/bin/activate
make test
jobs:
test:
......
......@@ -8,3 +8,4 @@
[global]
version=1.23
release=2
......@@ -21,7 +21,7 @@
Name : amazon-efs-utils
Version : 1.23
Release : 1%{?dist}
Release : 2%{?dist}
Summary : This package provides utilities for simplifying the use of EFS file systems
Group : Amazon/Tools
......@@ -117,3 +117,9 @@ fi
%endif
%clean
%changelog
* Tue Mar 02 2020 Yuan Gao <ygaochn@amazon.com> - 1.23-2
- Support new option: netns, enable file system to mount in given network namespace
- Support new option: awscredsuri, enable sourcing iam authorization from aws credentials relative uri
- List openssl and util-linux as package dependency for IAM/AP authorization and command nsenter to mount file system to given network namespace
......@@ -15,12 +15,13 @@ except ImportError:
FILE_LIST = ['src/watchdog/__init__.py', 'src/mount_efs/__init__.py', 'dist/amazon-efs-utils.spec',
'dist/amazon-efs-utils.control', 'build-deb.sh']
RPM_FILE = 'dist/amazon-efs-utils.spec'
GLOBAL_CONFIG = 'config.ini'
def test_global_version_match():
global_version = get_global_version()
global_version = get_global_value('version')
for f in FILE_LIST:
version_in_file = get_version_for_file(f)
......@@ -28,6 +29,31 @@ def test_global_version_match():
'version in {} is {}, does not match global version {}'.format(f, version_in_file, global_version)
def test_changelog_version_match():
global_version = get_global_value('version')
global_release = get_global_value('release')
expected_version_release = global_version + '-' + global_release
version_release_in_changelog = get_version_for_changelog(RPM_FILE)
assert version_release_in_changelog is not None and version_release_in_changelog == expected_version_release, \
'version in {} is {}, does not match expected_version_release {}, you need to add changelog in the spec file'\
.format(RPM_FILE, version_release_in_changelog, expected_version_release)
def get_version_for_changelog(file_path):
mount_helper_root_folder = uppath(os.path.abspath(__file__), 3)
file_to_check = os.path.join(mount_helper_root_folder, file_path)
has_changelog = False
with open(file_to_check) as fp:
lines = fp.readlines()
for line in lines:
if line.startswith('%changelog'):
has_changelog = True
if has_changelog and line.startswith('*'):
return line.split(' ')[-1].strip()
return None
def get_version_for_file(file_path):
mount_helper_root_folder = uppath(os.path.abspath(__file__), 3)
file_to_check = os.path.join(mount_helper_root_folder, file_path)
......@@ -41,12 +67,12 @@ def get_version_for_file(file_path):
return None
def get_global_version():
def get_global_value(key):
mount_helper_root_folder = uppath(os.path.abspath(__file__), 3)
config_file = os.path.join(mount_helper_root_folder, GLOBAL_CONFIG)
cp = read_config(config_file)
version = str(cp.get('global', 'version'))
return version
value = str(cp.get('global', key))
return value
# Given: path : file path
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment