Making Pisi Packages
Contents |
PİSİ (Packages Installed Successfully as Intended) is a binary package management system which have been developed within Pardus project. PİSİ has more function than just installing/uninstalling packages. For example, it is possible to regain old package setup atomatically. Packages need to be processed as pisi packages and presented as binary packages for using them as pisi packages. For detailed information you can look at Pardus official site
Basics
Package: A program, document or any kind of data for installing to system
Source file: A file that includes files which belongs to package and generally presented as archive files and generally downloadable via internet. Programs generally uses files that are archived as .tar.gz files. Archived files need to include program's non-compiled source code, data that program needs and documents.
Compiling: Operation that needs to be done to make exectuable binary files of programs that is written in compilable programing language like C,C++.
Dependency: Other packages that program uses while it is running or compiling.
Integrity code: This code is being used to verify that any downloaded data has been succesfully downloaded without getting damaged. Sites generally put integrity codes obtained by md5 or sha algorithms for source files. Verifing is done by compraing this code and the code obtained from downloaded data.
Packager's point of view
Adding package to pisi system is more than just making a pisi package. It is a process including gathering information about the package you want to make pisi package of, testing and debugging your pisi package, keeping up with newer versions. A user should start building pisi packages only if user thinks s/he can follow this process. Pisi packages are like the children of the packager and hets replenished with every single debugging and version change. However, unsupervised packages can't live long in the linux world which is growing rapidly. People shouldn't make pisi packages as many as they can, but should make pisi packages as many as they can keep track of. And also don't forget to share your packages from the internet as Linux world is one of the best examples of colloective working. By doing so, you can also find other users who can help you with debugging and keeping track of your package.
Packaging Mechanism
This mechanism is a mechanism that makes binary packages that pisi uses by using source codes. If we omit technical details, process is like following:
- Source codes get downloaded by processing "Source" part of the pspec.xml file and after it gets verified, it gets extracted to /var/pisi/package_name/work
- To obtain binary data action.py gets processes and instalation is made to /var/pisi/package_name/install using source code.
- If there is any additional file they get coppied to /install directory as it defined at pspec.xml
- Pisi makes index file for the files in the /install directory. This index is compatible with pisi database and in XML format.
- Index and binary get combined with datas obtained from pspec.xml and archived as .pisi package
As one can see, pisi installs package to /var/pisi/paket_adi/install while it produces .pisi file. Pisi behaves this directory as it were root system. By examining this directory one can monitor which files go to which directory.
Pardus SVN Repository
Pardus SVN repository is a kind of library that you can examine pardus projects and the source files of pisi packages that developers made. You can check how developers made pisi packages for similiar packages that you want to make a pisi package for. You can access this repository from here. At that site, there is pisi source files of pisi packages. All answers to "how" questions that new beginners ask actually can be found in source files avaible at Pardus SVN repository.
File and Directory Locations
Mandatory packaging files that pisi requires are pspec.xml and actions.py. Both should be in same directory. "comar" and "files" directories can be used if necessary. These directories must be in same directory as pspec.xml. Source files looks like this:
package_name
|__pspec.xml
|__actions.py
|__files
|__comar
|__package.py
|__service.py
PiSi Package Building
Structure of a PiSi 1.1 Package
A pisi package is essentially a zipped file. Let's download one and examine it:
$ wget http://paketler.pardus.org.tr/pardus-2007/knazar-0.2-3-3.pisi $ unzip knazar-0.2-3-3.pisi -d apackage Archive: knazar-0.2-3-3.pisi inflating: apackage/metadata.xml inflating: apackage/files.xml inflating: apackage/install.tar.lzma $ cd apackage $ ls files.xml install.tar.lzma metadata.xml
- files.xml contains locations, types, sizes and sha1sums of all files in the package
- metadata.xml contains general information like package name, homepage, packager, etc.
- install.tar.lzma contains compressed files that we can extract with those commands
$ lzma -d install.tar.lzma install.tar $ tar xvf install.tar
Building a PiSi Package
In order to build a pisi package we need to prepare at least two files by hand: pspec.xml and actions.py
pspec.xml
This file is an XML file containing at least 3 child nodes: Source, Package, History
There can be multiple Package nodes in here.
In other words, one source package may generate multiple binary packages. Pisi is very flexible :)
Let's look at our example here: http://svn.pardus.org.tr/pardus/devel/desktop/kde/knazar/pspec.xml
As you can see in the example,
- Source node contains general package and packager information, sha1sum, type and location of source archive, Patches and BuildDependencies.
- Package node contains RuntimeDependencies and locations of different file types, AdditionalFiles and Comar scripts if needed.
- History node simply contains information about package history.
You may want to examine the dtd file for pisi here: http://www.pardus.org.tr/projeler/pisi/pisi-spec.dtd
Installation of Additional Files from the Files Of the Source Tree
The Package may contain the AdditionalFiles tag, which can be used to copy files from the files subdirectory of your source tree into the .pisi.
E.g., suppose I have a structure like so:
myproject/ myproject/files/somefile.config myproject/actions.py myproject/pspec.xml
Then, (one of) the Package(s) can have the following:
<Package>
<Name>myproject</Name>
<Summary>Core of MyProject.</Summary>
<RuntimeDependencies>
<Dependency>some-lib</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="executable">/usr/bin</Path>
</Files>
<AdditionalFiles>
<AdditionalFile target="/etc/path/to/install" permission="0644"
owner="root">somefile.config</AdditionalFile>
</AdditionalFiles>
</Package>
actions.py
This file contains python codes that would compile and install the source package into a specific InstallDIR (in our example it is /var/pisi/knazar-0.2-3-3/install/)
http://svn.pardus.org.tr/pardus/devel/desktop/kde/knazar/actions.py
In this file, we use actionsapi that comes with pisi. Actions API has all functions for us to compile and install our package.
If you know python, you may want to have a look at sources here: http://svn.pardus.org.tr/uludag/trunk/pisi/pisi/actionsapi/
After preparing pspec.xml and actions.py you can easily form a pisi package by typing:
sudo pisi build pspec.xml
in the console. To compile my example you may type:
sudo pisi bi http://svn.pardus.org.tr/pardus/devel/desktop/kde/knazar/pspec.xml
Finally, you can examine other official pisi source packages here: http://svn.pardus.org.tr/pardus/devel/