cross-platform unix software packagingce ! n

Upload: api-26297749

Post on 30-May-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    1/16

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    2/16

    2

    Part I: Overview

    A brief overview of OpenPKGfrom a users point of view

    A distributed system is one onwhich I cannot get any work done,because a machine I have neverheard of has crashed.

    Leslie Lamport

    A supercomputer isa machine, that runs anendless loop in just 2 seconds.

    Unknown

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    3/16

    3

    The General Problem

    Different flavors ofUnix OperatingSystems in use.

    Very(!) differentsets of vendor

    supplied add-onapplications:Number of total

    applicationsProgram versions of

    applications Installation PathsAmount of pre-

    configuration

    kernel

    base

    Solaris

    kernel

    base

    FreeBSD

    kernel

    base

    Linux

    ??? ??? ???

    Ad

    d-

    on

    App

    lica

    tio

    ns

    user

    There's a lesson to be learned from thisbut I'll be damned if I know what it is.

    Al Bundy

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    4/16

    4

    The OpenPKG SolutionDifferent flavors of

    Unix OperatingSystems in use.

    Vendor suppliedadd-on applicationsare ignored.

    All actually usedadd-on applicationsare provided cross-platform by OpenPKG.

    Engineers now only

    have to manage 1single virtualplatform.

    kernel

    base

    Solaris

    kernel

    base

    FreeBSD

    kernel

    base

    Linux

    OpenPKG

    Ad

    d-

    on

    App

    lica

    tio

    ns

    user

    The software said it requires Solaris 2.6or better, so I installed OpenPKG...

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    5/16

    5

    OpenPKG is...

    a cross-platformpackaging facility foradd-on Unixsoftware.

    based on an

    extended version ofthe popular RedHatPackage Manager(RPM v4).

    a self-contained

    packaging systemwhich is maximumindependent ofunderlying OS.

    currently available for: Sun Solaris Debian GNU/Linux RedHat Linux FreeBSD OpenBSD NetBSD

    Compaq Tru64 (partially) HP-UX (partially)

    very complete, i.e., itcurrently providesalready over 190

    packaged applications.OpenPKG is freelyavailable to anyone asOpen Source.Software is like sex;it's better when it's free.

    Linus Torvalds

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    6/16

    6

    Package Lifecycle

    Writing packagespecificationBuilding application

    from vendor sourcesTemporarily installing

    applicationRolling package from

    installed applicationfiles

    Deinstallingapplication

    Place package intorepository

    Fetching packagefrom repository Installing package Fetching newer

    version of package

    from repositoryUpgrading packageDeinstalling

    package

    Developer Part

    User Part

    My hack:This universe.

    Just one little problem: core keeps dumping.

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    7/16

    7

    OpenPKG Live$ 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.rpmbash ##################################################

    $ /cw/bin/rpm qi bashName: bash Source RPM: bash-2.05-3.src.rpmVersion: 2.05 Packager: [email protected]: 0 Build Host: dev1.de.cw.netGroup: Shell Build System: ix86-freebsd4.4

    Distrib: OpenPKG Build Time: Tue May 1 18:06:25 2001License: GPL Relocations: /cw

    Vendor: Free Software Foundation Install Size: 1065082 bytesURL: http://www.gnu.org/ Install Time: Tue May 1 18:06:35 2001Summary: Bourne-Again ShellDescription:

    Bash (Bourne-Again Shell) is an sh-compatible command language interpreterthat executes commands read from the standard input or from a file. Bashalso incorporates useful features from the Korn and C shells (ksh and csh).Bash is intended to be a conformant implementation of the IEEE POSIX Shelland Tools specification (IEEE Working Group 1003.2).

    $ /cw/bin/bash

    Seek simplicity,but distrust it. A. N. Whitehead

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    8/16

    8

    Why to use OpenPKG? Package is reasonable

    wrapper aroundapplications:unattended and repeatable

    building and installationprocedure

    packager knowledge built-

    in (configure options,additional patches, etc.)

    package abstractsdifferences betweenapplications

    Both source and binary

    packages supported.

    Sophisticated packagemanagement: flexible queries on

    package informationverification of package

    integrity

    Single and uniformfacility for all platforms: cross-platform same filesystem paths reasonable default

    configurations safe upgrading path complete deinstallation

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    9/16

    9

    Part II: Close-Up View

    A close-up view of OpenPKGfrom a developers point of view

    There are two types of peoplein this world, good and bad.

    The good sleep better, but thebad seem to enjoy the wakinghours much more.

    Woody Allen

    Hiroshima '45Czernobyl '86Windows '95

    :

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    10/16

    10

    Package Lifecycle(Developer Part)

    Writing the packagespecificationmeta-informationpackage source files

    package dependenciesdescription textbuild instructions

    Fetching source files Preparationunpacking fixing permissionsapplying patches

    Building configuration compilation

    Installation

    redirection totemporary root

    performing installationadding extra files

    Packagingdetermining file list rolling binary RPM rolling source RPM

    Recursive, adj.;see Recursive.

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    11/16

    11

    Package Lifecycle(User Part)

    (Starting fromscratch) with sourceRPM:Fetching source RPM

    Installation of sourcesDev.-Step: PreparationDev.-Step: BuildingDev.-Step: InstallationDev.-Step: Packaging

    Deinstallation ofsources ...

    (Continuing)with binary RPM:Fetching binary RPM Installation of binary

    Upgrading of binaryDeinstallation of binary

    If a trainstation is where trainsstop, what is a workstation?

    Patient: Doctor, it hurts when I do this!Doctor: Well, then don't do it.

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    12/16

    12

    Package Components Package Specification

    (RPM .spec-file) central packaging

    information

    Vendor source(s)

    distribution filesoptionally patches

    Extra filespackager or third-party

    patches run-command scriptsdefault configuration

    file(s) ...

    -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:33bash.spec-rw-rw-r-- 1 rse openpkg 1342 Feb 7 16:34 profile

    UNIX is simple.It just takes a genius tounderstand its simplicity.

    Dennis Ritchie

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    13/16

    13

    Name: bash

    Summary: Bourne-Again ShellGroup: Shell

    URL: http://www.gnu.org/Vendor: Free Software Foundation

    Packager: [email protected]: OpenPKGLicense: GPLVersion: 2.05Release: 0

    Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{version}.tar.gzSource1: profilePatch0: bash-%{version}.patch.1Patch1: bash-%{version}.patch.2

    Prefix: %{l_prefix}BuildRoot: %{l_buildroot}BuildPreReq: OpenPKGPreReq: OpenPKG

    %descriptionBash (Bourne-Again Shell) is an sh-compatible command language interpreterthat 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 SpecificationExample (1)

    Meta informations

    List of sources

    Dependencies

    Description

    What you seeis all you get. Brian Kernighan

    P k S ifi i

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    14/16

    14

    Package SpecificationExample (2)%prep

    %setup -q%patch0 -p0%patch1 -p0

    %buildCC="%{l_cc}" \CFLAGS="%{l_cflags -O}" \./configure \

    --prefix=%{l_prefix}%{l_make} %{l_mflags -O}

    %installrm -rf $RPM_BUILD_ROOT%{l_make} %{l_mflags} installprefix=$RPM_BUILD_ROOT%{l_prefix}rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dirstrip $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

    %cleanrm -rf $RPM_BUILD_ROOT

    Preparation

    Building

    Installation

    Packaging

    Beware of bugs inthe above code;I have only proved itcorrect, not tried it.

    D.E. Knuth

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    15/16

    15

    Package Building

    Murphy's Law is recursive:Washing your car to makeit rain doesn't work.

  • 8/14/2019 Cross-Platform Unix Software Packagingce ! n

    16/16

    16

    More about OpenPKGThe Website:

    http://www.openpkg.org/

    The FTP Server:ftp://ftp.openpkg.org/

    The RSYNC Server:rsync://rsync.openpkg.org/

    The Anonymous-CVS Server::pserver:[email protected]:/cvs

    The Support Mailing List:[email protected] I have made this longer than usualbecause I lack the time to make it

    shorter. Blaise Pascal