def test_debug(self): config = Config(read=False) config.root = self.use_temp_dir() config["PROJECT"] = "ubuntu" config["DIST"] = "warty" config["DEBUG"] = "1" os.mkdir(os.path.join(self.temp_dir, "etc")) stamp = os.path.join(config.root, "etc", ".next-build-suffix-ubuntu-warty-daily") self.assertFalse(os.path.exists(stamp)) next_build_id(config, "daily") self.assertFalse(os.path.exists(stamp))
def test_increment(self): config = Config(read=False) config.root = self.use_temp_dir() config["PROJECT"] = "ubuntu" config["DIST"] = "warty" config["DATE"] = "20120806" os.mkdir(os.path.join(self.temp_dir, "etc")) stamp = os.path.join(config.root, "etc", ".next-build-suffix-ubuntu-warty-daily-live") self.assertFalse(os.path.exists(stamp)) self.assertEqual("20120806", next_build_id(config, "daily-live")) with open(stamp) as stamp_file: self.assertEqual("20120806:1\n", stamp_file.read()) self.assertEqual("20120806.1", next_build_id(config, "daily-live")) with open(stamp) as stamp_file: self.assertEqual("20120806:2\n", stamp_file.read())
def test_defaults(self, *args): config = Config(read=False) config.root = self.use_temp_dir() config["PROJECT"] = "ubuntu" config["DIST"] = "warty" os.mkdir(os.path.join(self.temp_dir, "etc")) stamp = os.path.join(config.root, "etc", ".next-build-suffix-ubuntu-warty-daily") self.assertFalse(os.path.exists(stamp)) self.assertEqual("20130225", next_build_id(config, "")) with open(stamp) as stamp_file: self.assertEqual("20130225:1\n", stamp_file.read())
def test_chinese(self, *args): config = Config(read=False) config.root = self.use_temp_dir() config["PROJECT"] = "ubuntu" config["DIST"] = "raring" config["UBUNTU_DEFAULTS_LOCALE"] = "zh_CN" os.mkdir(os.path.join(self.temp_dir, "etc")) stamp = os.path.join( config.root, "etc", ".next-build-suffix-ubuntu-chinese-edition-raring-daily") self.assertFalse(os.path.exists(stamp)) self.assertEqual("20130225", next_build_id(config, "")) with open(stamp) as stamp_file: self.assertEqual("20130225:1\n", stamp_file.read())
def build_image_set_locked(config, options, multipidfile_state): image_type = config.image_type config["CDIMAGE_DATE"] = date = next_build_id(config, image_type) log_path = None try: configure_for_project(config) log_path = open_log(config) if want_live_builds(options): log_marker("Building live filesystems") live_successful = run_live_builds(config) config.limit_arches(live_successful) else: tracker_set_rebuild_status(config, [0, 1], 2) if not is_live_fs_only(config): sync_local_mirror(config, multipidfile_state) if config["LOCAL"]: log_marker("Updating archive of local packages") update_local_indices(config) build_britney(config) log_marker("Extracting debootstrap scripts") extract_debootstrap(config) if config["UBUNTU_DEFAULTS_LOCALE"]: build_ubuntu_defaults_locale(config) elif is_live_fs_only(config): build_livecd_base(config) else: if not config["CDIMAGE_PREINSTALLED"]: log_marker("Germinating") germination = Germination(config) germination.run() log_marker("Generating new task lists") germinate_output = germination.output(config.project) germinate_output.write_tasks() log_marker("Checking for other task changes") germinate_output.update_tasks(date) if (config["CDIMAGE_LIVE"] or config["CDIMAGE_SQUASHFS_BASE"] or config["CDIMAGE_PREINSTALLED"]): log_marker("Downloading live filesystem images") download_live_filesystems(config) configure_splash(config) run_debian_cd(config) fix_permissions(config) # Temporarily turned off for live builds. if (config["CDIMAGE_INSTALL_BASE"] and not config["CDIMAGE_ADDON"] and not config["CDIMAGE_PREINSTALLED"]): log_marker("Producing installability report") check_installable(config) if not config["DEBUG"] and not config["CDIMAGE_NOPUBLISH"]: log_marker("Publishing") tree = Tree.get_daily(config) publisher = Publisher.get_daily(tree, image_type) publisher.publish(date) log_marker("Purging old images") publisher.purge() log_marker("Triggering mirrors") trigger_mirrors(config) log_marker("Finished") return True except Exception as e: for line in traceback.format_exc().splitlines(): logger.error(line) sys.stdout.flush() sys.stderr.flush() if not isinstance(e, LiveBuildsFailed): notify_failure(config, log_path) return False