| Building noarch packages in SUSE Linux |
| Written by Luke MacNeil | |||||||
| Sunday, 07 September 2008 | |||||||
|
This explains how to package files using RPM. This article describes building the Noarch packages. Basically, a package to distribute files without building any source.
Building noarch RPMS for SUSE linux.
SUSE has modified the build system
from the standard RedHat process.
Here are the steps I took to create
a usable RPM package under SUSE.
1.) Install the prerequisite packages on the build server.
# yast -i build
# yast -i gpg
2.) Configure the build environment
The build environment can be
modified in numerous ways, but I found the default to be usable.
After issuing the "build"
command for the first time as root, a /var/tmp/build-root/ directory structure
will be created.
This is basically a skeleton file
system. Any files that we want to include in the RPM will go in this directory.
3.) Lay out the files to be included in the RPM.
If you want to install /etc/sudoers,
add the sudoers file to /var/tmp/build-root/etc/sudoers ... etc. Then you can
note that in the next step.
4.) Create the RPM SPEC file.
Most of the derivatives in this file
are self explanatory, but the important ones are noted below.
As a test I created the file
/usr/src/packages/SPECS/lukescripts.spec :
--------- Start File
%define name lukescripts
%define version 1.1
%define release 1
Summary: LukeScripts, a collection
of tools
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Group: Amusements/Graphics
BuildArch: noarch
Provides: LukeScripts
%description
This package contains LukeScripts,
just random scripts as a test for building a non-source RPM.
%prep
exit 0
%build
exit 0
%install
exit 0
%clean
exit 0
%files
/tmp/lukescripts
/cvsrx
---------End
File
Note: the BuildArch: tag defines the
architecture of the machines that we want the RPM to build on. In this case
since we're not building any source code, we specify noarch. Basically, we're
just copying text files... If we were building C code, we'd specify i686.
Note: the %files section of the spec
file is what points to the files we want to include in the RPM. Adding
/tmp/lukescripts to this section tells RPM to take the files from
/var/tmp/build-root/tmp/lukescripts and put them in the binary package. When
the RPM is installed, those files will be extracted to /tmp/lukescripts on the
target machine. It's chroot juju.
5.) Build the RPM
Once the files are in place and
pointed to in the spec file, we can build the RPM.
Change to the directory containing
the .spec file... /usr/src/packages/SPECS
Issue the command:
# build
... simple enough. If all goes well
the rpm will be created and placed in
/var/tmp/build-root/usr/src/packages/RPMS/lukescripts-1.1-1.noarch.rpm
6.) Install and verify the new rpm.
suse1:/var/tmp/build-root/usr/src/packages/RPMS/noarch # rpm -ivh *
Preparing...
########################################### [100%]
1:lukescripts
########################################### [100%]
suse1:/var/tmp/build-root/usr/src/packages/RPMS/noarch # rpm -q
lukescripts
lukescripts-1.1-1
suse1:/var/tmp/build-root/usr/src/packages/RPMS/noarch # rpm -qvl
lukescripts
drwxr-xr-x 2 root root 0 Sep 9 13:59 /cvsrx
-rw-r--r-- 1 root root 0 Sep 9 13:59 /cvsrx/script1.sh
-rw-r--r-- 1 root root 0 Sep 9 13:59 /cvsrx/script2.sh
-rw-r--r-- 1 root root 0 Sep 9 13:59 /cvsrx/script3.sh
-rw-r--r-- 1 root root 0 Sep 9 13:59 /cvsrx/script4.sh
drwxr-xr-x 2 root root 0 Sep 9 13:47 /tmp/lukescripts
-rw-r--r-- 1 root root 0 Sep 9 13:21 /tmp/lukescripts/script1.sh
-rw-r--r-- 1 root root 0 Sep 9 13:21 /tmp/lukescripts/script2.sh
-rw-r--r-- 1 root
root 0 Sep 9 13:21 /tmp/lukescripts/script3.sh
-rw-r--r-- 1 root root 0 Sep 9 13:21 /tmp/lukescripts/script4.sh
suse1:/var/tmp/build-root/usr/src/packages/RPMS/noarch
#
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |
|||||||
