Rpm Paket erstellen Hello World

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Vorbereitung

  • dnf install gettext

Herunterladen des Probe-Quellcodes

Paketspezifikationen

  • cd ../SPECS
  • Eine Vorlage für die .spec-Datei, kann man sich mit dem folgenden Befehl generieren:
  • rpmdev-newspec --macros hello.spec
  • Diese sollte man noch manuell anpassen
  • vim hello.spec
Name:     hello
Version:  2.10
Release:  1%{?dist}
Summary:  The "Hello World" program from GNU
License:  GPLv3+
URL:      http://ftp.gnu.org/gnu/hello
Source0: https://ftp.gnu.org/gnu/hello/hello-%{version}.tar.gz

BuildRequires: gettext

Requires(post): info
Requires(preun): info

%description
The "Hello World" program, done with all bells and whistles of a proper FOSS
project, including configuration, build, internationalization, help files, etc.

%prep
%autosetup

%build
%configure
%make_build

%install
%make_install
%find_lang %{name}
rm -f %{buildroot}/%{_infodir}/dir

%post
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :

%preun
if [ $1 = 0 ] ; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi

%files -f %{name}.lang
%{_mandir}/man1/hello.1.*
%{_infodir}/hello.info.*
%{_bindir}/hello

%doc AUTHORS ChangeLog NEWS README THANKS TODO
%license COPYING

%changelog
* Tue Sep 06 2011 The Coon of Ty <Ty@coon.org> - 2.8-1
- Initial version of the package

Bauen des Paketes

  • Aus dem SPEC-Verzeichnis aus kann man nun das .rpm-Paket erstellen
  • rpmbuild -ba hello.spec
  • ls ../RPMS/x86_64/
hello-2.10-1.fc36.x86_64.rpm  hello-debuginfo-2.10-1.fc36.x86_64.rpm  hello-debugsource-2.10-1.fc36.x86_64.rp

Testen

  • cd ../RPMS/x86_64/
  • rpmlint hello-2.10-1.fc36.x86_64.rpm
========================================================================= rpmlint session starts =========================================================================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 1

hello.x86_64: W: incoherent-version-in-changelog 2.8-1 ['2.10-1.fc36', '2.10-1']
hello.x86_64: W: file-not-utf8 /usr/share/doc/hello/THANKS
========================================== 1 packages and 0 specfiles checked; 0 errors, 2 warnings, 0 badness; has taken 0.3 s ==========================================
  • dnf install ./hello-2.10-1.fc36.x86_64.rpm
  • hello
Hello, world!