Creating an rpm from scratch

Reindl Harald h.reindl at
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?

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

# 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

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

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

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

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

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}

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

rm -rf %{buildroot}

%files -f %{name}.lang
%dir %{_localstatedir}/cache/powertop
%ghost %{_localstatedir}/cache/powertop/saved_parameters.powertop
%ghost %{_localstatedir}/cache/powertop/saved_results.powertop

* Wed Mar 20 2013 Jaroslav Å karvada <jskarvad at> - 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: <>

More information about the users mailing list