Rabu, 18 April 2012

Pemaketan Fedora

Tertarik untuk mencoba belajar Pemaketan Fedora, dalam pembelajaran pertama ini saya melihat refrensi pada How to create a GNU Hello RPM package mari kita mulai.

Persiapan Sistem
Sebelum membuat Paket RPM kita yang pertama, perlu disiapkan adalah tools development-tools dan fedora-packager, cara install nya seperti berikut.
[root@localhost ~]# yum install @development-tools
[root@localhost ~]# yum install fedora-packager
Assign user biasa ke group "mock"
[root@localhost ~]# usermod -a -G mock ekoikhyar
Setelah assign user biasa berhasil, gunakan user tersebut untuk kegiatan pemaketan, ingat jangan gunakan user root untuk alasan keamanan.


Memulai Pemaketan
Lakukan pembuatan struktur direktori RPM, seperti perintah di bawah, setelah perintah dibawah berhasil maka akan terbentuk beberapa direktori di Home direktori, yang bernama rpmbuild yang mempunyai 6 sub direktori di dalamnya.
[ekoikhyar@localhost /]$ rpmdev-setuptree
Setelah perintah diatas di jalankan, terbentuk beberapa direktori.
+ rpmbuild
+ BUILD
+ BUILDROOT
+ RPMS
+ SOURCES
+ SPECS
+ SRPMS
Masuk ke direktori SOURCES, direktori ini tempat menempatkan source yang akan di buat paket RPM nya, untuk contoh awal silahkan download contoh source hello-2.7.tar.xz
$ cd ~/rpmbuild/SOURCES/
$ wget http://ftp.gnu.org/gnu/hello/hello-2.7.tar.xz
Setelah mendownload file hello, masuk ke direktori SPECS, dan buatlah file spec hello, seperti cara di bawah ini,
$ cd ~/rpmbuild/SPECS $ rpmdev-newspec hello
Lalu edit lah file hello.spec yang telah dibuat tadi, di bawah ini hanya lah contoh isi file hello.spec
$ gedit hello.spec
Isi file hello spec
Name:           hello
Version:        2.7
Release:        1%{?dist}
Summary:        The "Hello World" program from GNU

License:        GPLv3+
URL:            http://ftp.gnu.org/gnu/%{name}
Source0:        http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz

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
%setup -q

%build
%configure
make %{?_smp_mflags}

%install
make install-strip DESTDIR=%{buildroot}
%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
%doc AUTHORS ChangeLog COPYING NEWS README THANKS TODO
%{_mandir}/man1/hello.1.gz
%{_infodir}/%{name}.info.gz
%{_bindir}/hello

%changelog
* Tue Sep 06 2011 The Coon of Ty <Ty@coon.org> 2.7-1
- Initial version of the package
Setelah selesai mengedit file SPEC, tahap berikut nya adalah siap melakukan Pemaketan RPM,
$ rpmbuild -ba hello.spec
untuk mengecek sukses atau tidak, silahkan jalankan aplikasi rpmlint dan mock seperti dibawah ini, akan ada report sukses ratenya.
$ rpmlint hello.spec ../SRPMS/hello* ../RPMS/*/hello*
$ mock -r fedora-15-i386 --rebuild ../SRPMS/hello-2.7-1.fc15.src.rpm
Selamat mencoba semoga berhasil.


Tidak ada komentar:

Posting Komentar