Cross-Platform Unix Software Packaging by vok91458


									Cross-Platform            The best way to predict

Unix Software
                          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
    Part I: Overview
 A brief overview of OpenPKG
  from a users point of view

A distributed system is one on      A supercomputer is
which I cannot get any work done,   a machine, that runs an
because a machine I have never      endless loop in just 2 seconds.
heard of has crashed.                         — Unknown
            — Leslie Lamport
The General Problem
 Different flavors of
  Unix Operating
  Systems in use.                               user
 Very(!) different sets
  of vendor supplied
                               ???              ???                   ???
  add-on applications:
    Number of total
    Program versions of
    Installation Paths       base              base             base
    Amount of pre-          kernel          kernel             kernel
                            Solaris         FreeBSD             Linux
                           There's a lesson to be learned from this
                           but I'll be damned if I know what it is.         3
                                                — Al Bundy
The OpenPKG Solution
 Different flavors of
  Unix Operating
  Systems in use.                                  user
 Vendor supplied
  add-on applications
  are ignored.
 All actually used
  add-on applications                    OpenPKG
  are provided cross-
  platform by OpenPKG.
                                base              base              base
 Engineers now only
  have to manage 1             kernel          kernel              kernel
  single virtual platform.    Solaris         FreeBSD              Linux
                             The software said it requires Solaris 2.6      4
                             or better, so I installed OpenPKG...
OpenPKG is...
 a cross-platform               currently available for:
  packaging facility for              Sun Solaris
  add-on Unix software.               Debian GNU/Linux
                                      RedHat Linux
 based on an extended                FreeBSD
  version of the popular              OpenBSD
  RedHat Package                      NetBSD
                                      Compaq Tru64 (partially)
  Manager (RPM v4).                   HP-UX (partially)
 a self-contained               very complete, i.e., it
  packaging system                currently provides
  which is maximum                already over 190
  independent of                  packaged applications.
  underlying OS.                 OpenPKG is freely
  Software is like sex;           available to anyone as
  it's better when it's free.
        — Linus Torvalds          Open Source.
Package Lifecycle
 Writing package                Fetching package
  specification                   from repository
 Building application           Installing package
  from vendor sources            Fetching newer
 Temporarily installing          version of package
  application                     from repository
 Rolling package from           Upgrading package
  installed application files    Deinstalling package
 Deinstalling application
 Place package into
                                         User Part
                                      My hack:
                                         This universe.
     Developer Part                   Just one little problem:
                                         core keeps dumping.
OpenPKG Live
                                                         Seek simplicity,
                                                         but distrust it.
                                                          — A. N. Whitehead

$ lynx
$ sh ./ --prefix=/cw –-user=cw –-group=cw
# sh ./
$ /cw/bin/rpm –-rebuild
# /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:
Release: 0                            Build Host:
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:         Install Time: Tue May 1 18:06:35 2001
Summary: Bourne-Again Shell
     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
Why to use OpenPKG?
 Package is reasonable          Sophisticated package
  wrapper around                  management:
  applications:                     flexible queries on package
   unattended and                   information
    repeatable building and         verification of package
    installation procedure           integrity
   packager knowledge built-    Single and uniform facility
    in (configure options,        for all platforms:
    additional patches, etc.)
                                    cross-platform
   package abstracts
    differences between             same filesystem paths
    applications                    reasonable default
 Both source and binary             configurations
  packages supported.               safe upgrading path
                                    complete deinstallation
Part II: Close-Up View
   A close-up view of OpenPKG
 from a developers point of view

 There are two types of people    Hiroshima '45
 in this world, good and bad.     Czernobyl '86
 The good sleep better, but the   Windows '95
 bad seem to enjoy the waking                :
 hours much more.
               — Woody Allen
Package Lifecycle
(Developer Part)                                 Recursive, adj.;
                                                   see Recursive.
 Writing the package       Building
  specification                configuration
   meta-information           compilation
   package source files    Installation
   package dependencies       redirection to temporary
   description text            root
   build instructions         performing installation
 Fetching source files        adding extra files
 Preparation               Packaging
   unpacking                  determining file list
   fixing permissions         rolling binary RPM
   applying patches           rolling source RPM
Package Lifecycle
(User Part)
 (Starting from scratch)        (Continuing)
  with source RPM:                with binary RPM:
   Fetching source RPM            Fetching binary RPM
   Installation of sources        Installation of binary
   Dev.-Step: Preparation         Upgrading of binary
   Dev.-Step: Building            Deinstallation of binary
   Dev.-Step: Installation
   Dev.-Step: Packaging          Patient: Doctor, it hurts when I do this!
   Deinstallation of sources     Doctor: Well, then don't do it.

   ...                           If a trainstation is where trains
                                  stop, what is a workstation?

Package Components
 Package Specification                                Extra files
  (RPM .spec-file)                                         packager or third-party
    central packaging                                      patches
     information                                           run-command scripts
 Vendor source(s)                                         default configuration
    distribution files                                     file(s)
    optionally patches                                    ...
                                                                             UNIX is simple.
                                                                             It just takes a genius to
                                                                             understand its simplicity.
                                                                                     — Dennis Ritchie

-rw-rw-r--   1   rse   openpkg       504   Apr   10   11:32   bash-2.05.patch.1
-rw-rw-r--   1   rse   openpkg      1033   Apr   10   11:32   bash-2.05.patch.2
-rw-rw-r--   1   rse   openpkg   1792319   Apr   10   11:23   bash-2.05.tar.gz
-rw-rw-r--   1   rse   openpkg      3770   Apr   10   11:33   bash.spec
-rw-rw-r--   1   rse   openpkg      1342   Feb    7   16:34   profile

Package Specification
Example (1)                                             What you see
                                                        is all you get.
                                                         — Brian Kernighan
Name:           bash
Summary:        Bourne-Again Shell                             Meta informations
Group:          Shell
Vendor:         Free Software Foundation
Distribution:   OpenPKG
License:        GPL                                                 List of sources
Version:        2.05
Release:        0

Source1:        profile
Patch0:         bash-%{version}.patch.1
Patch1:         bash-%{version}.patch.2

                %{l_buildroot}                                      Dependencies
BuildPreReq:    OpenPKG
PreReq:         OpenPKG
    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).
Package Specification
Example (2)
    %setup -q
    %patch0 -p0
    %patch1 -p0
    CC="%{l_cc}" \                                                        Building
    CFLAGS="%{l_cflags -O}" \
    ./configure \
    %{l_make} %{l_mflags -O}
    rm -rf $RPM_BUILD_ROOT
    %{l_make} %{l_mflags} install prefix=$RPM_BUILD_ROOT%{l_prefix}             Beware of bugs in
    rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir                                   the above code;
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/bash                                   I have only proved it
    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/bash          correct, not tried it.
    %{l_shtool} install -c -m 644 -e "s;@l_prefix@;%{l_prefix};g" \                   — D.E. Knuth
         $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                                                          Packaging
    rm -rf $RPM_BUILD_ROOT                                                                      14
Package Building

                   Murphy's Law is recursive:
                   Washing your car to make
                   it rain doesn't work.
More about OpenPKG
 The Website:

 The FTP Server:

 The RSYNC Server:

 The Anonymous-CVS Server:

 The Support Mailing List:       I have made this longer than usual
                                  because I lack the time to make it
                                  shorter.      — Blaise Pascal

To top