-+static int noEpoch;
-+
- /**
- */
- /*@-boundswrite@*/
-@@ -626,6 +628,7 @@
- spec->lineNum, spec->line);
- return RPMERR_BADSPEC;
- }
-+ noEpoch = 0;
- xx = headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
- break;
- case RPMTAG_AUTOREQPROV:
-@@ -865,6 +868,8 @@
- strcpy(NVR, "(main package)");
-
- pkg = newPackage(spec);
-+
-+ noEpoch = 1;
-
- if (! initialPackage) {
- /* There is one option to %package: <pkg> or -n <pkg> */
-@@ -932,6 +937,11 @@
- if (!spec->anyarch && checkForValidArchitectures(spec))
- return RPMERR_BADSPEC;
-
-+ if (noEpoch) {
++ if (headerGetEntry(pkg->header, RPMTAG_EPOCH, NULL, NULL, NULL) == 0) {