#131 rust2rpm: add support for using rpmautospec (autorelease + autochangelog)
Closed 2 years ago by zbyszek. Opened 2 years ago by decathorpe.
Unknown source master  into  master

file modified
+5
@@ -276,6 +276,8 @@

                          help="Do initial patching of Cargo.toml")

      parser.add_argument("-s", "--store-crate", action="store_true",

                          help="Store crate in current directory")

+     parser.add_argument("-a", "--rpmautospec", action="store_true", default=False,

+                         help="Use autorelease and autochangelog features")

      parser.add_argument("--all-features", action="store_true",

                          help="Activate all available features")

      parser.add_argument("--dynamic-buildrequires", action="store_true",
@@ -339,6 +341,7 @@

          kwargs["auto_changelog_entry"] = False

      else:

          kwargs["auto_changelog_entry"] = True

+     kwargs["rpmautospec"] = args.rpmautospec

  

      if args.target in {"fedora", "mageia", "opensuse"}:

          kwargs["include_build_requires"] = True
@@ -358,6 +361,8 @@

          kwargs["spec_copyright_year"] = time.strftime("%Y")

          kwargs["pkg_release"] = "0"

          kwargs["rust_group"] = "Development/Libraries/Rust"

+     elif args.rpmautospec:

+         kwargs["pkg_release"] = "%autorelease"

      else:

          kwargs["pkg_release"] = "1%{?dist}"

  

file modified
+5 -1
@@ -210,7 +210,11 @@

  %endif

  

  %changelog

- {%- if auto_changelog_entry %}

+ {% if rpmautospec %}

+ %autochangelog

+ {%- else %}

+ {%- if auto_changelog_entry -%}

  

    {% include target ~ "-changelog.spec.inc" %}

  {% endif %}

+ {% endif %}

This PR adds support for optionally generating spec files that use the autorelease and autochangelog features of rpmautospec.

  • New CLI argument -a / --rpmautospec
  • Release is set to %autorelease if enabled
  • %autochangelog used instead of dummy changelog entry if enabled

The output without the -a flag should be identical before and after this PR (though I am not really confident about the jinja2 template whitespace stripping modifiers, and mostly find the "correct" solution by trial-and-error ...)

Pull-Request has been closed by zbyszek

2 years ago