Only install necessary packages using cpt if missing requirements

and cleanup .travis.yml
This commit is contained in:
Pratyush Das 2019-09-25 09:00:04 +05:30 committed by SFT
parent 9dab6e5850
commit 8482b60697
2 changed files with 139 additions and 106 deletions

View File

@ -53,8 +53,7 @@ matrix:
env: COMPILER=clang++ CCOMPILER=clang
osx_image: xcode11
before_install:
- brew install swig;
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
- curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
source ./macports-ci install
compiler: clang
@ -82,8 +81,7 @@ matrix:
packages: gcc@7
update: true
before_install:
- brew install swig;
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
- curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
source ./macports-ci install
compiler: gcc-7
@ -107,8 +105,7 @@ matrix:
env: COMPILER=clang++ CCOMPILER=clang
osx_image: xcode9.3
before_install:
- brew install swig;
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
- curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci;
source ./macports-ci install
compiler: clang
@ -189,7 +186,7 @@ script:
if [ -z $TRAVIS_TAG ]; then
TIMEOUTEXE=`which timeout`;
if [ "x" = "x$TIMEOUTEXE" ] ; then TIMEOUTEXE=gtimeout; fi
$TIMEOUTEXE -s SIGTERM $TIMEOUT echo yes | tools/packaging/cpt.py \
$TIMEOUTEXE -s SIGTERM $TIMEOUT tools/packaging/cpt.py -y \
--check-requirements \
--current-dev=tar \
--with-cling-url=https://github.com/$TRAVIS_REPO_SLUG \
@ -198,7 +195,7 @@ script:
--with-cmake-flags="$CLING_BUILD_FLAGS" \
--skip-cleanup
else
echo yes | tools/packaging/cpt.py \
tools/packaging/cpt.py -y \
--check-requirements \
--tarball-tag=$([[ $TRAVIS_TAG = cling-nightlies ]] && echo "master" || echo "$TRAVIS_TAG") \
--with-cling-url=https://github.com/$TRAVIS_REPO_SLUG \

View File

