def mark_artifact_sources_dirty(self, artifacts): """Given a list of artifacts this will mark all of their sources as dirty so that they will be rebuilt next time. """ sources = set() for artifact in artifacts: for source in artifact.sources: sources.add(self.to_source_filename(source)) if not sources: return con = self.connect_to_database() try: cur = con.cursor() cur.executemany( """ insert or replace into dirty_sources (source) values (?) """, [(x,) for x in sources], ) con.commit() finally: con.close() reporter.report_dirty_flag(True)
def operation(con): sources = [self.build_state.to_source_filename(x) for x in self.sources] cur = con.cursor() cur.execute(''' delete from dirty_sources where source in (%s) ''' % ', '.join(['?'] * len(sources)), list(sources)) cur.close() reporter.report_dirty_flag(False)
def clear_dirty_flag(self): """Clears the dirty flag for all sources.""" sources = [self.build_state.to_source_filename(x) for x in self.sources] con = self.get_connection() cur = con.cursor() cur.execute(''' delete from dirty_sources where source in (%s) ''' % ', '.join(['?'] * len(sources)), sources) cur.close() reporter.report_dirty_flag(False)
def operation(con): sources = set() for source in self.sources: sources.add(self.build_state.to_source_filename(source)) if not sources: return cur = con.cursor() cur.executemany(''' insert or replace into dirty_sources (source) values (?) ''', [(x,) for x in sources]) cur.close() reporter.report_dirty_flag(True)
def clear_dirty_flag(self): """Clears the dirty flag for all sources.""" sources = [self.build_state.to_source_filename(x) for x in self.sources] con = self.get_connection() cur = con.cursor() cur.execute( """ delete from dirty_sources where source in (%s) """ % ", ".join(["?"] * len(sources)), sources, ) cur.close() reporter.report_dirty_flag(False)
def mark_artifact_sources_dirty(self, artifacts): """Given a list of artifacts this will mark all of their sources as dirty so that they will be rebuilt next time. """ sources = set() for artifact in artifacts: for source in artifact.sources: sources.add(self.to_source_filename(source)) if not sources: return con = self.connect_to_database() try: cur = con.cursor() cur.executemany(''' insert or replace into dirty_sources (source) values (?) ''', [(x,) for x in sources]) con.commit() finally: con.close() reporter.report_dirty_flag(True)