createrepo_c: Support for changelog-limit = -1 (Dumps all changelogs)
authorTomas Mlcoch <tmlcoch@redhat.com>
Tue, 4 Mar 2014 09:27:53 +0000 (10:27 +0100)
committerTomas Mlcoch <tmlcoch@redhat.com>
Tue, 4 Mar 2014 09:27:53 +0000 (10:27 +0100)
src/cmd_parser.c
src/parsehdr.c

index e5c0705..6b6f119 100644 (file)
@@ -198,7 +198,7 @@ check_arguments(struct CmdOptions *options,
     }
 
     // Check changelog_limit
-    if ((options->changelog_limit < 0) || (options->changelog_limit > 100)) {
+    if ((options->changelog_limit < -1)) {
         g_warning("Wrong changelog limit \"%d\" - Using 10", options->changelog_limit);
         options->changelog_limit = DEFAULT_CHANGELOG_LIMIT;
     }
index 9e3c017..9802d0f 100644 (file)
@@ -470,7 +470,7 @@ cr_package_from_header(Header hdr, gint64 mtime, gint64 size,
         while ((rpmtdNext(changelogtimes) != -1) &&
                (rpmtdNext(changelognames) != -1) &&
                (rpmtdNext(changelogtexts) != -1) &&
-               (changelog_limit > 0))
+               (changelog_limit > 0 || changelog_limit == -1))
         {
             gint64 time = rpmtdGetNumber(changelogtimes);
 
@@ -495,7 +495,8 @@ cr_package_from_header(Header hdr, gint64 mtime, gint64 size,
             }
 
             pkg->changelogs = g_slist_prepend(pkg->changelogs, changelog);
-            changelog_limit--;
+            if (changelog_limit != -1)
+                changelog_limit--;
 
             // If a previous entry has the same time, increment time of the previous
             // entry by one. Ugly but works!