openmamba logo
Ready to use GNU/Linux
general information distribution forum community wiki bugs events
info   software   forum community wiki bugs events
forum  Documentazione (Wiki)

Autospec

From Wiki :: openmamba

Jump to: navigation, search

Contents

Pre-requirements

  • autospec user should belong to the packager group. The default user created during openmamba installation does already belong to this group.

Installation

Install the package called autospec using apper or the following command:

sudo smart install autospec

Configuration

In your home create a file called

.autospec

with a content like this:

# [configuration file for `autospec']

DISTRO="openmamba"
VENDOR="openmamba"

packager_fullname="''enter your full name here''"
packager_email="''enter your email address here''"

ftp_alias[0]="devel"
ftpurl_ro_rpms[0]="http://www.openmamba.org/pub/openmamba/devel/RPMS.@arch@"
ftpurl_ro_srpms[0]="http://www.openmamba.org"
ftp_rw_server[0]="ftp://ftp.openmamba.org/"
ftp_rw_port[0]=
ftp_rw_passive_mode[0]=on
ftp_rw_user[0]=
ftp_rw_passwd[0]=""
ftp_rw_rpms_dir[0]="/RPMS.@arch@"
ftp_rw_srpms_dir[0]="/SRPMS.base"
ftp_rw_server[0]=""
ftp_rw_port[0]=
ftp_rw_passive_mode[0]=on
ftp_rw_user[0]=
ftp_rw_passwd[0]=""
ftp_rw_rpms_dir[0]="/RPMS.@arch@"
ftp_rw_srpms_dir[0]="/SRPMS.base"
arch_list[0]="i586"
arch_noarch_upload[0]="${arch_list[0]}"
ftpdir_rw_old[0]="/old"

ftp_alias[1]="devel-games"
ftpurl_ro_rpms[1]="http://www.openmamba.org/pub/openmamba/devel-games/RPMS.@arch@"
ftpurl_ro_srpms[1]="http://www.openmamba.org/pub/openmamba/devel-games/SRPMS.base"
ftp_rw_server[0]="ftp://ftp.openmamba.org/"
ftp_rw_port[0]=
ftp_rw_passive_mode[0]=on
ftp_rw_user[0]=
ftp_rw_passwd[0]=""
ftp_rw_rpms_dir[0]="/RPMS.@arch@"
ftp_rw_srpms_dir[0]="/SRPMS.base"
ftp_rw_server[0]=""
ftp_rw_port[0]=
ftp_rw_passive_mode[0]=on
ftp_rw_user[0]=
ftp_rw_passwd[0]=""
ftp_rw_rpms_dir[0]="/RPMS.@arch@"
ftp_rw_srpms_dir[0]="/SRPMS.base"
arch_list[1]="i586"
arch_noarch_upload[1]="${arch_list[1]}"
ftpdir_rw_old[1]="/old"

ftp_rw_server_num_default=0
format_description_width=0

This configuration gives read-only access to the devel[1] and devel-games [2] repositories.

Configuring a proxy in Autospec

In the .autospec file in your home add the line proxy="indirizzoproxy:porta" e.g.: proxy="10.12.111.10:3128"

and replace each repository configuration with the following lines (replace [0] with the number associated to each repository):

ftp_rw_server[0]="http://www.openmamba.org"
ftp_rw_rpms_dir[0]="/pub/openmamba/''enter repository name here''/RPMS.@arch@"
ftp_rw_srpms_dir[0]="/pub/openmamba/''enter repository name here''/SRPMS.base"
ftpurl_ro_rpms[0]="ftp://ftpaccounts.openmamba.org/pub/openmamba/''enter repository name here''/RPMS.@arch@"
ftpurl_ro_srpms[0]="ftp://ftpaccounts.openmamba.org/pub/openmamba/''enter repository name here''/SRPMS.base"

Creating a new RPM package

You need to start getting the following information:

  • source url archive: the full internet address of the source archive for the software you want to package
  • package name: the package name, usually the first part of the <source archive url>

type the following command:

autospec -s source_url_archive -o package_name.spec

If the package is ok a spec file will be created with the name:

/usr/src/RPM/SPEC/package_name.spec

before proceeding you need to edit this file and add some information:

  • Summary: a short description of the software component
  • Group: a group taken from the openmamba defined groups
  • URL: the internet address of the home page with descriptive information on this software
  • License: the license of this software

Updating a RPM package

autospec lets you update a software package in a smart way, by scraping automatically for most packages the latest available release.

Enter the following commnand:

autospec -u package_name -a1:4

If the new release is not found automatically, or an unstable release was detected, you can explicitely specify the new release with the following command:

autospec -u package_name -a1,3,4 new_release_number

Compilling and packaging

In order to compile the software component and to create binary RPM packages enter the following command:

autospec -u package_name -a5

This operation takes a variable time, from some seconds to hours according to the complexity and size of the software.

File grouping

If everything goes fine you will get a list of installed files like in this example:

Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/libz-root
error: Installed (but unpackaged) file(s) found:
   /lib/libz.so.1
   /lib/libz.so.1.2.3
   /usr/include/zconf.h
   /usr/include/zlib.h
   /usr/include/zutil.h
   /usr/lib/libz.a
   /usr/lib/libz.so
   /usr/share/man/man3/zlib.3.gz


RPM build errors:
    Installed (but unpackaged) file(s) found:
   /lib/libz.so.1
   /lib/libz.so.1.2.3
   /usr/include/zconf.h
   /usr/include/zlib.h
   /usr/include/zutil.h
   /usr/lib/libz.a
   /usr/lib/libz.so
   /usr/share/man/man3/zlib.3.gz

