[gnome-builder] snippets: add rpmspec snippets (skeletons)



commit f2e4fca6ce1ed85f54a90f34fd38e0e40cb4eb58
Author: Igor Gnatenko <ignatenko src gnome org>
Date:   Thu Jan 8 17:49:13 2015 +0300

    snippets: add rpmspec snippets (skeletons)
    
    v2:
        fix typo in python-arch snippet name
        rename lib to library snippet
    
    Reference: https://bugzilla.gnome.org/show_bug.cgi?id=742591
    Signed-off-by: Igor Gnatenko <ignatenko src gnome org>

 src/resources/gnome-builder.gresource.xml |    1 +
 src/resources/snippets/rpmspec.snippets   |  155 +++++++++++++++++++++++++++++
 src/snippets/gb-source-snippet-context.c  |    9 ++
 3 files changed, 165 insertions(+), 0 deletions(-)
---
diff --git a/src/resources/gnome-builder.gresource.xml b/src/resources/gnome-builder.gresource.xml
index 6baf12e..eb7d01e 100644
--- a/src/resources/gnome-builder.gresource.xml
+++ b/src/resources/gnome-builder.gresource.xml
@@ -23,6 +23,7 @@
     <file>snippets/chdr.snippets</file>
     <file>snippets/c-sharp.snippets</file>
     <file>snippets/python.snippets</file>
+    <file>snippets/rpmspec.snippets</file>
     <file>snippets/vala.snippets</file>
     <file>snippets/xml.snippets</file>
 
diff --git a/src/resources/snippets/rpmspec.snippets b/src/resources/snippets/rpmspec.snippets
new file mode 100644
index 0000000..b8dc6fe
--- /dev/null
+++ b/src/resources/snippets/rpmspec.snippets
@@ -0,0 +1,155 @@
+snippet minimal
+       Name:          ${1:$filename|stripsuffix}
+       Version:       ${2:1.0}
+       Release:       ${3:1}%{?dist}
+       Summary:       ${4:Minimal test package}
+       
+       License:       ${5:Public Domain}
+       URL:           ${6:https://fedoraproject.org/}
+       Source0:       ${7}
+       
+       BuildRequires: ${8}
+       Requires:      ${9}
+       
+       %description
+       ${10:$4}
+       
+       %prep
+       %setup -q
+       
+       %build
+       %configure
+       make %{?_smp_mflags}
+       
+       %install
+       %make_install
+       
+       %files
+       %doc ${11}
+       ${12}
+       
+       %changelog
+       * $shortweekday $shortmonth $day $year ${13:$fullname} <${14:$email}> - $2-$3
+       - Initial package$0
+snippet library
+       Name:          ${1:$filename|stripsuffix}
+       Version:       ${2:1.0}
+       Release:       ${3:1}%{?dist}
+       Summary:       ${4:Minimal test package}
+       
+       License:       ${5:Public Domain}
+       URL:           ${6:https://fedoraproject.org/}
+       Source0:       ${7}
+       
+       BuildRequires: ${8}
+       Requires:      ${9}
+       
+       %description
+       ${10:$4}
+       
+       %package       devel
+       Summary:       Development files for %{name}
+       Requires:      %{name}%{?_isa} = %{version}-%{release}
+       
+       %description   devel
+       The %{name}-devel package contains libraries and header files for
+       developing applications that use %{name}.
+       
+       %prep
+       %setup -q
+       
+       %build
+       %configure --disable-static
+       make %{?_smp_mflags}
+       
+       %install
+       %make_install
+       find %{buildroot} -name '*.la' -exec rm -f {} ';'
+       
+       %post -p /sbin/ldconfig
+       %postun -p /sbin/ldconfig
+       
+       %files
+       %doc ${11}
+       %{_libdir}/${12:*}.so.*
+       ${13}
+       
+       %files devel
+       %doc ${14}
+       %{_includedir}/${15:*}
+       %{_libdir}/${16:$12}.so
+       ${17}
+       
+       %changelog
+       * $shortweekday $shortmonth $day $year ${18:$fullname} <${19:$email}> - $2-$3
+       - Initial package$0
+snippet python-arch
+       %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import 
get_python_lib; print(get_python_lib())")}
+       %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import 
get_python_lib; print(get_python_lib(1))")}
+       Name:          ${1:$filename|stripsuffix}
+       Version:       ${2:1.0}
+       Release:       ${3:1}%{?dist}
+       Summary:       ${4:Minimal python arch-specific package}
+       
+       License:       ${5:Public Domain}
+       URL:           ${6:https://fedoraproject.org/}
+       Source0:       ${7}
+       
+       BuildRequires: ${8}
+       Requires:      ${9}
+       BuildArch:     ${10:%{ix86} x86_64}
+       
+       %description
+       ${11:$4}
+       
+       %prep
+       %setup -q
+       
+       %build
+       CFLAGS=%{optflags} %{__python} setup.py build
+       
+       %install
+       %{__python} setup.py install -O1 --skip-build --root %{buildroot}
+       
+       %files
+       %doc ${12}
+       %{python_sitearch}/${14:*}
+       ${15}
+       
+       %changelog
+       * $shortweekday $shortmonth $day $year ${16:$fullname} <${17:$email}> - $2-$3
+       - Initial package$0
+snippet python-noarch
+       Name:          ${1:$filename|stripsuffix}
+       Version:       ${2:1.0}
+       Release:       ${3:1}%{?dist}
+       Summary:       ${4:Minimal python package}
+       
+       License:       ${5:Public Domain}
+       URL:           ${6:https://fedoraproject.org/}
+       Source0:       ${7}
+       
+       BuildRequires: ${8}
+       Requires:      ${9}
+       BuildArch:     noarch
+       
+       %description
+       ${10:$4}
+       
+       %prep
+       %setup -q
+       
+       %build
+       %{__python} setup.py build
+       
+       %install
+       %{__python} setup.py install -O1 --skip-build --root %{buildroot}
+       
+       %files
+       %doc ${12}
+       %{python_sitelib}/${14:*}
+       ${15}
+       
+       %changelog
+       * $shortweekday $shortmonth $day $year ${16:$fullname} <${17:$email}> - $2-$3
+       - Initial package$0
diff --git a/src/snippets/gb-source-snippet-context.c b/src/snippets/gb-source-snippet-context.c
index 959619d..3ec32a9 100644
--- a/src/snippets/gb-source-snippet-context.c
+++ b/src/snippets/gb-source-snippet-context.c
@@ -706,6 +706,15 @@ gb_source_snippet_context_init (GbSourceSnippetContext *context)
   str = g_date_time_format (dt, "%Y");
   ADD_VARIABLE ("year", str);
   g_free (str);
+  str = g_date_time_format (dt, "%b");
+  ADD_VARIABLE ("shortmonth", str);
+  g_free (str);
+  str = g_date_time_format (dt, "%d");
+  ADD_VARIABLE ("day", str);
+  g_free (str);
+  str = g_date_time_format (dt, "%a");
+  ADD_VARIABLE ("shortweekday", str);
+  g_free (str);
   g_date_time_unref (dt);
 
   str = run_command ("git config user.email");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]