File debug.patch of Package rpm

Index: rpm-4.14.1/build/pack.c
===================================================================
--- rpm-4.14.1.orig/build/pack.c
+++ rpm-4.14.1/build/pack.c
@@ -228,7 +228,7 @@ static rpmRC processScriptFiles(rpmSpec
 				RPMTAG_FILETRIGGERPRIORITIES,
 				RPMTAG_TRANSFILETRIGGERPRIORITIES};
     int i;
-    
+
     if (addFileToTag(spec, pkg->preInFile, h, RPMTAG_PREIN, 1) ||
 	addFileToTag(spec, pkg->preUnFile, h, RPMTAG_PREUN, 1) ||
 	addFileToTag(spec, pkg->preTransFile, h, RPMTAG_PRETRANS, 1) ||
@@ -316,7 +316,7 @@ static char *getIOFlags(Package pkg)
     /* Save payload information */
     if (headerIsSource(pkg->header))
 	rpmio_flags = rpmExpand("%{?_source_payload}", NULL);
-    else 
+    else
 	rpmio_flags = rpmExpand("%{?_binary_payload}", NULL);
 
     /* If not configured or bogus, fall back to gz */
@@ -509,7 +509,7 @@ static rpmRC writeRPM(Package pkg, unsig
     headerPutUint32(pkg->header, RPMTAG_PAYLOADDIGESTALGO, &pld_algo, 1);
     headerPutString(pkg->header, RPMTAG_PAYLOADDIGEST, pld);
     pld = _free(pld);
-    
+
     /* Check for UTF-8 encoding of string tags, add encoding tag if all good */
     if (checkForEncoding(pkg->header, 1))
 	goto exit;
@@ -626,7 +626,7 @@ static rpmRC checkPackages(char *pkgchec
 {
     int fail = rpmExpandNumeric("%{?_nonzero_exit_pkgcheck_terminate_build}");
     int xx;
-    
+
     rpmlog(RPMLOG_NOTICE, _("Executing \"%s\":\n"), pkgcheck);
     xx = system(pkgcheck);
     if (WEXITSTATUS(xx) == -1 || WEXITSTATUS(xx) == 127) {
@@ -637,7 +637,7 @@ static rpmRC checkPackages(char *pkgchec
 	rpmlog(RPMLOG_ERR, _("Package check \"%s\" failed.\n"), pkgcheck);
 	if (fail) return RPMRC_FAIL;
     }
-    
+
     return RPMRC_OK;
 }
 
@@ -708,6 +708,7 @@ static void trimChangelog(Header h)
 
 rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
 {
+	printf("~~~~ START:packageBinaries ~~~~\n");
     rpmRC rc;
     const char *errorString;
     Package pkg;
@@ -722,14 +723,14 @@ rpmRC packageBinaries(rpmSpec spec, cons
 
 	if ((rc = processScriptFiles(spec, pkg)))
 	    return rc;
-	
+
 	if (cookie) {
 	    headerPutString(pkg->header, RPMTAG_COOKIE, cookie);
 	}
 
 	/* Copy changelog from src rpm */
 	headerCopyTags(spec->packages->header, pkg->header, copyTags);
-	
+
 	headerPutString(pkg->header, RPMTAG_RPMVERSION, VERSION);
 	headerPutString(pkg->header, RPMTAG_BUILDHOST, buildHost());
 	headerPutUint32(pkg->header, RPMTAG_BUILDTIME, getBuildTime(), 1);
@@ -741,14 +742,14 @@ rpmRC packageBinaries(rpmSpec spec, cons
 	if (cheating) {
 	    (void) rpmlibNeedsFeature(pkg, "ShortCircuited", "4.9.0-1");
 	}
-	
+
 	{   char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
 	    char *binRpm, *binDir;
 	    binRpm = headerFormat(pkg->header, binFormat, &errorString);
 	    free(binFormat);
 	    if (binRpm == NULL) {
 		rpmlog(RPMLOG_ERR, _("Could not generate output "
-		     "filename for package %s: %s\n"), 
+		     "filename for package %s: %s\n"),
 		     headerGetString(pkg->header, RPMTAG_NAME), errorString);
 		return RPMRC_FAIL;
 	    }
@@ -774,7 +775,9 @@ rpmRC packageBinaries(rpmSpec spec, cons
 	    free(binRpm);
 	}
 
+  printf("~~~## START:writerpm:%d ##~~~\n", pkg);
 	rc = writeRPM(pkg, NULL, fn, NULL);
+	printf("~~~## END:writerpm:%d ##~~~\n", pkg);
 	if (rc == RPMRC_OK) {
 	    /* Do check each written package if enabled */
 	    char *pkgcheck = rpmExpand("%{?_build_pkgcheck} ", fn, NULL);
@@ -801,12 +804,14 @@ rpmRC packageBinaries(rpmSpec spec, cons
 	free(pkgcheck_set);
 	pkglist = _free(pkglist);
     }
-    
+		printf("~~~~ END:packageBinaries ~~~~\n");
     return RPMRC_OK;
 }
 
 rpmRC packageSources(rpmSpec spec, char **cookie)
 {
+	printf("~~~~ START:packageSources ~~~~\n");
+
     Package sourcePkg = spec->sourcePackage;
     rpmRC rc;
     uint32_t one = 1;
@@ -822,7 +827,9 @@ rpmRC packageSources(rpmSpec spec, char
 	char *pkgcheck = rpmExpand("%{?_build_pkgcheck_srpm} ", fn, NULL);
 
 	spec->sourcePkgId = NULL;
+	printf("~~~## START:writesourcerpm:%d ##~~~\n", sourcePkg);
 	rc = writeRPM(sourcePkg, &spec->sourcePkgId, fn, cookie);
+	printf("~~~## END:writesourcerpm:%d ##~~~\n", sourcePkg);
 
 	/* Do check SRPM package if enabled */
 	if (rc == RPMRC_OK && pkgcheck[0] != ' ') {
@@ -832,5 +839,7 @@ rpmRC packageSources(rpmSpec spec, char
 	free(pkgcheck);
 	free(fn);
     }
+		printf("~~~~ END:packageSources ~~~~\n");
+
     return rc;
 }