self.mdtimestamp = 0
self.directory = None
self.directories = []
+ self.changelog_limit = None # needs to be an int or None
+
class SimpleMDCallBack(object):
def errorlog(self, thing):
po = yumbased.CreateRepoPackage(self.ts, rpmfile)
except Errors.MiscError, e:
raise MDError, "Unable to open package: %s" % e
+ # if we're going to add anything in from outside, here is where
+ # you can do it
+ po.crp_changelog_limit = self.conf.changelog_limit
po.crp_cachedir = self.conf.cachedir
return po
if not self.changelog:
return ""
msg = "\n"
- for (ts, author, content) in self.changelog:
+ clog_count = 0
+ for (ts, author, content) in reversed(sorted(self.changelog)):
+ if self.crp_changelog_limit and clog_count >= self.crp_changelog_limit:
+ break
+ clog_count += 1
c = self.xml_node.newChild(None, "changelog", None)
c.addContent(utils.utf8String(content))
c.newProp('author', utils.utf8String(author))
parser.add_option("-S", "--skip-symlinks", dest="skip_symlinks",
default=False, action="store_true",
help="ignore symlinks of packages")
+ parser.add_option("--changelog-limit", dest="changelog_limit",
+ default=None, help="only import the last N changelog entries")
(opts, argsleft) = parser.parse_args()
if len(argsleft) > 1 and not opts.split:
conf.pkglist = lst
+ if conf.changelog_limit: # make sure it is an int, not a string
+ conf.changelog_limit = int(conf.changelog_limit)
+
return conf
class MDCallBack(object):