Cross-Platform Unix Software Packaging by vok91458

VIEWS: 11 PAGES: 16

									Cross-Platform            The best way to predict

Unix Software
                          the future is to invent it.
                                   — Alan Kay


Packaging
                          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      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
                                                                      2
The General Problem
 Different flavors of
  Unix Operating
  Systems in use.                               user
 Very(!) different sets
  of vendor supplied
                               ???              ???                   ???
  add-on applications:
    Number of total
     applications
    Program versions of
     applications
    Installation Paths       base              base             base
    Amount of pre-          kernel          kernel             kernel
     configuration
                            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.
                                                                  5
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
  repository
                                         User Part
                                      My hack:
                                         This universe.
     Developer Part                   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          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
                                                               8
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
                                                  9
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
                                                               10
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?




                                                                              11
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


                                                                                                      12
Package Specification
Example (1)                                             What you see
                                                        is all you get.
                                                         — Brian Kernighan
Name:           bash
Summary:        Bourne-Again Shell                             Meta informations
Group:          Shell
URL:            http://www.gnu.org/
Vendor:         Free Software Foundation
Packager:       rse@openpkg.org
Distribution:   OpenPKG
License:        GPL                                                 List of sources
Version:        2.05
Release:        0

Source0:        ftp://ftp.gnu.org/gnu/bash/bash-%{version}.tar.gz
Source1:        profile
Patch0:         bash-%{version}.patch.1
Patch1:         bash-%{version}.patch.2

Prefix:
BuildRoot:
                %{l_prefix}
                %{l_buildroot}                                      Dependencies
BuildPreReq:    OpenPKG
PreReq:         OpenPKG
                                                                        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
                                                                    Preparation
%build
    CC="%{l_cc}" \                                                        Building
    CFLAGS="%{l_cflags -O}" \
    ./configure \
        --prefix=%{l_prefix}
    %{l_make} %{l_mflags -O}
                                                                     Installation
%install
    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
%clean
    rm -rf $RPM_BUILD_ROOT                                                                      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

								
To top