def should_make(self): """ Check the dependencies. Return true if this node has to be recompiled, i.e. if some dependency is modified. Nothing recursive is done here. """ if not self.date: return True for source_name in self.sources: source = self.set[source_name] # FIXME complain if source has been modified in an unplanned way # NB: we ignore the case source.date == None (missing dependency) here. # NB2: to be extra correct, equal (disk-precision) timestamps trigger a recompile. if source.date is not None and source.date >= self.date: if self.md5_for_source.has_key(source_name): if self.md5_for_source[ source_name] == rubber.util.md5_file(source_name): msg.debug(_( "while making %s: contents of %s unchanged, ignoring mtime" ) % (self.products[0], source_name), pkg="depend") continue msg.debug(_( "while making %s: contents of dependency %s changed, rebuilding" ) % (self.products[0], source_name), pkg="depend") return True msg.debug(_( "while making %s: timestamp of dependency %s changed, rebuilding" ) % (self.products[0], source_name), pkg="depend") return True return False
def real_make(self, force): rv = UNCHANGED patience = 5 primary_product = self.products[0] msg.debug(_("make %s -> %s") % (primary_product, str(self.sources)), pkg="depend") while patience > 0: # make our sources for source_name in self.sources: source = self.set[source_name] if source.making: # cyclic dependency -- drop for now, we will re-visit # this would happen while trying to remake the .aux in order to make the .bbl, for example msg.debug( _("while making %s: cyclic dependency on %s (pruned)") % (primary_product, source_name), pkg="depend") continue source_rv = source.make(force) if source_rv == ERROR: self.failed_dep = source.failed_dep msg.debug( _("while making %s: dependency %s could not be made") % (primary_product, source_name), pkg="depend") return ERROR elif source_rv == CHANGED: rv = CHANGED must_make = force or self.should_make() if not must_make: return rv # record MD5 hash of source files as we now actually start the build for source_name in self.md5_for_source.keys(): self.md5_for_source[source_name] = rubber.util.md5_file( source_name) # actually make if not self.run(): self.failed_dep = self return ERROR self.date = time.time() rv = CHANGED force = False patience -= 1 self.failed_dep = self msg.error(_("while making %s: file contents does not seem to settle") % self.products[0], pkg="depend") return ERROR
def real_make(self, force): rv = UNCHANGED patience = 5 primary_product = self.products[0] msg.debug(_("make %s -> %s") % (primary_product, str(self.sources)), pkg="depend") while patience > 0: # make our sources for source_name in self.sources: source = self.set[source_name] if source.making: # cyclic dependency -- drop for now, we will re-visit # this would happen while trying to remake the .aux in order to make the .bbl, for example msg.debug( _("while making %s: cyclic dependency on %s (pruned)") % (primary_product, source_name), pkg="depend", ) continue source_rv = source.make(force) if source_rv == ERROR: self.failed_dep = source.failed_dep msg.debug( _("while making %s: dependency %s could not be made") % (primary_product, source_name), pkg="depend", ) return ERROR elif source_rv == CHANGED: rv = CHANGED must_make = force or self.should_make() if not must_make: return rv # record MD5 hash of source files as we now actually start the build for source_name in self.md5_for_source.keys(): self.md5_for_source[source_name] = rubber.util.md5_file(source_name) # actually make if not self.run(): self.failed_dep = self return ERROR self.date = time.time() rv = CHANGED force = False patience -= 1 self.failed_dep = self msg.error(_("while making %s: file contents does not seem to settle") % self.products[0], pkg="depend") return ERROR
def should_make(self): """ Check the dependencies. Return true if this node has to be recompiled, i.e. if some dependency is modified. Nothing recursive is done here. """ if not self.date: return True for source_name in self.sources: source = self.set[source_name] # FIXME complain if source has been modified in an unplanned way # NB: we ignore the case source.date == None (missing dependency) here. # NB2: to be extra correct, equal (disk-precision) timestamps trigger a recompile. if source.date == None: msg.debug( _("Not rebuilding %s from %s: unknown source timestamp") % (self.products[0], source_name), pkg="depend", ) elif source.date < self.date: msg.debug(_("Not rebuilding %s from %s: up to date") % (self.products[0], source_name), pkg="depend") elif not self.md5_for_source.has_key(source_name): msg.debug( _("Rebuilding %s from %s: outdated, source not tracked") % (self.products[0], source_name), pkg="depend", ) return True elif self.md5_for_source[source_name] == None: msg.debug( _("Rebuilding %s from %s: outdated, previous source unknown") % (self.products[0], source_name), pkg="depend", ) return True elif self.md5_for_source[source_name] != rubber.util.md5_file(source_name): msg.debug( _("Rebuilding %s from %s: outdated, source really modified") % (self.products[0], source_name), pkg="depend", ) return True else: msg.debug( _("Not rebuilding %s from %s: outdated, but source unmodified") % (self.products[0], source_name), pkg="depend", ) return False
def should_make(self): """ Check the dependencies. Return true if this node has to be recompiled, i.e. if some dependency is modified. Nothing recursive is done here. """ if not self.date: return True for source_name in self.sources: source = self.set[source_name] # FIXME complain if source has been modified in an unplanned way # NB: we ignore the case source.date == None (missing dependency) here. # NB2: to be extra correct, equal (disk-precision) timestamps trigger a recompile. if source.date == None: msg.debug( _("Not rebuilding %s from %s: unknown source timestamp") % (self.products[0], source_name), pkg="depend") elif source.date < self.date: msg.debug(_("Not rebuilding %s from %s: up to date") % (self.products[0], source_name), pkg="depend") elif not self.md5_for_source.has_key(source_name): msg.debug( _("Rebuilding %s from %s: outdated, source not tracked") % (self.products[0], source_name), pkg="depend") return True elif self.md5_for_source[source_name] == None: msg.debug(_( "Rebuilding %s from %s: outdated, previous source unknown") % (self.products[0], source_name), pkg="depend") return True elif self.md5_for_source[source_name] != rubber.util.md5_file( source_name): msg.debug( _("Rebuilding %s from %s: outdated, source really modified" ) % (self.products[0], source_name), pkg="depend") return True else: msg.debug(_( "Not rebuilding %s from %s: outdated, but source unmodified" ) % (self.products[0], source_name), pkg="depend") return False