openpkg

advertisement
Cross-Platform
Unix Software
Packaging
The best way to predict
the future is to invent it.
— Alan Kay
Only those who attempt
the absurd can achieve
the impossible.
— Unknown
Ralf S. Engelschall
Development Team
Application Services
Cable & Wireless Deutschland
1
Part I: Overview
A brief overview of OpenPKG
from a users point of view
A distributed system is one on
which I cannot get any work done,
because a machine I have never
heard of has crashed.
— Leslie Lamport
A supercomputer is
a machine, that runs an
endless loop in just 2 seconds.
— Unknown
2
The General Problem
 Different flavors of
Unix Operating
Systems in use.
 Very(!) different sets of
vendor supplied addon applications:
 Number of total
applications
 Program versions of
applications
 Installation Paths
 Amount of preconfiguration
user
???
???
???
base
kernel
Solaris
base
kernel
FreeBSD
base
kernel
Linux
There's a lesson to be learned from this
but I'll be damned if I know what it is.
— Al Bundy
3
The OpenPKG Solution
 Different flavors of
Unix Operating
Systems in use.
 Vendor supplied
add-on applications
are ignored.
 All actually used
add-on applications
are provided crossplatform by OpenPKG.
 Engineers now only
have to manage 1
single virtual platform.
user
OpenPKG
base
kernel
Solaris
base
kernel
FreeBSD
base
kernel
Linux
The software said it requires Solaris 2.6
or better, so I installed OpenPKG...
4
OpenPKG is...
 a cross-platform
packaging facility for
add-on Unix software.
 based on an extended
version of the popular
RedHat Package
Manager (RPM v4).
 a self-contained
packaging system
which is maximum
independent of
underlying OS.
Software is like sex;
it's better when it's free.
— Linus Torvalds
 currently available for:








Sun Solaris
Debian GNU/Linux
RedHat Linux
FreeBSD
OpenBSD
NetBSD
Compaq Tru64 (partially)
HP-UX (partially)
 very complete, i.e., it
currently provides
already over 190
packaged applications.
 OpenPKG is freely
available to anyone as
Open Source.
5
Package Lifecycle
 Writing package
specification
 Building application
from vendor sources
 Temporarily installing
application
 Rolling package from
installed application files
 Deinstalling application
 Place package into
repository
Developer Part
 Fetching package
from repository
 Installing package
 Fetching newer
version of package
from repository
 Upgrading package
 Deinstalling package
User Part
My hack:
This universe.
Just one little problem:
core keeps dumping.
6
OpenPKG Live
Seek simplicity,
but distrust it.
— A. N. Whitehead
$ lynx http://www.openpkg.org/pkg/openpkg-0.9-36.src.sh
$ sh ./openpkg-0.9-36.src.sh --prefix=/cw –-user=cw –-group=cw
[...]
# sh ./openpkg-0.9-36.ix86-freebsd4.4.sh
[...]
$ /cw/bin/rpm –-rebuild http://www.openpkg.org/pkg/bash-2.05-3.src.rpm
[...]
# /cw/bin/rpm –Uvh /cw/RPM/PKG/bash-2.05-3.ix86-freebsd4.4.rpm
bash
##################################################
$ /cw/bin/rpm –qi bash
Name:
bash
Source RPM:
bash-2.05-3.src.rpm
Version: 2.05
Packager:
rse@openpkg.org
Release: 0
Build Host:
dev1.de.cw.net
Group:
Shell
Build System: ix86-freebsd4.4
Distrib: OpenPKG
Build Time:
Tue May 1 18:06:25 2001
License: GPL
Relocations: /cw
Vendor: Free Software Foundation
Install Size: 1065082 bytes
URL:
http://www.gnu.org/
Install Time: Tue May 1 18:06:35 2001
Summary: Bourne-Again Shell
Description:
Bash (Bourne-Again Shell) is an sh-compatible command language interpreter
that executes commands read from the standard input or from a file. Bash
also incorporates useful features from the Korn and C shells (ksh and csh).
Bash is intended to be a conformant implementation of the IEEE POSIX Shell
and Tools specification (IEEE Working Group 1003.2).
$ /cw/bin/bash
7
Why to use OpenPKG?
 Package is reasonable
wrapper around
applications:
 unattended and
repeatable building and
installation procedure
 packager knowledge builtin (configure options,
additional patches, etc.)
 package abstracts
differences between
applications
 Both source and binary
packages supported.
 Sophisticated package
management:
 flexible queries on package
information
 verification of package
integrity
 Single and uniform facility
for all platforms:
 cross-platform
 same filesystem paths
 reasonable default
configurations
 safe upgrading path
 complete deinstallation
