On Thu, 2012-03-22 at 10:07 +0100, Miroslav Rezanina wrote: > I use to call get_started script after autotest update to have correct setup. > Unfortunately, it does not update config files in case sample version changed. > To ensure this, I have to deleate these config files to get them updated. > > Here's patch that check if sample and used version differ and print diff > in case they do with question to use this sample. It's first version that > just replace config file with sample. It's usable in 90% of case as I usualy > modify only tests.cfg. > > What do you think, is this usefull feature? Or would be better to try merge > configs instead of replace with sample?
Ok Miroslav, I think this is a good idea, I've made some modifications to your original sketch and commited upstream: https://github.com/autotest/autotest/commit/0600853bea22955cbf6c7d7ac9ee7b222c340ed7 Thank you! > Regards, > Miroslav Rezanina > > Patch: > --- > diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py > index 16125b7..a3ac164 100644 > --- a/client/virt/virt_utils.py > +++ b/client/virt/virt_utils.py > @@ -3564,7 +3564,21 @@ def virt_test_assistant(test_name, test_dir, base_dir, > de > logging.debug("Creating config file %s from sample", dst_file) > shutil.copyfile(src_file, dst_file) > else: > - logging.debug("Config file %s exists, not touching" % dst_file) > + diff_result = utils.run("diff %s %s" % (src_file, dst_file), > + ignore_status=True) > + if diff_result.exit_status != 0: > + logging.debug("%s result:\n %s" % > + (diff_result.command,diff_result.stdout)) > + answer = utils.ask("Config file %s differs from %s. > Overwrite? > + % (dst_file,src_file)) > + if answer == "y": > + logging.debug("Restoring config file %s from sample" > + % dst_file) > + shutil.copyfile(src_file, dst_file) > + else: > + logging.debug("Preserving existing %s file" % dst_file) > + else: > + logging.debug("Config file %s exists, not touching" % > dst_file) > > logging.info("") > step += 1 > > _______________________________________________ > Autotest mailing list > [email protected] > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
