After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 732813 - add plugin which will add RPM ChangeLog entries
add plugin which will add RPM ChangeLog entries
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2014-07-06 21:52 UTC by Igor Gnatenko
Modified: 2019-03-23 20:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rpmspec.xml (1.42 KB, text/xml)
2014-07-07 10:24 UTC, Igor Gnatenko
  Details
External tool which provides this functionality (3.17 KB, text/x-python)
2014-07-07 13:13 UTC, Igor Gnatenko
  Details
Add a snippet generating RPM SPEC %changelog line. (1.25 KB, patch)
2015-08-17 12:06 UTC, Matěj Cepl
none Details | Review
Add a snippet generating RPM SPEC %changelog line. (1.26 KB, patch)
2015-08-17 12:17 UTC, Matěj Cepl
none Details | Review
Add a snippet generating RPM SPEC %changelog line. (1.78 KB, patch)
2015-08-17 12:21 UTC, Matěj Cepl
committed Details | Review

Description Igor Gnatenko 2014-07-06 21:52:38 UTC
subj.

For vim we have spec.pluign which when pressing \+c adding changelog entry for current version in specfile.

I think should be great idea to have this one in gedit plugins.

So, I've started work on it in wip/rpm-plugin branch.

https://git.gnome.org/browse/gedit-plugins/log/?h=wip/rpm-plugin

I think I will finish work in near few weeks (have a hardly limited free time) ;(
Comment 1 Paolo Borelli 2014-07-07 06:17:30 UTC
What about creating a snippet instad?
Comment 2 Igor Gnatenko 2014-07-07 08:09:07 UTC
(In reply to comment #1)
> What about creating a snippet instad?

https://bugzilla.gnome.org/show_bug.cgi?id=703964

or snippents working in other way?
Comment 3 Paolo Borelli 2014-07-07 08:58:39 UTC
I am not sure what you mean, the bug you mention is about external tools, and what is described in that bug can be achieved in many ways, for instance you can simply use awk (untested)

awk '
BEGIN {
    a=""
    b=""
}/a:/ {
    a=$2
}
/b:/ {
    b=$2
}
END {
    print $a %b
}'

That said, I was suggesting using a snippet not an external tool, so that when you type "log" and press tab, the changelog entry gets inserted
Comment 4 Igor Gnatenko 2014-07-07 10:22:55 UTC
Well. I've tried. But I can't parse file without saving it (it's unsaved in most cases)
Comment 5 Igor Gnatenko 2014-07-07 10:24:15 UTC
Created attachment 280043 [details]
rpmspec.xml

My current snippet
Comment 6 Igor Gnatenko 2014-07-07 10:26:31 UTC
1. I can't work with non-saved documents
2. I can't add text to specific line (?)
Comment 7 jessevdk@gmail.com 2014-07-07 10:41:52 UTC
Another option would be to write a gedit commander module, which is more or less like writing a mini-plugin. But there isn't much documentation unfortunately (you can look at existing modules). If you need to parse the document, snippets won't work, but an external tool should.
Comment 8 Igor Gnatenko 2014-07-07 13:13:51 UTC
Created attachment 280064 [details]
External tool which provides this functionality
Comment 9 Igor Gnatenko 2014-07-07 13:19:45 UTC
(In reply to comment #7)
> Another option would be to write a gedit commander module, which is more or
> less like writing a mini-plugin. But there isn't much documentation
> unfortunately (you can look at existing modules). If you need to parse the
> document, snippets won't work, but an external tool should.
I've implemented with external tool. It works. I will look for commander module, because:
1. it should reduce my code
2. I think I can provide real-time adding changelog (while user editing spec) - updating changelog entry


Interesting, how I can store username and email. For stand-alone plugin - I've tried store in gsettings and it worked. How I can do with exttols or commander module?
Comment 10 Igor Gnatenko 2014-07-07 13:28:56 UTC
Some issues with exttools:
1. I wan't to place cursor in specific place
2. exttools adding blank line after fully replacing doc..

So I think I should use more low-level API for getting what I need
Comment 11 Matěj Cepl 2015-08-17 11:41:23 UTC
I have a snippet at https://gitlab.com/snippets/7108 (requires rpm-python package installed).

What about closing this bug?
Comment 12 Ignacio Casal Quinteiro (nacho) 2015-08-17 11:42:58 UTC
How about a patch to add this snippet?
Comment 13 Matěj Cepl 2015-08-17 12:06:47 UTC
Created attachment 309393 [details] [review]
Add a snippet generating RPM SPEC %changelog line.
Comment 14 Ignacio Casal Quinteiro (nacho) 2015-08-17 12:17:03 UTC
Review of attachment 309393 [details] [review]:

I am missing here some makefile rules. Like adding the file to extra_dist
Comment 15 Matěj Cepl 2015-08-17 12:17:14 UTC
Created attachment 309394 [details] [review]
Add a snippet generating RPM SPEC %changelog line.

Change the tag to just simple 'ch'.
Also, add id attribute to the snippet element.
Comment 16 Matěj Cepl 2015-08-17 12:21:43 UTC
Created attachment 309395 [details] [review]
Add a snippet generating RPM SPEC %changelog line.

Also, add the line to dist_plugins_snippets_snippets_DATA of the
snippets plugin Makefile.am.
Comment 17 Matěj Cepl 2015-08-17 15:39:04 UTC
Tested including Makefile.am changes and it works. Merging.
Comment 18 Matěj Cepl 2015-08-17 15:44:56 UTC
Attachment 309395 [details] pushed as d4ce9dd - Add a snippet generating RPM SPEC %changelog line.