7006574 DC build should complain if "none" is not a valid option for LiveCDPkgImgMod
7012568 DC should call InstallLogger.close()
7011261 distro_const shouldn't timestamp build -l output
7035137 ba-init complains about comments in boot_archive_contents*.xml during DC builds.
7010046 Checkpoints inconsistently 'announce' themselves
--- a/usr/src/cmd/distro_const/__init__.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/cmd/distro_const/__init__.py Fri Apr 15 16:11:46 2011 -0600
@@ -173,7 +173,7 @@
return (options, args)
-def set_stream_handler(DC_LOGGER, verbose):
+def set_stream_handler(DC_LOGGER, list_cps, verbose):
""" function to setup the stream_handler of the logging module for output
to the screen.
"""
@@ -186,9 +186,15 @@
else:
screen_sh.setLevel(logging.INFO)
- fmt = "%(asctime)-11s %(message)s"
- datefmt = "%H:%M:%S"
- screen_sh.setFormatter(DCScreenHandler(fmt=fmt, datefmt=datefmt))
+ # set the columns. If the user only wants to list the checkpoints, omit
+ # the timestamps
+ if list_cps:
+ fmt = "%(message)s"
+ screen_sh.setFormatter(DCScreenHandler(fmt=fmt))
+ else:
+ fmt = "%(asctime)-11s %(message)s"
+ datefmt = "%H:%M:%S"
+ screen_sh.setFormatter(DCScreenHandler(fmt=fmt, datefmt=datefmt))
DC_LOGGER.addHandler(screen_sh)
@@ -541,6 +547,7 @@
resume_checkpoint = None
verbose = options.verbose
+ list_cps = options.list_checkpoints
try:
# We initialize the Engine with stop_on_error set so that if there are
@@ -571,7 +578,7 @@
DC_LOGGER.info("distro_const will pause at: " + pause_checkpoint)
# create a simple StreamHandler to output messages to the screen
- set_stream_handler(DC_LOGGER, verbose)
+ set_stream_handler(DC_LOGGER, list_cps, verbose)
base_dataset = None
@@ -584,7 +591,7 @@
zpool_name, base_dataset, base_action, base_dataset_mp = \
validate_target()
- if options.list_checkpoints:
+ if list_cps:
# set the execute flag of setup_build_dataset to 'False'
# to prevent any actions from occuring. The TI checkpoint
# needs to be registered with the engine for list_checkpoints
@@ -650,5 +657,8 @@
# DC_LOGGER hasn't even been setup and we ran into an error
print msg
return 1
+ finally:
+ if DC_LOGGER is not None:
+ DC_LOGGER.close()
return 0
--- a/usr/src/cmd/distro_const/checkpoints/boot_archive_archive.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/cmd/distro_const/checkpoints/boot_archive_archive.py Fri Apr 15 16:11:46 2011 -0600
@@ -292,7 +292,7 @@
# create a new TransferCPIOAttr object to copy every file from
# boot_archive to the lofi mountpoint.
- tr_attr = TransferCPIOAttr("CPIO transfer")
+ tr_attr = TransferCPIOAttr("Archive Population")
# set the transfer src correctly
tr_attr.src = self.ba_build
--- a/usr/src/cmd/distro_const/checkpoints/pkg_img_mod.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/cmd/distro_const/checkpoints/pkg_img_mod.py Fri Apr 15 16:11:46 2011 -0600
@@ -53,12 +53,17 @@
"""
DEFAULT_ARG = {"compression_type": "gzip"}
+ VALID_COMPRESSION = ["gzip", "lzma"]
def __init__(self, name, arg=DEFAULT_ARG):
super(PkgImgMod, self).__init__(name)
self.compression_type = arg.get("compression_type",
- self.DEFAULT_ARG.get(
- "compression_type"))
+ self.DEFAULT_ARG.get("compression_type"))
+
+ if self.compression_type not in self.VALID_COMPRESSION:
+ raise RuntimeError("invalid compression_type: " +
+ self.compression_type)
+
self.dist_iso_sort = arg.get("dist_iso_sort")
# instance attributes
--- a/usr/src/cmd/distro_const/checkpoints/test/test_custom_script.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/cmd/distro_const/checkpoints/test/test_custom_script.py Fri Apr 15 16:11:46 2011 -0600
@@ -135,11 +135,14 @@
reset_engine(self.engine)
self.engine = get_new_engine_instance()
+ self.doc = self.engine.data_object_cache
+
+ d = {"pkg_img_path": "/tmp", "ba_build": "/tmp"}
+ dc_dict = DataObjectDict("DC specific", d, generate_xml=False)
+ self.doc.volatile.insert_children(dc_dict)
self.custom_script = CustomScript("Custom Script", "echo Hello")
- self.doc = self.engine.data_object_cache
-
self.dict_parent = SimpleDataObject("dicts")
dd = DataObjectDict("TestDict", dict())
--- a/usr/src/cmd/distro_const/checkpoints/test/test_distro_const.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/cmd/distro_const/checkpoints/test/test_distro_const.py Fri Apr 15 16:11:46 2011 -0600
@@ -220,7 +220,8 @@
""" verify the log level of the StreamHander is INFO
"""
verbose = False
- dc.set_stream_handler(self.logger, verbose)
+ list_cps = True
+ dc.set_stream_handler(self.logger, list_cps, verbose)
# the StreamHandler will be the last entry in the handlers list
self.assertTrue(self.logger.handlers[-1].level == logging.INFO)
@@ -229,7 +230,8 @@
""" verify the log level of the StreamHander is DEBUG
"""
verbose = True
- dc.set_stream_handler(self.logger, verbose)
+ list_cps = True
+ dc.set_stream_handler(self.logger, list_cps, verbose)
# the StreamHandler will be the last entry in the handlers list
self.assertTrue(self.logger.handlers[-1].level == logging.DEBUG)
--- a/usr/src/lib/install_transfer/cpio.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/lib/install_transfer/cpio.py Fri Apr 15 16:11:46 2011 -0600
@@ -178,10 +178,9 @@
'''Execute method for the CPIO checkpoint module. Will read the
input parameters and perform the specified transfer.
'''
+ self.logger.info("=== Executing %s Checkpoint ===" % self.name)
if self.give_progress:
self.logger.report_progress("Beginning CPIO transfer", 0)
- else:
- self.logger.debug("Beginning CPIO transfer")
self.dry_run = dry_run
--- a/usr/src/lib/install_transfer/info.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/lib/install_transfer/info.py Fri Apr 15 16:11:46 2011 -0600
@@ -129,40 +129,37 @@
if action is None:
action = IPSSpec.INSTALL
- pkg_list = []
- names = sub.getchildren()
-
- for name in names:
+ pkg_list = list()
+ for name in sub.iterchildren(tag="name"):
pkg_list.append(name.text.strip('"'))
transfer_obj.action = action
transfer_obj.contents = pkg_list
elif val == "CPIO":
+ transfer_obj = CPIOSpec()
action = sub.get(CPIOSpec.CPIOSPEC_ACTION_LABEL)
- transfer_obj = CPIOSpec()
+
+ if action is None:
+ action = CPIOSpec.INSTALL
# A file_list transfer is specified in the manifest.
- names = sub.getchildren()
- if len(names) > 0:
- file_list = list()
-
- for name in names:
+ file_list = list()
+ for name in sub.iterchildren(tag="name"):
file_list.append(name.text.strip('"'))
transfer_obj.contents = file_list
transfer_obj.action = action
elif val == "SVR4":
+ transfer_obj = SVR4Spec()
action = sub.get(SVR4Spec.SVR4_ACTION_LABEL)
- transfer_obj = SVR4Spec()
if action is None:
- action = "install"
+ action = SVR4Spec.INSTALL
- pkg_list = []
- names = sub.getchildren()
- for name in names:
+ pkg_list = list()
+ for name in sub.iterchildren(tag="name"):
pkg_list.append(name.text.strip('"'))
transfer_obj.action = action
@@ -475,6 +472,8 @@
SOFTWARE_DATA_LABEL = "software_data"
CPIOSPEC_ACTION_LABEL = "action"
CPIOSPEC_NAME_LABEL = "name"
+ INSTALL = "install"
+ UNINSTALL = "uninstall"
def __init__(self, action=None, contents=None):
@@ -689,6 +688,8 @@
SVR4_TRANSFER_LABEL = "transfer"
SVR4_ACTION_LABEL = "action"
SVR4_NAME_LABEL = "name"
+ INSTALL = "install"
+ UNINSTALL = "uninstall"
def __init__(self, action=None, contents=None):
super(SVR4Spec, self).__init__(SVR4Spec.SVR4_TRANSFER_LABEL)
--- a/usr/src/lib/install_transfer/ips.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/lib/install_transfer/ips.py Fri Apr 15 16:11:46 2011 -0600
@@ -201,11 +201,10 @@
'''Execute method for the IPS checkpoint module. Will read the
input parameters and perform the specified transfer.
'''
+ self.logger.info("=== Executing %s Checkpoint ===" % self.name)
try:
if self.give_progress:
self.logger.report_progress("Beginning IPS transfer", 0)
- else:
- self.logger.debug("Beginning IPS transfer")
self.dry_run = dry_run
--- a/usr/src/lib/install_transfer/svr4.py Thu Apr 14 15:24:56 2011 -0600
+++ b/usr/src/lib/install_transfer/svr4.py Fri Apr 15 16:11:46 2011 -0600
@@ -132,11 +132,9 @@
'''Execute method for the SVR4 checkpoint module. Will read the
input parameters and perform the specified transfer.
'''
- self.logger.debug("Starting SVR4 transfer")
+ self.logger.info("=== Executing %s Checkpoint ===" % self.name)
if self.give_progress:
self.logger.report_progress("Beginning SVR4 transfer", 0)
- else:
- self.logger.debug("Beginning SVR4 transfer")
self.dry_run = dry_run
try: