Creating an rpm from scratch

Reindl Harald h.reindl at thelounge.net
Thu Mar 21 09:06:20 UTC 2013



Am 21.03.2013 01:37, schrieb Bill Davidsen:
> Reindl Harald wrote:
>> well, and that is why i started with "unpack a existing src.rpm"
>> and look at the SPEC file which is cleraly doable for packages
>> which are only a few KB small and have SPEC files with lower than
>> 100 lines
>>
> As I said before, there is no existing SPEC for this package

do you really not understand what i am saying?

http://kojipkgs.fedoraproject.org//packages/powertop/2.3/1.fc18/src/powertop-2.3-1.fc18.src.rpm

unpack it and you have the SPEC file below
this is really really simple to adopt for ANY own package
_______________________________

Name:          powertop
Version:       2.3
Release:       1%{?dist}
Summary:       Power consumption monitor

Group:         Applications/System
License:       GPLv2
URL:           http://01.org/powertop/
Source0:       http://01.org/powertop/sites/default/files/downloads/%{name}-%{version}.tar.gz

# Sent upstream
Patch0:        powertop-2.3-always-create-params.patch

BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel

%description
PowerTOP is a tool that finds the software component(s) that make your
computer use more power than necessary while it is idle.

%prep
%setup -q
%patch0 -p1 -b .always-create-params

# remove left over object files
find . -name "*.o" -exec rm {} \;

%build
%configure
make %{?_smp_mflags} CFLAGS="%{optflags}"

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
install -Dd %{buildroot}%{_localstatedir}/cache/powertop
touch %{buildroot}%{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop}
%find_lang %{name}

%post
# Hack for powertop not to show warnings on first start
touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop}

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING README TODO
%dir %{_localstatedir}/cache/powertop
%ghost %{_localstatedir}/cache/powertop/saved_parameters.powertop
%ghost %{_localstatedir}/cache/powertop/saved_results.powertop
%{_sbindir}/powertop
%{_mandir}/man8/powertop.8*

%changelog
* Wed Mar 20 2013 Jaroslav Å karvada <jskarvad at redhat.com> - 2.3-1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20130321/ba827bb5/attachment.sig>


More information about the users mailing list