[ önceki ] [ İçindekiler ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ sonraki ]
Özgür yazılım dünyasında kaynak kodlar üzerinde çalışma, hata bulma ve düzeltme oldukça yaygındır. Bunu yapabilmek için programın kaynak kodlarını indirmeniz gereklidir. APT sistemi, dağıtım içerisinde yer alan paketlerin kaynak kodlarını, .deb paketi oluşturulabilmesi için yapılan değişiklikleri de içerecek şekilde indirmenizi sağlayacak fonksiyonlara sahiptir.
Debian kaynak paketlerinin kullanılmasının gerektiği diğer bir durum ise, belirli bir paketin unstable dağıtımdaki versiyonunu stable dağıtım için yeniden hazırlamak istediğiniz durumdur. Bir paketi stable dağıtım için oluşturduğunuzda bağımlılıklar da stable dağıtıma göre düzenlenir.
To accomplish this, the deb-src entry in your /etc/apt/sources.list should be pointed at unstable. It should also be enabled (uncommented). See section /etc/apt/sources.list dosyası, Kısım 3.1.
Aptitude, the Debian Package Manager is mainly targeted at binary packages. To
use source packages we'll need to use apt-get
instead. To
download a source package, you would use the following command:
$ apt-get source paket_adı
Bu komut üç dosyanın indirilmesini sağlayacaktır: bir .orig.tar.gz, bir .dsc ve bir de .diff.gz. Eğer paket Debian'a özgü ise, son iki dosya indirilmez ve dosya adı büyük olasılıkla orig ön-ekini içermez.
.dsc dosyası dpkg-source tarafından kaynak paketi paket_adı-versiyon dizini altına açmak için kullanılır. İndirilen her bir debian kaynak paketi açıldıktan sonra, debian adında bir dizin içerir. Bu dizinde .deb paketini oluşturmak için yapılan tüm değişiklikler bulunmaktadır.
Kaynak paket indirildikten hemen sonra .deb paketinin oluşturulmasını istiyorsanız auto-build seçeneği işinize yarayacaktır. Bunun için komutu -b anahtarı ile aşağıdaki gibi kullanmalısınız:
$ apt-get -b source packagename
Eğer indirdikten hemen sonra yerine daha ileriki zamanlarda .deb paketini oluşturmak isterseniz aşağıdaki komutla bunu yapabilirsiniz:
$ dpkg-buildpackage -rfakeroot -uc -b
Notice that to build most packages you'll need at least the following packages:
devscripts
, dpkg-dev
, debhelper
,
fakeroot
, take a look at Paket kurma, Kısım 4.4 and install them
before proceeding. Most packages will also depend on compilation tools, so it
may be useful to install the build-essential
package as well.
Other packages may be needed, take a look at Kaynak
paketleri derlemek için gerekli paketler, Kısım 5.2 for more information.
To install the package built by the commands above one must use the package
manager directly. Take a look at Installing manually downloaded or
locally created debian packages, Kısım 4.5. A useful tool is provided by
the devscripts
package: debi
. If you run
debi
from inside the source package directory it will look for the
.changes file at the parent directory to discover what are the
binary packages the package produces and will run dpkg
to install
all of them. While this is not very useful if your source package produces
conflicting packages, it might be in most circunstances. Of course you need
root powers in order to perform this.
apt-get
'in source fonksiyonu ile diğerleri arasında
birtakım farklar bulunmaktadır. Burada paketin indirilebilmesi için root
kullanıcısı olunmasına gerek yoktur, indirilen paketler o an bulunulan dizin
içerisine açılırlar.
Doğal olarak derleyeceğiniz programın ihtiyaç duyduğu kütüphanelerin sisteminizde bulunması zorunludur. Tüm kaynak paketler debian/control dosyalarında 'Build-Depends:' adlı bir alana sahiptir, bu alanda paketin kaynak koddan derlenebilmesi için ihtiyaç duyduğu paketler belirtilir.
APT bu paketleri kolayca indirmek ve kurmak için gerekli fonksiyona sahiptir. apt-get build-dep paket_adı komutu ile derlemek istediğiniz paketin Build-Depends alanında belirtilen paketlerin sisteminize kurulması sağlanır.
# apt-get build-dep gmc Reading Package Lists... Done Building Dependency Tree... Done The following NEW packages will be installed: comerr-dev e2fslibs-dev gdk-imlib-dev imlib-progs libgnome-dev libgnorba-dev libgpmg1-dev 0 packages upgraded, 7 newly installed, 0 to remove and 1 not upgraded. Need to get 1069kB of archives. After unpacking 3514kB will be used. Do you want to continue? [Y/n]
Burada gmc
paketinin kaynak halinden derlenebilmesi için gerekli
paketler sisteme kurulmaktadır. Bu komutun kaynak paketi indirmediğini
unutmayın, kaynak paketi apt-get source ile ayrıca indirmelisiniz.
Eğer amacınız belirli bir kaynak paketi derleyebilmek için gereken paketlerin listesini almak ise bunun için apt-cache show türevi bir komut kullanılır, bkz. Paketler hakkında bilgi toplama, Bölüm 6.
# apt-cache showsrc paket_adı
If you want to build a package for debuging purposes to, for example, report a bug -- or fix one, you can use simple environment variables that are supported by most Debian packages.
To build a package which contains unstriped binaries[6] all you need to do is prefix it with DEB_BUILD_OPTIONS=nostrip. Optimizations can also make debuging harder, so you can disable them by adding the noopt string to the DEB_BUILD_OPTIONS variable too. Example:
$ DEB_BUILD_OPTIONS="nostrip noopt" dpkg-buildpackage -rfakeroot -uc -b
If what you want is to customize the way the package is built you'll have to go
about editing the debian/rules
file. This means: inside the main
directory created when the source package is extracted there will be a
debian directory, which contains many files. One of them is
special: the rules
file.
This file is usually a Makefile that has targets to configure, build, install
and create the package. For example, if I want to have the
luola
[7] built
without sound I can, after downloading and extracting its source edit the
debian/rules
file that looks like this:
[...] configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. ./configure $(confflags) \ --prefix=/usr \ --mandir=share/man \ --infodir=share/info \ --datadir=share/games \ --bindir=games \ --enable-sound # --enable-sdl-gfx touch configure-stamp [...]
See the --enable-sound switch? If I remove it or replace it with --disable-sound and then rebuild the package using the technique described on Kaynak paketleri indirme, Kısım 5.1 I'll have a luola package that is built with no sound.
If you really want to work with source packages on a daily basis I would
suggest reading the Debian New Maintainers
Guide
and the Debian Policy
,
mainly. Other documentation available from the Debian Developers Corner
may be
useful too.
Sometimes, people want to use a specific version of a program available only on source code, with no Debian package. But the packaging system can be a trouble when doing this. Suppose you want to compile a new version of your email server. All is fine, but many packages in Debian depend on an MTA (Mail Transfer Agent). Since you installed something you compiled by yourself, the packaging system doesn't know about it.
Burada equivs
programı devreye girmektedir. Programı kurmak için
aynı isimli paketi sisteminize kurmalısınız. Bu program ile boş bir paket
yaratıp, bağımlılık problemlerini çözebilir ve paket yönetim sisteminin içini
rahatlatabilirsiniz.
Başlamadan önce hatırlatmak isteriz ki, Debian için zaten paketi hazırlanmış bir programı farklı derleme seçenekleriyle derlemenin daha güvenli ve uygun yolları vardır. Eğer ne yaptığınızı tam olarak bilmiyorsanız equivs kullanmayınız. Ayrıntılı bilgi için bkz. Building from source, Bölüm 5.
MTA örneğimize kaldığımız yerden devam edelim. Yeni derlemiş olduğunuz
postfix
programını sisteminize kurdunuz ve ardından
mutt
paketini kurmak istediniz. Fakat mutt
paketinin
başka bir MTA kurulmasını gerektirdiğini gördünüz ama zaten sisteminizde bir
MTA var !
Herhangi bir dizine geçip (örneğin /tmp
) aşağıdaki komutu
çalıştırın:
# equivs-control name
isim değerini oluşturmak istediğiniz control dosyasının adı ile değiştiriniz. Ardından dosya aşağıdaki şekilde oluşturulacaktır:
Section: misc Priority: optional Standards-Version: 3.0.1 Package: <enter package name; defaults to equivs-dummy> Version: <enter version here; defaults to 1.0> Maintainer: <your name and email address; defaults to username> Pre-Depends: <packages> Depends: <packages> Recommends: <packages> Suggests: <package> Provides: <(virtual)package> Architecture: all Copyright: <copyright file; defaults to GPL2> Changelog: <changelog file; defaults to a generic changelog> Readme: <README.Debian file; defaults to a generic one> Extra-Files: <additional files for the doc directory, comma separated> Description: <short description; defaults to some wise words> long description and info . second paragraph
Bu dosyayı kendi isteğimize göre değiştirebiliriz. Tüm alanları açıklamaya şimdilik burada gerek yok, hemen amacımızı gerçekleştirelim:
Section: misc Priority: optional Standards-Version: 3.0.1 Package: mta-local Provides: mail-transport-agent
Evet, hepsi bundan ibaret. mutt
paketi sistemde
mail-transport-agent
paketi olmasını gerektirir. Bu sanal bir
pakettir ve tüm MTA'lar tarafından sağlanır. Aynı davranış için paket ismi
olarak doğrudan mail-transport-agent
seçebilirdik, ancak sanal
paket kavramını ve Provides alanını kullanarak bunu gerçekleştirdik.
The Conflicts and Replaces fields are needed, too, so
that APT
and dpkg
will understand they should remove
the currently installed MTA package in favour of the new one you're installing.
Now you only need to build the package:
# equivs-build isim dh_testdir touch build-stamp dh_testdir dh_testroot dh_clean -k # Add here commands to install the package into debian/tmp. touch install-stamp dh_testdir dh_testroot dh_installdocs dh_installchangelogs dh_compress dh_fixperms dh_installdeb dh_gencontrol dh_md5sums dh_builddeb dpkg-deb: building package `isim' in `../isim_1.0_all.deb'. The package has been created. Attention, the package has been created in the current directory,
Ve sonra üretilen .deb paketini sisteminize kurmalısınız.
Gördüğünüz gibi equivs
programının kullanılabileceği pek çok durum
vardır. Örneğin favorilerim adlı bir paket oluşturabilir ve bu
paketin sıklıkla kullandığınız paketlere bağımlı olmasını sağlayabilirsiniz
(Depends alanı ile). Ardından bu paketi sisteminize kurup, bağımlılık
verdiğiniz diğer tüm paketlerin de kurulmasını sağlamış olursunuz.
It is important to note that there are example control files in
/usr/share/doc/equivs/examples
. Check them out.
[ önceki ] [ İçindekiler ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ sonraki ]
APT NASIL
2.0.2 - October 2006kov@debian.org
murat@debian.org