These files should be included in the main package or in a subpackage. In this example, the zlib library, the main package will be called libz and a subpackage called libz-devel should be added. The -devel subpackage should contain all the files that are only needed for development of other software components that use this library as a dependency. Examples of this kind of files are:

  •  %{_includedir}/*.h, %{_includedir}/*.hpp: library headers
  •  %{_libdir}/*.so: link to the library used during compilation of dependent software
  •  %{_libdir}/*.la: file containing information on linking to this library
  •  %{_libdir}/*.a: static library used for making applications that do not depend on dynamic (or shared) libraries
  •  %{_libdir}/pkgconfig/*.pc: file containing the flags passed to the compiler and linker for using this library

When you have updated the specfile, before relaunching the compilation, you can verify that all files have been correctly included in the %files lists with:

rpmbuild -bl package_name.spec

If this operation doesn't return with errors of doesn't list files that are not yet included in the lists, you can run the compilation again, and this time the final packages should be produced at the end.

Where the produced packages are

If the operation completed successfully, in the directory:

/usr/src/RPM/RPMS/i586

or

/usr/SRC/RPM/RPMS/noarch

you will find the producted installable packages, while the source package will be in:

/usr/SRC/RPM/SRPMS

Problems compiling and packaging

This is the most complex part of the process, it is like the middle of the game in chess, when you have to put your genius, experience, intuition etc. to get to the desired result!

Normally the first thing to do is looking, among the many appearing messages, which was the error that caused the process to fail. Commonly when you see many errors it is sufficient to start considering the first one, because the following could be a consequence of it.

Usually you need to make changes to the specfile and/or apply some patches to the source code.

In any case there are different ways to proceed and get to a working result, and it is a good rule to choose a way that takes into consideration the following things:

  • the way the software is developed and maintained by its own developer(s). Because new releases will be available is it a good idea to make changes that will supposedly work also when updating the package
  • what is done should be clear to other package mainatiners
  • in any case you should remove from a specfile something that is unclear
  • avoid adding software functionality regression problems: after updating the package to the new release it must have at least the same functionality of the previous release

Build requirements verification

When package have been successfully created, you have to verify that all the needed build requirements have been specified. autospec can automatically detect most of these with the following command:

autospec -u package_name -a6

e.g.:

[silvan@openmamba SPECS]$ autospec -u mediawiki -a6
updating mediawiki package to version [?]...
[step 6] -- creation of a build requirement list
 * /usr/src/RPM/RPMS/noarch/mediawiki-1.10.2-3mamba.noarch.rpm
 * /usr/src/RPM/RPMS/noarch/mediawiki-theme-openmamba-1.10.2-3mamba.noarch.rpm
## AUTOBUILDREQ-BEGIN
BuildRequires: apache-mod_php
BuildRequires: bash
BuildRequires: diffutils
BuildRequires: ImageMagick-devel
BuildRequires: mysql
BuildRequires: php-apc
BuildRequires: php-devel
BuildRequires: php-mysql
## AUTOBUILDREQ-END

Copy or modify the text between ##AUTOBUILDREQ-BEGIN and ##AUTOBUILDREQ-END (including these two lines) in the specfile and add below other build requirements that you know are missing.

Then it is not necessary to performa a new build, but just recreating the source package with the command:

autospec -u package_name -a5 --norpm

Installation test

When packaging is completed, a test is necessary. You should do this by installing the created RPM packages. These will be in the following dirs:

RPM paths
Path Content Extention
/usr/src/RPM/SRPMS Sources .src.rpm
/usr/src/RPM/RPMS/noarch Package that can be installed in all architectues .noarch.rpm
/usr/src/RPM/RPMS/i586 Package installable on i586 and compatible architectures .i586.rpm
/usr/src/RPM/RPMS/SOURCES Source archives, patches and other source files .tar.gz .tar.bz2 .zip and others
/usr/src/RPM/RPMS/SPEC Packaging scripts (specfiles) .spec

In order to install packages you can use the rpm command:

sudo rpm -i package1_name package2_name ...

or use autospec that can install all available packages with the following command:

autospec -u package_name -a11

Sending packages to a repository

To be able to send packages to a repository you need authorization for FTP upload. This is normally done using your own repository personal repository. You can reuest yours contacting the distribution maintainers.

Your own repository has to be configured adding the following lines in the ~/.autospec file. This example shows the configuration for a hypothetical repository called devel-john, belonging to the john user and supposing that the first configuration vector is number 2:

# Personal repository

ftpurl_ro_rpms[2]="http://www.openmamba.org/pub/openmamba/devel-john/RPMS.@arch@"
ftpurl_ro_srpms[2]="http://www.openmamba.org/pub/openmamba/devel-john/SRPMS.base"

ftp_rw_server[2]="ftp://ftpaccounts.openmamba.org"
ftp_rw_port[2]=
ftp_rw_passive_mode[2]=on
ftp_rw_user[2]=john
ftp_rw_passwd[2]="password"
ftp_rw_rpms_dir[2]="/RPMS.@arch@"
ftp_rw_srpms_dir[2]="/SRPMS.base"

arch_list[2]="i586"

arch_noarch_upload[2]="${arch_list[0]}"

ftpdir_rw_old[2]="/old"

Package can be uploaded with the following command:

autospec -u package_name -a10 --server 2