Jan 28

Written by m4r3k and tagged by , , , , .

Ve volných chvílích jsem si napsal skeleton.spec soubor pro Vim. Jedná se o základní kostru spec souboru při vytváření nového balíčku. Umí si sám vyplnit položku Name a přidat záznam do %changelog části. A to včetně data ve formátu en_US. Pokud tedy často tvoříte nějaké spec soubory a používáte textový editor Vim, pak neváhejte využít mého skeletonu a pište případné návrhy na zlepšení.


Pro instalaci si zkopírujte následující Vim skeleton třeba do /usr/share/vim/current/skeletons/skeleton.spec.

#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# norootforbuild
Name:            specRPM_CREATION_NAME
Version:
Release:
Summary:
Group:
License:
URL:
Source:
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires:

%description

Authors:
--------
    Name Surname 
%prep
rm -rf $RPM_BUILD_ROOT
%setup

%build
%configure
make %{?jobs:-j%jobs}

%install
%makeinstall

%clean
rm -rf $RPM_BUILD_ROOT

%post

%postun

%files
%defattr(-,root,root,0755)
%doc ChangeLog README COPYING

%changelog
* specRPM_CREATION_DATE - specRPM_CREATION_AUTHOR_MAIL

a do souboru /etc/vimrc si uveďte následující:

" skeletons
autocmd BufNewFile  *.spec     call SKEL_spec()

function! SKEL_spec()
        0r /usr/share/vim/current/skeletons/skeleton.spec
        language time en_US " set LC_TIME for vim to en_US
        exe "%s/specRPM_CREATION_DATE/" . strftime("%a\ %b\ %d\ %Y") . "/ge"
        exe "%s/specRPM_CREATION_AUTHOR_MAIL/e-mail@comena.tld/ge"
        exe "%s/specRPM_CREATION_NAME/" . expand("%:t:r") . "/ge"
endfunction

část exe "%s/specRPM_CREATION_AUTHOR_MAIL/e-mail@domena.tld/ge" si patřičně upravte a nastavte si tam svůj vlastní e-mail.

One Response

  1. Pavol Rusnak Says:

    Ahoj! openSUSE nedavno zmenila komentar na zaciatku .spec suborov. V novej hlavicke sa pise toto:

    #
    # spec file for package [package]
    #
    # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
    #
    # All modifications and additions to the file contributed by third parties
    # remain the property of their copyright owners, unless otherwise agreed
    # upon. The license for this file, and modifications and additions to the
    # file, is the same license as for the pristine package itself (unless the
    # license for the pristine package is not an Open Source License, in which
    # case the license is the MIT License). An “Open Source License” is a
    # license that conforms to the Open Source Definition (Version 1.9)
    # published by the Open Source Initiative.

    # Please submit bugfixes or comments via http://bugs.opensuse.org/
    #

    Ak chces, mozes zmenit svoj template :)

Leave a Comment


Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.