@ -707,17 +707,22 @@ def check_ubuntu(pkg):
SIGNING_USER = exec_subprocess_check_output('gpg --fingerprint | grep uid | sed s/"uid *"//g', '/').strip()
if SIGNING_USER == '':
print(pkg.ljust(20) + '[INSTALLED - NOT SETUP]'.ljust(30))
return True
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
elif pkg == "python":
if float(platform.python_version()[:3]) < 2.7:
print(pkg.ljust(20) + '[OUTDATED VERSION (<2.7)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
elif pkg == "cmake":
CMAKE = os.environ.get('CMAKE', 'cmake')
if not check_version_string_ge(exec_subprocess_check_output('{cmake} --version'.format(cmake=CMAKE), '/').strip().split('\n')[0].split()[-1], '3.4.3'):
print(pkg.ljust(20) + '[OUTDATED VERSION (<3.4.3)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
elif pkg == "SSL":
@ -726,28 +731,37 @@ def check_ubuntu(pkg):
import socket
if hasattr(socket, 'ssl'):
print(pkg.ljust(20) + '[SUPPORTED]'.ljust(30))
return True
else:
print(pkg.ljust(20) + '[NOT SUPPORTED]'.ljust(30))
return False
else:
# Python 3.x
print(pkg.ljust(20) + '[SUPPORTED]'.ljust(30))
return True
elif exec_subprocess_check_output("dpkg-query -W -f='${Status}' %s 2>/dev/null | grep -c 'ok installed'" % (pkg),
'/').strip() == '0':
print(pkg.ljust(20) + '[NOT INSTALLED]'.ljust(30))
return False
else:
if pkg == "gcc":
if float(exec_subprocess_check_output('gcc -dumpversion', '/')[:3].strip()) <= 4.7:
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (<4.7)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
elif pkg == "g++":
if float(exec_subprocess_check_output('g++ -dumpversion', '/')[:3].strip()) <= 4.7:
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (<4.7)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
def tarball_deb():
@ -990,14 +1004,18 @@ def check_redhat(pkg):
if pkg == "python":
if platform.python_version()[0] == '3':
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (Python 3)]'.ljust(30))
return False
elif float(platform.python_version()[:3]) < 2.7:
print(pkg.ljust(20) + '[OUTDATED VERSION (<2.7)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
elif pkg == "cmake":
CMAKE = os.environ.get('CMAKE', 'cmake')
if not check_version_string_ge(exec_subprocess_check_output('{cmake} --version'.format(cmake=CMAKE), '/').strip().split('\n')[0].split()[-1], '3.4.3'):
print(pkg.ljust(20) + '[OUTDATED VERSION (<3.4.3)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
elif pkg == "SSL":
@ -1006,28 +1024,37 @@ def check_redhat(pkg):
import socket
if hasattr(socket, 'ssl'):
print(pkg.ljust(20) + '[SUPPORTED]'.ljust(30))
return True
else:
print(pkg.ljust(20) + '[NOT SUPPORTED]'.ljust(30))
return False
else:
# Python 3.x
print(pkg.ljust(20) + '[SUPPORTED]'.ljust(30))
return True
elif exec_subprocess_check_output("rpm -qa | grep -w %s" % (pkg), '/').strip() == '':
print(pkg.ljust(20) + '[NOT INSTALLED]'.ljust(30))
return False
else:
if pkg == "gcc-c++":
if float(exec_subprocess_check_output('g++ -dumpversion', '/')[:3].strip()) <= 4.7:
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (<4.7)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
elif pkg == "gcc":
if float(exec_subprocess_check_output('gcc -dumpversion', '/')[:3].strip()) <= 4.7:
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (<4.7)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
def rpm_build():
@ -1492,14 +1519,18 @@ def check_mac(pkg):
if pkg == "python":
if platform.python_version()[0] == '3':
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (Python 3)]'.ljust(30))
return False
elif float(platform.python_version()[:3]) < 2.7:
print(pkg.ljust(20) + '[OUTDATED VERSION (<2.7)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
elif pkg == "cmake":
CMAKE = os.environ.get('CMAKE', 'cmake')
if not check_version_string_ge(exec_subprocess_check_output('{cmake} --version'.format(cmake=CMAKE), '/').strip().split('\n')[0].split()[-1].split('-')[0], '3.4.3'):
print(pkg.ljust(20) + '[OUTDATED VERSION (<3.4.3)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
elif pkg == "SSL":
@ -1508,27 +1539,36 @@ def check_mac(pkg):
import socket
if hasattr(socket, 'ssl'):
print(pkg.ljust(20) + '[SUPPORTED]'.ljust(30))
return True
else:
print(pkg.ljust(20) + '[NOT SUPPORTED]'.ljust(30))
return False
else:
# Python 3.x
print(pkg.ljust(20) + '[SUPPORTED]'.ljust(30))
return True
elif exec_subprocess_check_output("type -p %s" % (pkg), '/').strip() == '':
print(pkg.ljust(20) + '[NOT INSTALLED]'.ljust(30))
return False
else:
if pkg == "clang++":
if float(exec_subprocess_check_output('clang++ -dumpversion', '/')[:3].strip()) <= 4.1:
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (<4.1)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
elif pkg == "clang":
if float(exec_subprocess_check_output('clang -dumpversion', '/')[:3].strip()) <= 4.1:
print(pkg.ljust(20) + '[UNSUPPORTED VERSION (<4.1)]'.ljust(30))
return False
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
else:
print(pkg.ljust(20) + '[OK]'.ljust(30))
return True
def make_dmg():
@ -1838,45 +1878,42 @@ if not os.path.isdir(TMP_PREFIX):
if args['check_requirements']:
box_draw('Check availability of required softwares')
if DIST == 'Ubuntu':
check_ubuntu('git')
check_ubuntu('cmake')
check_ubuntu('gcc')
check_ubuntu('g++')
check_ubuntu('debhelper')
check_ubuntu('devscripts')
check_ubuntu('gnupg')
check_ubuntu('python')
check_ubuntu('SSL')
install_line = ""
prerequisite = ['git', 'cmake', 'gcc', 'g++', 'debhelper', 'devscripts', 'gnupg', 'python', 'SSL']
for pkg in prerequisite:
if check_ubuntu(pkg) is False:
install_line += pkg + ' '
yes = {'yes', 'y', 'ye', ''}
no = {'no', 'n'}
choice = custom_input('''
CPT will now attempt to update/install the requisite packages automatically.
Do you want to continue? [yes/no]: ''', args['y']).lower()
while True:
if choice in yes:
# Need to communicate values to the shell. Do not use exec_subprocess_call()
subprocess.Popen(['sudo apt-get update'],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
subprocess.Popen(['sudo apt-get install git cmake gcc g++ debhelper devscripts gnupg python'],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
break
elif choice in no:
print('''
Install/update the required packages by:
sudo apt-get update
sudo apt-get install git cmake gcc g++ debhelper devscripts gnupg python
''')
break
else:
choice = custom_input("Please respond with 'yes' or 'no': ", args['y'])
continue
if install_line != '':
choice = custom_input('''
CPT will now attempt to update/install the requisite packages automatically.
Do you want to continue? [yes/no]: ''', args['y']).lower()
while True:
if choice in yes:
# Need to communicate values to the shell. Do not use exec_subprocess_call()
subprocess.Popen(['sudo apt-get update'],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
subprocess.Popen(['sudo apt-get install ' + install_line],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
break
elif choice in no:
print('''
Install/update the required packages by:
sudo apt-get update
sudo apt-get install git cmake gcc g++ debhelper devscripts gnupg python
''')
break
else:
choice = custom_input("Please respond with 'yes' or 'no': ", args['y'])
continue
elif OS == 'Windows':
check_win('git')
@ -1889,75 +1926,74 @@ Refer to the documentation of CPT for information on setting up your Windows env
[tools/packaging/README.md]
''')
elif DIST == 'Fedora' or DIST == 'Scientific Linux CERN SLC':
check_redhat('git')
check_redhat('cmake')
check_redhat('gcc')
check_redhat('gcc-c++')
check_redhat('rpm-build')
check_redhat('python')
check_redhat('SSL')
install_line = ''
prerequisite = ['git', 'cmake', 'gcc', 'gcc-c++', 'rpm-build', 'python', 'SSL']
for pkg in prerequisite:
if check_redhat(pkg) is False:
install_line += pkg + ' '
yes = {'yes', 'y', 'ye', ''}
no = {'no', 'n'}
choice = custom_input('''
CPT will now attempt to update/install the requisite packages automatically.
Do you want to continue? [yes/no]: ''', args['y']).lower()
while True:
if choice in yes:
# Need to communicate values to the shell. Do not use exec_subprocess_call()
subprocess.Popen(['sudo yum install git cmake gcc gcc-c++ rpm-build python'],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
break
elif choice in no:
print('''
Install/update the required packages by:
sudo yum install git cmake gcc gcc-c++ rpm-build python
''')
break
else:
choice = custom_input("Please respond with 'yes' or 'no': ", args['y'])
continue
if install_line != '':
choice = custom_input('''
CPT will now attempt to update/install the requisite packages automatically.
Do you want to continue? [yes/no]: ''', args['y']).lower()
while True:
if choice in yes:
# Need to communicate values to the shell. Do not use exec_subprocess_call()
subprocess.Popen(['sudo yum install ' + install_line],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
break
elif choice in no:
print('''
Install/update the required packages by:
sudo yum install git cmake gcc gcc-c++ rpm-build python
''')
break
else:
choice = custom_input("Please respond with 'yes' or 'no': ", args['y'])
continue
if DIST == 'MacOSX':
check_mac('git')
check_mac('cmake')
check_mac('clang')
check_mac('clang++')
check_mac('python')
check_mac('SSL')
prerequisite = ['git', 'cmake', 'clang', 'clang++', 'python', 'SSL']
install_line = ''
for pkg in prerequisite:
if check_mac(pkg) is False:
install_line += pkg + ' '
yes = {'yes', 'y', 'ye', ''}
no = {'no', 'n'}
choice = custom_input('''
CPT will now attempt to update/install the requisite packages automatically. Make sure you have MacPorts installed.
Do you want to continue? [yes/no]: ''', args['y']).lower()
while True:
if choice in yes:
# Need to communicate values to the shell. Do not use exec_subprocess_call()
subprocess.Popen(['sudo port -v selfupdate'],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
subprocess.Popen(['sudo port install git clang++ python'],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
break
elif choice in no:
print('''
Install/update the required packages by:
sudo port -v selfupdate
sudo port install git clang++ python
''')
break
else:
choice = custom_input("Please respond with 'yes' or 'no': ", args['y'])
continue
if install_line != '':
choice = custom_input('''
CPT will now attempt to update/install the requisite packages automatically. Make sure you have MacPorts installed.
Do you want to continue? [yes/no]: ''', args['y']).lower()
while True:
if choice in yes:
# Need to communicate values to the shell. Do not use exec_subprocess_call()
subprocess.Popen(['sudo port -v selfupdate'],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
subprocess.Popen(['sudo port install ' + install_line],
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
break
elif choice in no:
print('''
Install/update the required packages by:
sudo port -v selfupdate
sudo port install git clang++ python
''')
break
else:
choice = custom_input("Please respond with 'yes' or 'no': ", args['y'])
continue
if args['current_dev']:
travis_fold_start("git-clone")