Blame SOURCES/0024-Add-a-snippet-generating-RPM-SPEC-changelog-line.patch

8f91ed
From d1a0ec893fc609795c6553553dc274105bd0d389 Mon Sep 17 00:00:00 2001
8f91ed
From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
8f91ed
Date: Mon, 17 Aug 2015 14:04:08 +0200
8f91ed
Subject: [PATCH 24/26] Add a snippet generating RPM SPEC %changelog line.
8f91ed
8f91ed
https://bugzilla.gnome.org/show_bug.cgi?id=732813
8f91ed
---
8f91ed
 plugins/snippets/Makefile.am      |  1 +
8f91ed
 plugins/snippets/data/rpmspec.xml | 22 ++++++++++++++++++++++
8f91ed
 2 files changed, 23 insertions(+)
8f91ed
 create mode 100644 plugins/snippets/data/rpmspec.xml
8f91ed
8f91ed
diff --git a/plugins/snippets/Makefile.am b/plugins/snippets/Makefile.am
8f91ed
index f4f5d0c..20c8ccc 100644
8f91ed
--- a/plugins/snippets/Makefile.am
8f91ed
+++ b/plugins/snippets/Makefile.am
8f91ed
@@ -44,6 +44,7 @@ dist_plugins_snippets_snippets_DATA =		\
8f91ed
 	plugins/snippets/data/perl.xml		\
8f91ed
 	plugins/snippets/data/php.xml		\
8f91ed
 	plugins/snippets/data/python.xml	\
8f91ed
+	plugins/snippets/data/rpmspec.xml		\
8f91ed
 	plugins/snippets/data/ruby.xml		\
8f91ed
 	plugins/snippets/data/sh.xml		\
8f91ed
 	plugins/snippets/data/snippets.xml	\
8f91ed
diff --git a/plugins/snippets/data/rpmspec.xml b/plugins/snippets/data/rpmspec.xml
8f91ed
new file mode 100644
8f91ed
index 0000000..eb3396d
8f91ed
--- /dev/null
8f91ed
+++ b/plugins/snippets/data/rpmspec.xml
8f91ed
@@ -0,0 +1,22 @@
8f91ed
+
8f91ed
+
8f91ed
+<snippets language="rpmspec">
8f91ed
+  <snippet id="ch">
8f91ed
+    <text>
8f91ed
+import rpm
8f91ed
+import datetime
8f91ed
+
8f91ed
+spec = rpm.spec($GEDIT_CURRENT_DOCUMENT_PATH)
8f91ed
+date = datetime.date.today().strftime("%a %b %d %Y")
8f91ed
+headers = spec.packages[0].header
8f91ed
+version = headers['Version']
8f91ed
+release = ".".join(headers['Release'].split(".")[:-1])
8f91ed
+packager = headers['Packager']
8f91ed
+newheader = "* %s %s - %s-%s\n- " % (date, packager, version, release)
8f91ed
+return newheader
8f91ed
+>
8f91ed
+]]></text>
8f91ed
+    <tag>ch</tag>
8f91ed
+    <description>changelog entry</description>
8f91ed
+  </snippet>
8f91ed
+</snippets>
8f91ed
-- 
8f91ed
1.8.3.1
8f91ed