Skip to content

Commit 223dc3a

Browse files
committed
[#3229] hammer.py prepare-system --just-configure
1 parent fe4fdcc commit 223dc3a

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

hammer.py

+23-16
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ def _change_postgresql_auth_method(connection_type, auth_method, hba_file):
14671467
connection_type, connection_type, auth_method, hba_file), cwd='/tmp')
14681468

14691469

1470-
def _configure_pgsql(system, features, revision):
1470+
def _configure_pgsql(system, revision, features):
14711471
""" Configure PostgreSQL DB """
14721472

14731473
if system == 'freebsd':
@@ -1618,17 +1618,31 @@ def require_minimum_package_version(package: str, minimum: str):
16181618
raise Exception(message)
16191619

16201620

1621-
def prepare_system_local(features, check_times, ignore_errors_for):
1621+
def prepare_system_local(features, check_times, ignore_errors_for, just_configure):
16221622
"""Prepare local system for Kea development based on requested features."""
1623+
system, revision = get_system_revision()
1624+
log.info(f'Preparing deps for {system} {revision}...')
1625+
1626+
if not just_configure:
1627+
install_packages_local(system, revision, features, check_times, ignore_errors_for)
1628+
1629+
if 'mysql' in features:
1630+
_configure_mysql(system, revision, features)
1631+
1632+
if 'pgsql' in features:
1633+
_configure_pgsql(system, revision, features)
1634+
1635+
log.info('Preparing deps completed successfully.')
1636+
1637+
1638+
def install_packages_local(system, revision, features, check_times, ignore_errors_for):
1639+
"""Install packages for Kea development based on requested features."""
16231640
env = os.environ.copy()
16241641
env['LANGUAGE'] = env['LANG'] = env['LC_ALL'] = 'C'
16251642

16261643
# Actions decided before installing packages, but run afterwards
16271644
deferred_functions = []
16281645

1629-
system, revision = get_system_revision()
1630-
log.info('Preparing deps for %s %s', system, revision)
1631-
16321646
# Check if package versions cannot be met.
16331647
if 'netconf' in features and 'netconf' not in ignore_errors_for:
16341648
require_minimum_package_version('cmake', '3.19')
@@ -1998,16 +2012,6 @@ def link_pg_config():
19982012
for f in deferred_functions:
19992013
f()
20002014

2001-
if 'mysql' in features:
2002-
_configure_mysql(system, revision, features)
2003-
2004-
if 'pgsql' in features:
2005-
_configure_pgsql(system, features, revision)
2006-
2007-
#execute('sudo rm -rf /usr/share/doc')
2008-
2009-
log.info('Preparing deps completed successfully.')
2010-
20112015

20122016
def prepare_system_in_vagrant(provider, system, revision, features, dry_run, check_times,
20132017
clean_start, ccache_dir=None):
@@ -2718,6 +2722,9 @@ def parse_args():
27182722
"dependencies and pre-configure the system. build command always first calls "
27192723
"prepare-system internally.",
27202724
parents=[parent_parser1, parent_parser2])
2725+
parser.add_argument('--just-configure', action='store_true',
2726+
help='Whether to prevent installation of packages and only proceed to set them up. '
2727+
'Only has an effect when preparing system locally, as opposed to inside vagrant.')
27212728
parser.add_argument('--ccache-dir', default=None,
27222729
help='Path to CCache directory on host system.')
27232730
parser.add_argument('--repository-url', default=None,
@@ -2931,7 +2938,7 @@ def prepare_system_cmd(args):
29312938
log.info('Enabled features: %s', ' '.join(features))
29322939

29332940
if args.provider == 'local':
2934-
prepare_system_local(features, args.check_times, args.ignore_errors_for)
2941+
prepare_system_local(features, args.check_times, args.ignore_errors_for, args.just_configure)
29352942
return
29362943

29372944
ccache_dir = _prepare_ccache_dir(args.ccache_dir, args.system, args.revision)

0 commit comments

Comments
 (0)