Blob Blame History Raw
From 294c6f571c0f4f7ed5a4fcb34142b0d332c55f29 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Sun, 11 Nov 2018 11:06:27 -0500
Subject: [PATCH 11/13] Add option to not generate a default changelog entry

For Rust packages created through the OBS source service, the
changelog is managed by an external <pkg>.changes file that is
transformed into an RPM changelog and appended to the spec file
automatically by the Open Build Service.

Having a default entry means that the changelog handling will not
always work correctly and package builds may fail due to changelog
entries not being in reverse chronological order.

This also is a future enabler for other workflows for external
changelog management in automated package builds.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
---
 rust2rpm/__main__.py         | 7 +++++++
 rust2rpm/templates/main.spec | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py
index b60e6c4..747328e 100644
--- a/rust2rpm/__main__.py
+++ b/rust2rpm/__main__.py
@@ -209,6 +209,8 @@ def main():
                                      formatter_class=argparse.RawTextHelpFormatter)
     parser.add_argument("--show-license-map", action="store_true",
                         help="Print license mappings and exit")
+    parser.add_argument("--no-auto-changelog-entry", action="store_true",
+                        help="Do not generate a changelog entry")
     parser.add_argument("-", "--stdout", action="store_true",
                         help="Print spec and patches into stdout")
     parser.add_argument("-t", "--target", action="store",
@@ -261,6 +263,11 @@ def main():
         raise ValueError("No bins and no libs")
     kwargs["include_devel"] = is_lib
 
+    if args.no_auto_changelog_entry:
+        kwargs["auto_changelog_entry"] = False
+    else:
+        kwargs["auto_changelog_entry"] = True
+
     if args.target in ("fedora", "mageia", "opensuse"):
         kwargs["include_build_requires"] = True
         kwargs["include_provides"] = False
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
index d901e6d..84bd97d 100644
--- a/rust2rpm/templates/main.spec
+++ b/rust2rpm/templates/main.spec
@@ -179,4 +179,6 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c
 %endif
 
 %changelog
-{% include target ~ "-changelog.spec.inc" %}
+{% if auto_changelog_entry %}
+  {% include target ~ "-changelog.spec.inc" %}
+{% endif %}
-- 
2.20.0.rc2