Kuliax

GNU/Linux untuk Kampus

Alat Pengguna

Alat Situs


devel:pkg:build:fortunes-kernelnewbies

Membangun Paket fortunes-kernelnewbies

Halaman ini berisi informasi dari awal sampai akhir bagaimana membangun paket fortunes-kernelnewbies secara bersih dengan pbuilder dan alat-alat standar di sistem Debian.

Kebutuhan

  • Debian 5.0 (lenny) dan repositori paketnya
  • Paket-paket pengembangan: build-essential, debhelper, debootstrap/cdebootstrap, devscripts, dh-make, fakeroot, gpg, pbuilder
  • Paket-paket pengujian pemaketan: linda dan lintian
  • Ruang penyimpan yang cukup, tergantung seberapa besar program dan komponen yang akan dibangun, termasuk direktori temporer /tmp

Persiapan

Langkah-Langkah

  1. Unduh paket sumber fortunes-kernelnewbies
  2. Buat direktori sesuai dengan nama paket yang diinginkan, rujuk Standar Pemaketan Kuliax
    mkdir fortunes-kernelnewbies-20060120
  3. Masuk ke direktori yang telah dibuat dan ekstrak paket sumber
    cd fortunes-kernelnewbies-20060120/
    tar zxvf ../kernelnewbies-fortunes.tar.gz
  4. Jalankan perintah `dh_make` untuk menghasilkan kerangka direktori debian/
    dh_make -s -c bsd -f ../kernelnewbies-fortunes.tar.gz

    Direktori debian/ akan berisi berkas-berkas yang dibutuhkan untuk memaketkan program

  5. Hapus berkas contoh yang tidak diperlukan
    $ cd debian/
    $ rm *.ex *.EX dirs docs README.Debian
  6. Sunting berkas-berkas yang ada di direktori debian/. Baca Standar Pemaketan Kuliax.
    debian/control:
    Source: fortunes-kernelnewbies
    Section: games
    Priority: optional
    Maintainer: Iwan Setiawan <stwn[@]kuliax[.]org>
    Build-Depends: cdbs, debhelper (>= 7)
    Build-Depends-Indep: fortune-mod
    Standards-Version: 3.8.0
    Homepage: http://old.kernelnewbies.org
    
    Package: fortunes-kernelnewbies
    Architecture: all
    Depends: fortune-mod
    Provides: fortune-cookie-db
    Description: Linux kernel hackers' quotes for fortune
     An official syndicated #kernelnewbies fortunes file that
     contained quotes from Linux kernel hackers on LKML and
     kernelnewbies community on IRC channel #kernelnewbies
     at irc.oftc.net.

    debian/copyright:

    This package was debianized by Iwan Setiawan <stwn[@]kuliax[.]org> on
    Sun, 31 Jan 2010 23:58:32 +0700.
    
    It was downloaded from http://old.kernelnewbies.org/kernelnewbies-fortunes.tar.gz
    
    Upstream Author:
    
        KernelNewbies.org <kernelnewbies@nl.linux.org>
    
    Copyright:
    
        Copyright (C) 2006 Linux Kernel Hackers and KernelNewbies.org Community
    
    License:
    
        I am not sure about the license, since upstream package does not have any
        README or license file except the fortunes database. So I follow many RPM
        packages which stated that it is under BSD.
    
        Redistribution and use in source and binary forms, with or without
        modification, are permitted under the terms of the BSD License.
    
        THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        SUCH DAMAGE.
    
    On Debian systems, the complete text of the BSD License can be
    found in `/usr/share/common-licenses/BSD'.
    
    The Debian packaging is (C) 2010, Iwan Setiawan <stwn[@]kuliax[.]org> and
    is licensed under the GPL, see `/usr/share/common-licenses/GPL'.

    debian/dirs:

    usr/share/games/fortunes

    debian/install

    kernelnewbies*  usr/share/games/fortunes

    debian/postinst:

    #!/bin/sh
    
    case "$1" in
            configure)
            cp /etc/profile /etc/profile.orig
            echo "Adding fortune kernelnewbies to /etc/profile..."
            echo 'echo ""' >> /etc/profile
            echo "fortune kernelnewbies" >> /etc/profile
            echo 'echo""' >> /etc/profile
            ;;
    
            abort-upgrade|abort-remove|abort-deconfigure)
            ;;
    
            *)
            echo "postinst called with unknown argument \`$1'" >&2
            exit 1
            ;;
    esac
    
    #DEBHELPER#
    
    exit 0

    debian/postrm

    #!/bin/sh
    
    case "$1" in
            purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
            echo "Removing fortune kernelnewbies from /etc/profile..."
            sed -i '/echo ""/d' /etc/profile
            sed -i '/fortune kernelnewbies/d' /etc/profile
            sed -i '/echo ""/d' /etc/profile
            ;;
    
            *)
            echo "postrm called with unknown argument \`$1'" >&2
            exit 1
            ;;
    esac
    
    #DEBHELPER#
    
    exit 0

    debian/rules:

    #!/usr/bin/make -f
    
    build:
    
    clean:
            dh_testdir
            dh_testroot
            dh_clean
    
    binary-indep: build install
            dh_clean
            dh_testdir
            dh_testroot
            dh_installchangelogs
            dh_installdocs
            dh_install
            dh_compress
            dh_fixperms
            dh_installdeb
            dh_gencontrol
            dh_md5sums
            dh_builddeb
    
    binary-arch: build install
    
    binary: binary-indep binary-arch
    
    .PHONY: build clean binary-arch binary install
  7. Sunting berkas changelog dengan perintah `dch`
    $ cd ..
    $ dch

    Sesuaikan dengan standar pemaketan. Set -0kuliax1 dibelakang versi upstream untuk pemaketan Kuliax yang pertama kali dan belum ada di Debian. Set distribusi ke pengembangan saat ini: lumpia. Yang paling penting, tulis semua perubahan yang telah dilakukan pada paket

  8. Bangun paket sumber dengan debuild1)
    $ debuild -S -sa

    Tanda tangani .dsc dan .changes dengan kunci GPG

  9. Bangun paket biner dan sumber
    $ sudo pbuilder build fortunes-kernelnewbies_20060120-0kuliax1.dsc

    Secara default, Hasil paket biner ada di direktori $BUILDRESULT

  10. Ujicoba paket
    sudo dpkg -i ../fortunes-kernelnewbies_20060120-0kuliax1_all.deb
    sudo apt-get remove --purge fortunes-kernelnewbies

Daftar Bacaan

1) Perbedaan debuild dan dpkg-buildpackage adalah debuild menjalankan perintah dpkg-buildpackage, kemudian melakukan pemeriksaan dengan linda dan/atau lintian, serta melakukan penandatangan terhadap berkas .changes dan .dsc
devel/pkg/build/fortunes-kernelnewbies.txt ยท Terakhir diubah: 2010/02/02 18:50 oleh stwn