rpm/rpm-shorten-changelog.diff

101 lines
2.8 KiB
Diff
Raw Normal View History

--- build/pack.c.orig
+++ build/pack.c
@@ -683,6 +683,71 @@
return rc;
}
+static void trimChangelog(Header h)
+{
+ static int oneshot;
+ static int cuttime, minnum, maxnum;
+ rpm_count_t i, keep;
+ struct rpmtd_s timestd, namestd, textstd;
+ rpm_count_t count;
+
+ if (!oneshot) {
+ char *binarychangelogtrim = rpmExpand("%{?_binarychangelogtrim}", NULL);
+ oneshot = 1;
+ if (binarychangelogtrim && *binarychangelogtrim) {
+ maxnum = atoi(binarychangelogtrim);
+ binarychangelogtrim = strchr(binarychangelogtrim, ',');
+ if (binarychangelogtrim)
+ binarychangelogtrim++;
+ }
+ if (binarychangelogtrim && *binarychangelogtrim) {
+ cuttime = atoi(binarychangelogtrim);
+ binarychangelogtrim = strchr(binarychangelogtrim, ',');
+ if (binarychangelogtrim)
+ binarychangelogtrim++;
+ }
+ if (binarychangelogtrim && *binarychangelogtrim) {
+ minnum = atoi(binarychangelogtrim);
+ binarychangelogtrim = strchr(binarychangelogtrim, ',');
+ }
+ }
+ if (!cuttime && !minnum && !maxnum) {
+ return;
+ }
+
+ if (!headerGet(h, RPMTAG_CHANGELOGTIME, &timestd, HEADERGET_MINMEM))
+ return;
+ count = rpmtdCount(&timestd);
+ if ((!cuttime || count <= minnum) && (!maxnum || count <= maxnum)) {
+ rpmtdFreeData(&timestd);
+ return;
+ }
+ keep = count;
+ if (maxnum && keep > maxnum)
+ keep = maxnum;
+ if (cuttime) {
+ for (i = 0; i < keep; i++) {
+ uint32_t *tp = rpmtdNextUint32(&timestd);
+ if (i >= minnum && tp && *tp < cuttime)
+ break;
+ }
+ keep = i;
+ }
+ if (keep >= count) {
+ rpmtdFreeData(&timestd);
+ return;
+ }
+ headerGet(h, RPMTAG_CHANGELOGNAME, &namestd, HEADERGET_MINMEM);
+ headerGet(h, RPMTAG_CHANGELOGTEXT, &textstd, HEADERGET_MINMEM);
+ timestd.count = namestd.count = textstd.count = keep;
+ headerMod(h, &timestd);
+ headerMod(h, &namestd);
+ headerMod(h, &textstd);
+ rpmtdFreeData(&textstd);
+ rpmtdFreeData(&namestd);
+ rpmtdFreeData(&timestd);
+}
+
static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int cheating, char** filename)
{
rpmRC rc = RPMRC_OK;
@@ -699,7 +764,10 @@
/* Copy changelog from src rpm */
#pragma omp critical
- headerCopyTags(spec->sourcePackage->header, pkg->header, copyTags);
+ {
+ headerCopyTags(spec->sourcePackage->header, pkg->header, copyTags);
+ trimChangelog(pkg->header);
+ }
headerPutString(pkg->header, RPMTAG_RPMVERSION, VERSION);
headerPutString(pkg->header, RPMTAG_BUILDHOST, spec->buildHost);
--- build/parseChangelog.c.orig
+++ build/parseChangelog.c
@@ -267,6 +267,11 @@
Accepting request 147491 from devel:Factory:ARM - Update to 4.10.2 - Update to 4.10.2 - update to 4.10.2 (bnc#796375): * Fix missing error code on unparseable signature in packages, regression introduced in rpm 4.10.0. This could result in packages with malformed signature falling through signature checking. * Fix missing error code on --import on bogus key file (RhBug:869667) * Fix installation of packages containing skipped hardlinks (RhBug:864622) * Fix --setperms regression introduced in rpm 4.10.0 (RhBug:881835) * Fix locale dependent behavior in rpm2cpio.sh (RhBug:878363) * Add --undefine cli switch for undefining macros (related to RhBug:876308) * Fix warnings when building with gcc >= 4.7 * Permit key imports on transactions where signature checking is disabled, regression of sorts introduced in 4.10.0 (RhBug:856225) * Fix RPMPROB_FILTER_FORCERELOCATE aka --badreloc, regression introduced in 4.9.0 (RhBug:828784) * Verify files from non-installed packages again, regression introduced in 4.9.0 (RhBug:826589) * Fix large (> 4GB) package support, regression introduced in 4.9.0 (RhBug:844936) * Only create the first instance of a file shared between multiple packages on install (speedup + improved verification timestamp behavior) * Report config and missinok flags too in deptype format extension * Fix relative path handling in --whatprovides query * Add --noclean and --nocheck options to rpmbuild (RhBug:756531) * Permit non-existent %ghost directories to be packaged (RhBug:839656) * Dont silence patch by default (RhBug:678000, RhBug:773503) * Accept "owner" as an alias to "user" %verify attribute (RhBug:838657) OBS-URL: https://build.opensuse.org/request/show/147491 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=245
2013-01-09 10:46:46 +01:00
goto exit;
}
+ /* workaround old suse oddity */
+ if (*s == '-' && s[1] == ' ') {
+ s += 2;
+ }
+
/* name */
name = s;
while (*s != '\0') s++;