8
Part II: Close-Up View
A close-up view of OpenPKG
from a developers point of view
There are two types of people
in this world, good and bad.
The good sleep better, but the
bad seem to enjoy the waking
hours much more.
— Woody Allen
Hiroshima '45
Czernobyl '86
Windows '95
:
9
Package Lifecycle
(Developer Part)
 Writing the package
specification
 meta-information
 package source files
 package dependencies
 description text
 build instructions
 Fetching source files
 Preparation
 unpacking
 fixing permissions
 applying patches
 Building
Recursive, adj.;
see Recursive.
 configuration
 compilation
 Installation
 redirection to temporary
root
 performing installation
 adding extra files
 Packaging
 determining file list
 rolling binary RPM
 rolling source RPM
10
Package Lifecycle
(User Part)
 (Starting from scratch)
with source RPM:
 Fetching source RPM
 Installation of sources
 Dev.-Step: Preparation
 Dev.-Step: Building
 Dev.-Step: Installation
 Dev.-Step: Packaging
 Deinstallation of sources
 ...
 (Continuing)
with binary RPM:
 Fetching binary RPM
 Installation of binary
 Upgrading of binary
 Deinstallation of binary
Patient: Doctor, it hurts when I do this!
Doctor: Well, then don't do it.
If a trainstation is where trains
stop, what is a workstation?
11
Package Components
 Package Specification
(RPM .spec-file)
 Extra files
 packager or third-party
patches
 run-command scripts
 default configuration
file(s)
 ...
 central packaging
information
 Vendor source(s)
 distribution files
 optionally patches
-rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--rw-rw-r--
1
1
1
1
1
rse
rse
rse
rse
rse
openpkg
openpkg
openpkg
openpkg
openpkg
504
1033
1792319
3770
1342
UNIX is simple.
It just takes a genius to
understand its simplicity.
— Dennis Ritchie
Apr
Apr
Apr
Apr
Feb
10
10
10
10
7
11:32
11:32
11:23
11:33
16:34
bash-2.05.patch.1
bash-2.05.patch.2
bash-2.05.tar.gz
bash.spec
profile
12
Package Specification
Example (1)
What you see
is all you get.
— Brian Kernighan
Name:
Summary:
Group:
URL:
Vendor:
Packager:
Distribution:
License:
Version:
Release:
bash
Bourne-Again Shell
Shell
http://www.gnu.org/
Free Software Foundation
rse@openpkg.org
OpenPKG
GPL
2.05
0
Source0:
Source1:
Patch0:
Patch1:
ftp://ftp.gnu.org/gnu/bash/bash-%{version}.tar.gz
profile
bash-%{version}.patch.1
bash-%{version}.patch.2
Prefix:
BuildRoot:
BuildPreReq:
PreReq:
%{l_prefix}
%{l_buildroot}
OpenPKG
OpenPKG
Meta informations
List of sources
Dependencies
Description
%description
Bash (Bourne-Again Shell) is an sh-compatible command language interpreter
that executes commands read from the standard input or from a file. Bash
also incorporates useful features from the Korn and C shells (ksh and csh).
Bash is intended to be a conformant implementation of the IEEE POSIX Shell
and Tools specification (IEEE Working Group 1003.2).
13
Package Specification
Example (2)
%prep
%setup -q
%patch0 -p0
%patch1 -p0
%build
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
./configure \
--prefix=%{l_prefix}
%{l_make} %{l_mflags -O}
Preparation
Building
Installation
%install
rm -rf $RPM_BUILD_ROOT
%{l_make} %{l_mflags} install prefix=$RPM_BUILD_ROOT%{l_prefix}
rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
strip $RPM_BUILD_ROOT%{l_prefix}/bin/bash
%{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/bash
%{l_shtool} install -c -m 644 -e "s;@l_prefix@;%{l_prefix};g" \
$RPM_SOURCE_DIR/profile $RPM_BUILD_ROOT%{l_prefix}/etc/bash/
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/bash/profile'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
Beware of bugs in
the above code;
I have only proved it
correct, not tried it.
— D.E. Knuth
Packaging
14
Package Building
Murphy's Law is recursive:
Washing your car to make
it rain doesn't work.
15
More about OpenPKG
 The Website:
http://www.openpkg.org/
 The FTP Server:
ftp://ftp.openpkg.org/
 The RSYNC Server:
rsync://rsync.openpkg.org/
 The Anonymous-CVS Server:
:pserver:anoncvs@cvs.openpkg.org:/cvs
 The Support Mailing List:
openpkg-users@openpkg.org
I have made this longer than usual
because I lack the time to make it
shorter.
— Blaise Pascal
16
Download