poldek: poldek/pkgu.c - fix: strip changelog on store; not on load

mis mis at pld-linux.org
Sat May 24 20:54:44 CEST 2008


Author: mis                          Date: Sat May 24 18:54:44 2008 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- fix: strip changelog on store; not on load

---- Files affected:
poldek/poldek:
   pkgu.c (1.37 -> 1.38) 

---- Diffs:

================================================================
Index: poldek/poldek/pkgu.c
diff -u poldek/poldek/pkgu.c:1.37 poldek/poldek/pkgu.c:1.38
--- poldek/poldek/pkgu.c:1.37	Sat May 24 20:19:07 2008
+++ poldek/poldek/pkgu.c	Sat May 24 20:54:39 2008
@@ -317,7 +317,7 @@
 
 /* remove header; add '*'s; replace "Revision REV" with "rREV" */
 static
-char *prepare_pld_changelog(tn_alloc *na, const char *changelog, time_t since)
+char *prepare_pld_changelog(tn_alloc *na, const char *changelog)
 {
     struct changelog_ent  *ent = NULL;
     char                  *entmark = "Revision", *prepared_log;
@@ -371,9 +371,6 @@
                 ts = parse_datetime(tstr);
                 if (ts == 0)
                     continue;
-
-                if (ts < since)
-                    break;
             }
 
             n = n_snprintf(info, sizeof(info), "* r%s %s", rev, tstr);
@@ -551,10 +548,7 @@
     char                 **names = NULL, **texts = NULL, *changelog = NULL;
     uint32_t             *times = NULL;
     tn_buf               *nbuf = NULL;
-    time_t               since;
     int                  i;
-
-    since = time(NULL) - 3600 * 24 * 356; /* skip entries older than year */
     
     if (!pm_rpmhdr_ent_get(&e_name, hdr, RPMTAG_CHANGELOGNAME))
         return NULL;
@@ -575,7 +569,7 @@
     texts = pm_rpmhdr_ent_as_strarr(&e_text);
     
     if (e_name.cnt == 1 && strstr(names[0], "PLD")) {
-        changelog = prepare_pld_changelog(na, texts[0], since);
+        changelog = prepare_pld_changelog(na, texts[0]);
         goto l_end;
     }
             
@@ -583,9 +577,6 @@
     for (i=0; i < e_name.cnt; i++) {
         char ts[32];
 
-        if ((time_t)times[i] < since)
-            break;
-        
         strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S", gmtime((time_t*)&times[i]));
 
         n_buf_printf(nbuf, "* %s %s\n", ts, names[i]);
@@ -747,16 +738,25 @@
 
     n_assert(lang);
     if (n_str_eq(lang, "C")) {
-        
+        /* skip entries older than year */
+        time_t since = time(NULL) - 3600 * 24 * 356; 
         int i = 0;
+        
         while (members[i].tag) {
-            struct member m = members[i++]; 
-            if (m.value == NULL)
+            struct member m = members[i++];
+            const char *value = m.value;
+
+            if (m.tag == PKGUINF_CHANGELOG) {
+                if (pkgu->changelog && strlen(pkgu->changelog) > 512)
+                    value = pkguinf_get_changelog((struct pkguinf*)pkgu, since);
+            }
+            
+            if (value == NULL)
                 continue;
             
             n_buf_putc(nbuf, m.tag);
             n_buf_putc(nbuf, '\0');
-            n_buf_puts(nbuf, m.value);
+            n_buf_puts(nbuf, value);
             n_buf_putc(nbuf, '\0');
         }
         
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/pkgu.c?r1=1.37&r2=1.38&f=u



More information about the pld-cvs-commit mailing list