Linux.com

Home

Cool Tip: vi and spec File Templates

This is a really cool tip I stumbled onto while working with some of the packages on my team.  A couple months back I was editing a spec file and accidentally mistyped the name of the spec file.  Much to my surprise most of the file was completely missing.  After several :q! I finally realized that vi has a skeleton spec file that gets generated when edit a *.spec file that doesn’t exist yet.

So, for example if you typed:

 vi mypackage.spec

you would get:

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

# norootforbuild

Name:           mypackage
Version:
Release:
Summary:
Group:
License:
Url:
PreReq:
Provides:
BuildRequires:
Source:
Patch:
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
AutoReqProv:    on

%description

Authors:
--------
    Name Surname

%prep
%setup

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

%install
%makeinstall

%clean
rm -rf $RPM_BUILD_ROOT

%post
%postun

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

%changelog
* Wed Jan 13 2010 sshaw at stshaw.site

 

Comments

Subscribe to Comments Feed

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board