SlideShare a Scribd company logo
1 of 47
Download to read offline
Configure, Pack, Distribute
An RPM Creation Workshop




Bart Whiteley              Matthias G. Eckermann
Senior Software Engineer   Senior Product Manager
Novell, Inc.               SUSE Linux Enterprise
                                ®



bwhiteley@novell.com       mge@novell.com
Agenda

       Part I: Challenges of software management
       Part II: Introduction into RPM
         –   Overview of RPM build process
         –   The RPM “Spec” file
         –   Dependencies
         –   Building RPMs

       Part III: Hands-on
         –   Building from source locally
         –   Building in a change-root environment using the “build” tool
         –   Building from a binary package
         –   Building in the BuildService
2   © Novell, Inc. All rights reserved.
Part I:
Challenges of Software Management
Challenges of Software Management




                                          ?
4   © Novell, Inc. All rights reserved.
Requirements to a Sophisticated
    Software Management System
    •   Systems management and consistency
         –   Easy to install and uninstall
         –   Easy to determine what is installed, and where
         –   Leverage package management tools
              >   ZENworks Linux Management
                                     ®




    •   Dependency management
    •   Life-cycle management
         –   Easy to create packages
              >   Leverage openSUSE Build Service
                                          ®




         –   Easy to update and upgrade
    •   Security and reliability
         –   Easy to verify the installation

5   © Novell, Inc. All rights reserved.
Applications

    •   Executable (binary),
        libraries, data files, icons,
                                                Executable
        mime types
    •   Documentation – normally
        included, might be removed        Libraries      Data
        during installation due to
        space constraints
                                              Configuration
    •   Configuration – normally
        created after installation,
                                              Documentation
        can be pre-configured or
        defaults are pre-installed


6   © Novell, Inc. All rights reserved.
Applications and Metadata

    •   Application
    •   Meta-data
         –   Support for installation and management
         –   Description, version, requirements and dependencies –
             what needs to be installed on the system to be able to run
             the application or its parts
    •   Install, upgrade and remove process
         –   Using system provided software management stack
         –   No interaction needed (useful for auto-installation, appliances)
         –   Clean remove – no leftovers, configuration files optionally

7   © Novell, Inc. All rights reserved.
High Level Package Overview

                                                                            Package

         Meta-data                        Application

                   Version
                                                        Executable
               Description
                                               Libraries             Data
            Requirements
                                                    Configuration


                                                    Documentation



8   © Novell, Inc. All rights reserved.
Build Overview - Theory


                                                   Installable
              Metadata                            Source File
                                                 Software Packs
                                                   Source File


          Application
          Source File
          Source File                     Tool



       Local changes                                Archive
                   Patch
                   Patch



9   © Novell, Inc. All rights reserved.
Part II:
Introduction into RPM
Build Overview – RPM


             SPEC File                                   Binary RPM
                                                         Source File
                                                         Source File


           SourceFile
           Source
           SourceFile
                   File                    rpmbuild-ba



                  Patch                                  Source RPM
                    Patch
                    Patch



11   © Novell, Inc. All rights reserved.
What Is it RPM?

     •   RPM Package Manager
          –   Program to manipulate with packages (rpm files)
     •   Package file format specification
          –   Files are named like: make-3.81-2.i586.rpm
          –   [name]-[version]-[subversion].[architecture].rpm or just file.rpm


     •   Library to manipulate (install, remove) rpm packages
     •   Baseline of Linux Standard Base (LSB) packaging
     •   The most common format in Enterprise Linux
12   © Novell, Inc. All rights reserved.
RPM Philosophy

     •   Standard, uniform and clean way to build, install, remove,
         update and manage software
     •   Multi-architecture support
     •   Non-interactive install process, easy to automate
     •   Security – packages can be cryptographically signed
     •   Reliability – package does not affect contents of other packages
     •   Dependencies – package can be installed only if requirements
         are already installed
     •   Verification – all files included in a package can be verified for
         permissions or contents modification
     •   Building software
          –   reproducible
          –   unattended

13   © Novell, Inc. All rights reserved.
Inputs and Outputs

     •   Inputs
          –   Spec file
               >   Directs RPM in the build process
          –   Source files
               >   May be source archives (e.g. tarball or .zip) or single files
          –   Patches
               >   Patches to the pristine source archive, usually created with 'diff -u'

     •   Outputs
          –   One or more binary RPMS
          –   Source RPM
               >   An archive of the inputs


14   © Novell, Inc. All rights reserved.
The Spec File

     •   The preamble section

     •   The prep section

     •   The build section

     •   The install section

     •   Install and uninstall scripts

     •   The clean section

     •   File list

15   © Novell, Inc. All rights reserved.
Preamble

     •   Required tags                     •   Optional tags
          –   Name                             –   Source
                                               –   Patch
          –   Version
                                               –   Url
          –   Release                          –   Requires
          –   Summary                          –   Provides
          –   License                          –   Conflicts
                                               –   Obsoletes
          –   Group
                                               –   PreReq
          –   %description
                                               –   BuildArch
          –   BuildRoot                        –   Serial
                                               –   BuildRequires
16   © Novell, Inc. All rights reserved.
Preamble Example

      #
      # Example spec file for cdplayer app...
      #
      Summary: A CD player app that rocks!
      Name: cdplayer
      Version: 1.0
      Release: 1
      License: GPL
      Group: Applications/Sound
      Source: ftp://ftp.gnomovision.com/pub/cdplayer/cdplayer-1.0.tgz
      URL: http://www.gnomovision.com/cdplayer/cdplayer.html
      Distribution: WSS Linux
      Vendor: White Socks Software, Inc.
      Packager: Santa Claus <sclaus@northpole.com>

      %description
      It slices! It dices! It's a CD player app that
      can't be beat. By using the resonant frequency
      of the CD itself, it is able to simulate 20X
      oversampling. This leads to sound quality that
      cannot be equaled with more mundane software...

17   © Novell, Inc. All rights reserved.
The % Prep Section

     •   Prepares the build environment
     •   Executed as a bash script
          –   Automatically removes remnants of a previous build
          –   Expand source archive
          –   Apply patches
     •   Macros
          –   %setup
               >   Often all that is needed in %prep

          –   %patch                                      %prep
               >   Apply a patch to the sources           %setup
18   © Novell, Inc. All rights reserved.
The % Build Section

     •   Compile the software

     •   Executed as a bash script


         %build

         ./configure

         make




19   © Novell, Inc. All rights reserved.
The % Install Section

     •   Executed as a bash script
     •   Runs during the package build
     •   Does not run during package installation
     •   Install the software into a staging area
          –   $RPM_BUILD_ROOT


      %install
      %{__rm} -rf $RPM_BUILD_ROOT
      %{__mkdir} $RPM_BUILD_ROOT
      make DESTDIR=$RPM_BUILD_ROOT install

20   © Novell, Inc. All rights reserved.
The % Clean Section

     •   This section is optional


     •   Can be used to clean up files that are not part of
         the application's normal build area


     •   Executed as a bash script




21   © Novell, Inc. All rights reserved.
The % Files Section

     •   Lists the files that are part of the package
     •   Declare file ownership and permissions
     •   Special handling for configuration files
          –   %config
          –   %config(noreplace)

      %files
      %defattr(-,root,root)
      %config(noreplace) /etc/foo.conf
      /usr/bin/*
      /usr/lib/*
22   © Novell, Inc. All rights reserved.
Install/Uninstall Scripts

     •   %pre
          –   Executed prior to package installation
     •   %post
          –   Executed after package installation
     •   %preun
          –   Executed prior to package deletion
     •   %postun
          –   Executed after package deletion
     •   Best to do as much as possible in build scripts,
         and as little as possible in install/uninstall scripts
23   © Novell, Inc. All rights reserved.
Scripts During Upgrade

     •   Scripts can complicate upgrades
          –   %preun and %postun scripts also run during upgrade
          –   The order of execution is not intuitive
               >   Run %pre of new package
               >   Install new files
               >   Run %post of new package
               >   Run %preun of old package
               >   Delete any old files not overwritten by newer ones
               >   Run %postun of old package
          –   Important to get scripts right the first time
               >   If you release a package with a bad %preun or %postun script,
                   you can't fix it with an update



24   © Novell, Inc. All rights reserved.
Distinguishing Upgrade from Delete

     •   The first parameter passed to RPM scripts is the
         number of copies of the package that will be installed
         after the current package is installed or deleted
          –   In %preun and %postun, if $1 is 0, the package is
              being deleted
          –   In %preun and %postun, if $1 is > 0, the package is
              being upgraded

     %postun
     if [ $1 -gt 0 ]; then
        # package being upgraded
     else
        # package being deleted; cleanup
     fi
25   © Novell, Inc. All rights reserved.
Dependencies

     •   If anything listed in             •   Manual dependencies
         % files is a shared                   can be declared with
         library, its soname                   Preamble tags
         is added to the
         capabilities of                       –   Requires
         the package
                                               –   Provides
     •   For all executables
         and shared libraries                  –   Obsoletes
         in %files, ldd is
                                               –   Conflicts
         used to determine
         the package                           –   PreReq
         requirements

26   © Novell, Inc. All rights reserved.
RPMbuild

     RPMbuild

     -bp               execute %prep

     -bc               execute %prep, %build

     -bi               execute %prep, %build, %install

     -bb               execute %prep, %build, %install (bin)

     -ba               execute %prep, %build, %install (bin, src)



27   © Novell, Inc. All rights reserved.
Build Environment

     •   The RPM build directory structure
          –   /usr/src/packages/SOURCES                        %{_sourcedir}
               >   Contains source files and patches
          –   /usr/src/packages/SPECS                      %{_specdir}
               >   Contains Spec files
          –   /usr/src/packages/BUILD                      %{_builddir}
               >   Sources are unpacked and patched here
               >   Compile takes place here
          –   /usr/src/packages/RPMS/<arch>                    %{_rpmdir}
               >   Binary RPMs end up here
          –   /usr/src/packages/SRPMS                      %{_srcrpmdir}
               >   Source RPMs end up here

28   © Novell, Inc. All rights reserved.
Customized Build Environment

     •   To build as a non-root user (good idea), define
         different paths for the build environment.
          –   In ~/.rpmmacros

     $ cat ~/.rpmmacros
     %_topdir /home/jdoe/packages

          –   On the command line

     $ cat ~/bin/myrpmbuild
     #!/bin/sh
     TOPDIR=${PWD}/rpmbuild
     mkdir -p ${TOPDIR}/{RPMS,SRPMS,SPECS,SOURCES,BUILD,tmp}
     rpmbuild --define "_topdir ${TOPDIR}" 
         --define "_sourcedir ${PWD}" 
         --define "_tmppath ${TOPDIR}/tmp" "$@"

29   © Novell, Inc. All rights reserved.
Benefits of Using a Standard
     Package Format – Such as RPM
     •   Software development more manageable

     •   Multi architecture support easier

     •   Software installation more secure

     •   Software deployment manageable

     •   Handling multiple version easy

     •   Consistent systems and compliance
30   © Novell, Inc. All rights reserved.
Part III:
Hands-on
Building from Source Locally (1)
     Source Code
     //
     / / Copyr i ght ( c) 2010 SUSE Li nux Pr oduct s GmbH                  w com but t on. set Geom r y( 32, 32, 448, 192) ;
                                                                              el     e_                    et
     / / Aut hor : M t hi as G. Ecker m
                     at                 ann < ge@
                                              m novel l . com>              QObj ect : : connect (
     / / Li cense: GPL v2                                                            &w com but t on,
                                                                                        el     e_
     //                                                                              SI GNAL( cl i cked( ) ) ,
                                                                                     &hel l o_ br ai nshar e,
     #i   ncl   ude   <QAppl i cat i on>                                             SLOT( qui t ( ) )
     #i   ncl   ude   <QFont >                                              );
     #i   ncl   ude   <QPushBut t on>                                       m n_w ndow show ) ;
                                                                              ai     i      .      (
     #i   ncl   ude   < i dget >
                       QW                                                   r et ur n hel l o_ br ai nshar e. exec( ) ;

     i nt m n( i nt ar gc, char *ar gv[ ] ) {
           ai                                                           }
            QAppl i cat i on hel l o_ br ai nshar e( ar gc, ar gv ) ;
            QW dget m n_w ndow
               i        ai       i       ;
            m n_ w ndow r esi ze( 512, 256 ) ;
              ai    i      .
            QPushBut t on w comel      e_but t on(
                    " W com t o Br ai nshar e 2010! 
                       el      e
                     nNovel l - M     aki ng I T W k as One. " ,
                                                   or
                    &m n_ w ndow
                       ai      i
            );
            w com but t on. set Font (
              el    e_
                    QFont (
                             " Ar i al " ,
                             16,
                             QFont : : Bol d
                             )
            );




32   © Novell, Inc. All rights reserved.
1. Building from Source Locally (2)
     .spec file
     #
     Nam e:                 hel l o_br ai nshar e                    % nst al l
                                                                       i
     Li cense:              GPL v2                                   i f [ - n " $RPM   _BUI LD_ROOT" ] ; t hen
     Ver si on:             1                                                 [ " $RPM  _BUI LD_ROOT" ! = " / " ] &&
     Rel ease:              1. m ge                                           r m - r f $RPM BUI LD_ROOT &&
                                                                                             _
     Sum ar y:
         m                  Hel l o Br ai nshar e 2010                        m r $RPM
                                                                                kdi        _BUI LD_ROOT
     Sour ce0:              hel l o_br ai nshar e. cpp               fi
     Gr oup:                Pr oduct i vi t y                        m r -p
                                                                       kdi                                        
     Bui l dRoot :          % m
                              {_t ppat h}/ %  {nam bui l d
                                                   e}-                        $RPM  _BUI LD_ROOT/ usr / bi n
     Bui l dRequi r es:     l i bqt 4- devel                         i nst al l hel l o_br ai nshar e             
                                                                              $RPM  _BUI LD_ROOT/ usr / bi n/
     %descr i pt i on
     Hel l o Br ai nshar e 2010 pr ogr am f or demonst r at i on     % i l es
                                                                       f
     pur poses.                                                      % at t r ( - , r oot , r oot )
                                                                       def
                                                                     / usr / bi n/ hel l o_br ai nshar e
     % ep
      pr
     % up - c - T
      set                                                            % ean
                                                                       cl
     cp - a % 0} .
             {S:                                                     i f [ - n " $RPM  _BUI LD_ROOT" ] ; t hen
                                                                             [ " $RPM  _BUI LD_ROOT" ! = " / " ] &&
     % ld
      bui                                                                    r m - r f $RPM BUI LD_ROOT
                                                                                            _
     g++  - I / usr / i ncl ude/ Qt Gui - l Qt Cor e - l Qt Gui     fi
          $RPM OPT_ FLAGS
                 _                                              
          - s - o hel l o_br ai nshar e hel l o_br ai nshar e. cpp   %changel og
                                                                     * M on M   ar 08 2010 - m novel l . com
                                                                                              ge@
                                                                     - i ni t i al ver si on




33   © Novell, Inc. All rights reserved.
Challenges and Risks
     When Building from Source Locally

     •   Software-build might interfere with the buildhost
          –   Security and Consistency:
              Risk of polluting the host with freshly built software
          –   Resource Constraints:
              a build process might need lots of disk space, memory,
              compute power
     •   Software-build might depend on special settings
         of the local build-host
          –   violates goal of reproducible software builds
     •   Multi-User and Multi-Architecture goal not easy
         to implement – even building 32bit on 64bit
         hosts is not always easy
34   © Novell, Inc. All rights reserved.
Alternatives
     to Building from Source Locally

     •   Change root environment
          –   Create a build system within the host system; same kernel,
              but userland is separated
          –   Mitigates: security, consistency, reproducible
          –   Controls: Multi-architecture requirements.
          –   Does not mitigate: Resource constraints
          –   Technology used by the “build” tool, see #2 below
     •   Virtualization
          –   Create a build system within the host system;
              completely separated
          –   Mitigates: security, consistency, reproducible
          –   Controls: Resource constraints, Multi-architecture requirements
          –   See #4 below: openSUSE Buildservice
                                           ®




35   © Novell, Inc. All rights reserved.
2. Building in a Change-root
     Environment Using the “Build” Tool (1)
     •   “build” is available on the SUSE Linux Enterprise 11
                                           ®



         Software Development Kit and on openSUSE      ®




     •   Build installs a minimal SUSE Linux as build system
         into some directory and will chroot to this system to
         compile the package.

     •   Special .spec file options to support build

     # norootforbuild

     # needsrootforbuild

36   © Novell, Inc. All rights reserved.
Building in a Change-root
     Environment Using the “Build” Tool (2)

     Functionality overview
     build                      [--clean|--no-init]        
                                [--no-checks]              
                                [--repository PATH]        
                                [--rpms path1:path2:...]   
                                [--arch arch1:arch2:...]   
                                [--root buildroot]         
                                [specfile|srcrpm]
     build --verify
     •   Environment variables
         BUILD_RPMS
         BUILD_ROOT
         BUILD_RPM_BUILD_STAGE

37   © Novell, Inc. All rights reserved.
3. Building from a Binary Package (1)

     •   Differences
          –   No compile stage necessary
          –   Can be used for nearly any type of existing software
     •   Challenges
          –   Binary packages might need an “installer” to run
          –   system specific configuration
          –   Installation paths not following the Linux Filesystem
              Hierarchy Standard (FHS)
     •   Caveats
          –   Legal aspects
          –   Licensing

38   © Novell, Inc. All rights reserved.
Building from a Binary Package (2)
     Binary Package

     Example: Mendeley Desktop (freeware, non-opensoure)
     • prepackaged tar, no rpm

     • Directories:

     mendeleydesktop-0.9.6.1-linux-x86_64/bin
     mendeleydesktop-0.9.6.1-linux-x86_64/lib
     mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop
     mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop/libexec
     mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop/plugins
     mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop/plugins/sqldrivers
     mendeleydesktop-0.9.6.1-linux-x86_64/share
     mendeleydesktop-0.9.6.1-linux-x86_64/share/applications
     mendeleydesktop-0.9.6.1-linux-x86_64/share/doc
     mendeleydesktop-0.9.6.1-linux-x86_64/share/doc/mendeleydesktop
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/128x128
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/128x128/apps
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/16x16
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/16x16/apps
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/22x22
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/22x22/apps
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/32x32
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/32x32/apps
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/48x48
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/48x48/apps
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/64x64
     mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/64x64/apps
     mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop
     mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/citationStyles
     mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/citationStyles/default
     mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/generated-svm-models
     mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/openOfficePlugin
     mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/word-lists

     Goal: install to /opt/mendeleydesktop
39   © Novell, Inc. All rights reserved.
Building from a Binary Package (3)
     .spec file
     Nam e:              mendel eydeskt op                          % nst al l
                                                                      i
     Li cense:           Com er ci al ( M
                             m           endel ey Lt d. )           i f [ - n " $RPM BUI LD_ ROOT" ] ; t hen
                                                                                      _
     Ver si on:          0. 9. 6. 1                                         [ " $RPM BUI LD_ ROOT" ! = " / " ] &&
                                                                                      _
     Rel ease:           1. mge                                             r m - r f $RPM BUI LD_ ROOT &&
                                                                                           _
     Sum ar y:
         m               Mendel ey i s a f r ee r esear ch                  m r $RPM
                                                                              kdi        _BUI LD_ ROOT
     managem   ent t ool                                            fi
     Bui l dAr ch: x86_ 64                                          m r -p
                                                                      kdi            $RPM BUI LD_ ROOT/ opt
                                                                                         _

     % i ne _f nam %
      def         e {nam %
                        e}- {ver si on}- l i nux- %{bui l dar ch}   t ar - C $RPM BUI LD_ ROOT/ opt - xsj pf % 0}
                                                                                 _                            {S:

     Sour ce0:           % f nam t ar . bz2
                           {_      e}.                              mv      $RPM_BUI LD_ROOT/ opt / % nam 
                                                                                                     {_f   e}
     Gr oup:             Pr oduct i vi t y                                  $RPM_BUI LD_ROOT/ opt / %{name}
     URL:          ht t p: / / w w m
                                w . endel ey. com dow oad-
                                                 /   nl
     mendel ey- deskt op/                                           % i l es
                                                                      f
     Bui l dRoot :       % tm
                           {_ ppat h}/ %   {nam bui l d
                                               e}-                  % at t r ( - , r oot , r oot )
                                                                      def
                                                                    / opt / %{name}
     %descr i pt i on
     Mendel ey i s a f r ee r esear ch management t ool f or        % ean
                                                                      cl
     deskt op & w   eb                                              i f [ - n " $RPM BUI LD_ ROOT" ] ; t hen
                                                                                      _
                                                                            [ " $RPM BUI LD_ ROOT" ! = " / " ] &&
                                                                                      _
     % ep
      pr                                                                    r m - r f $RPM BUI LD_ ROOT
                                                                                          _
     % up - c - T
      set                                                           fi

     % ld
      bui                                                           %changel og
                                                                    * M on M   ar 08 2010 - m novel l . com
                                                                                             ge@
                                                                    - i ni t i al ver si on




40   © Novell, Inc. All rights reserved.
4. Building in the Buildservice

     •   Open and complete distribution development platform
     •   Create RPMs for multiple distributions and architectures
     •   Create online package repositories
     •   openSUSE Build Service is open source
                                      ®




          –   Deploy your own internal build service
     •   User Interfaces
          –   Webinterface http://build.opensuse.org/
          –   Commandline interface: “osc”
          –   Fat-clients
          –   Integration into other tool-chains (qt-creator, kde4)


41   © Novell, Inc. All rights reserved.
Building in the Buildservice (2)

     •   “osc” command line interface
     •   Very similar to “cvs” and “svn” command line tools:
         familiar for developers
     •   Overview
          –   Checking
          –   Commit
          –   Add
          –   importsrcpkg
          –   Build
          –   Rebuild
42   © Novell, Inc. All rights reserved.
Next Steps


                                           Learn more at:
                                           Brainshare Session
                                                    ®



                                           BOF 102

                               en.opensuse.org/Build_Service
                               build.opensuse.org




                Go, and build                              Join the openSUSE  ®



               your packages!                              Buildservice online!

43   © Novell, Inc. All rights reserved.
Appendix
References

     http://rpm.org/max-rpm/

     http://docs.fedoraproject.org/drafts/rpm-guide-en/

     http://en.opensuse.org/SUSE_Build_Tutorial

     http://en.opensuse.org/Packaging/SUSE_Package_Conventions

     SUSE software management stack:
                     ®




     http://en.opensuse.org/Libzypp
     http://www-128.ibm.com/developerworks/linux/library/l-rpm3.html

     http://www.ibm.com/developerworks/library/l-rpm1/

45   © Novell, Inc. All rights reserved.
Unpublished Work of Novell, Inc. All Rights Reserved.
This work is an unpublished work and contains confidential, proprietary, and trade secret information of Novell, Inc.
Access to this work is restricted to Novell employees who have a need to know to perform tasks within the scope
of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified,
translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of Novell, Inc.
Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability.


General Disclaimer
This document is not to be construed as a promise by any participating company to develop, deliver, or market a
product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in
making purchasing decisions. Novell, Inc. makes no representations or warranties with respect to the contents
of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any
particular purpose. The development, release, and timing of features or functionality described for Novell products
remains at the sole discretion of Novell. Further, Novell, Inc. reserves the right to revise this document and to
make changes to its content, at any time, without obligation to notify any person or entity of such revisions or
changes. All Novell marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc.
in the United States and other countries. All third-party trademarks are the property of their respective owners.

More Related Content

What's hot

9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linuxchinkshady
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库maclean liu
 
Cobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioningCobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioningRUDDER
 
RHCE FINAL Questions and Answers
RHCE FINAL Questions and AnswersRHCE FINAL Questions and Answers
RHCE FINAL Questions and AnswersRadien software
 
Embedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformEmbedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformSZ Lin
 
Snort296x centos6x 2
Snort296x centos6x 2Snort296x centos6x 2
Snort296x centos6x 2Trinh Tuan
 
OSDC 2014: Nat Morris - Open Network Install Environment
OSDC 2014: Nat Morris - Open Network Install EnvironmentOSDC 2014: Nat Morris - Open Network Install Environment
OSDC 2014: Nat Morris - Open Network Install EnvironmentNETWAYS
 
3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfvvideos
 
J Ruby On Rails Presentation
J Ruby On Rails PresentationJ Ruby On Rails Presentation
J Ruby On Rails Presentationrailsconf
 
RHCE (RED HAT CERTIFIED ENGINEERING)
RHCE (RED HAT CERTIFIED ENGINEERING)RHCE (RED HAT CERTIFIED ENGINEERING)
RHCE (RED HAT CERTIFIED ENGINEERING)Sumant Garg
 
Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77chhorn
 
Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294IkiArif1
 
Ahmad-debian
Ahmad-debianAhmad-debian
Ahmad-debiansyaif-sae
 
The Switch as a Server - PuppetConf 2014
The Switch as a Server - PuppetConf 2014The Switch as a Server - PuppetConf 2014
The Switch as a Server - PuppetConf 2014Puppet
 
Redhat 6 & 7
Redhat 6 & 7Redhat 6 & 7
Redhat 6 & 7r9social
 

What's hot (20)

9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux
 
Yum (Linux)
Yum (Linux) Yum (Linux)
Yum (Linux)
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
 
RHCE Training
RHCE TrainingRHCE Training
RHCE Training
 
Cobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioningCobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioning
 
Rac on NFS
Rac on NFSRac on NFS
Rac on NFS
 
RHCE FINAL Questions and Answers
RHCE FINAL Questions and AnswersRHCE FINAL Questions and Answers
RHCE FINAL Questions and Answers
 
Embedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformEmbedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 Platform
 
NIH package manager for pkgsrc
NIH package manager for pkgsrcNIH package manager for pkgsrc
NIH package manager for pkgsrc
 
Snort296x centos6x 2
Snort296x centos6x 2Snort296x centos6x 2
Snort296x centos6x 2
 
OSDC 2014: Nat Morris - Open Network Install Environment
OSDC 2014: Nat Morris - Open Network Install EnvironmentOSDC 2014: Nat Morris - Open Network Install Environment
OSDC 2014: Nat Morris - Open Network Install Environment
 
3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfv
 
J Ruby On Rails Presentation
J Ruby On Rails PresentationJ Ruby On Rails Presentation
J Ruby On Rails Presentation
 
RHCE (RED HAT CERTIFIED ENGINEERING)
RHCE (RED HAT CERTIFIED ENGINEERING)RHCE (RED HAT CERTIFIED ENGINEERING)
RHCE (RED HAT CERTIFIED ENGINEERING)
 
Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294
 
Ahmad-debian
Ahmad-debianAhmad-debian
Ahmad-debian
 
The Switch as a Server - PuppetConf 2014
The Switch as a Server - PuppetConf 2014The Switch as a Server - PuppetConf 2014
The Switch as a Server - PuppetConf 2014
 
Redhat 6 & 7
Redhat 6 & 7Redhat 6 & 7
Redhat 6 & 7
 

Similar to Configure, Pack and Distribute: An RPM Creation Workshop

Linux Disaster Recovery Made Easy
Linux Disaster Recovery Made EasyLinux Disaster Recovery Made Easy
Linux Disaster Recovery Made EasyNovell
 
Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...
Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...
Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...Novell
 
BrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made Easy
BrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made EasyBrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made Easy
BrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made EasySchlomo Schapiro
 
Rapid Deployment of Novell ZENworks Configuration Management
Rapid Deployment of Novell ZENworks Configuration ManagementRapid Deployment of Novell ZENworks Configuration Management
Rapid Deployment of Novell ZENworks Configuration ManagementNovell
 
Diagnostics of a Linux System
Diagnostics of a Linux SystemDiagnostics of a Linux System
Diagnostics of a Linux SystemNovell
 
Best Practices for IT Asset Management Using Novell ZENworks
Best Practices for IT Asset Management Using Novell ZENworksBest Practices for IT Asset Management Using Novell ZENworks
Best Practices for IT Asset Management Using Novell ZENworksNovell
 
Novell ZENworks Patch Management Best Practices
Novell ZENworks Patch Management Best PracticesNovell ZENworks Patch Management Best Practices
Novell ZENworks Patch Management Best PracticesNovell
 
Securing Your Linux System
Securing Your Linux SystemSecuring Your Linux System
Securing Your Linux SystemNovell
 
Introduction to Novell ZENworks Configuration Management Troubleshooting
Introduction to Novell ZENworks Configuration Management TroubleshootingIntroduction to Novell ZENworks Configuration Management Troubleshooting
Introduction to Novell ZENworks Configuration Management TroubleshootingNovell
 
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...The Linux Foundation
 
Migrate from Red Hat to SUSE Linux Enterprise Server
Migrate from Red Hat to SUSE Linux Enterprise ServerMigrate from Red Hat to SUSE Linux Enterprise Server
Migrate from Red Hat to SUSE Linux Enterprise ServerNovell
 
Automatize everything
Automatize everythingAutomatize everything
Automatize everythingBoris Bucha
 
Multi-OS Continuous Packaging with docker and Project-Builder.org
Multi-OS Continuous Packaging with docker and Project-Builder.orgMulti-OS Continuous Packaging with docker and Project-Builder.org
Multi-OS Continuous Packaging with docker and Project-Builder.orgBruno Cornec
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsExtending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsPetr Jiricka
 
Lessons Learned: Novell Open Enterprise Server Upgrades Made Easy
Lessons Learned: Novell Open Enterprise Server Upgrades Made EasyLessons Learned: Novell Open Enterprise Server Upgrades Made Easy
Lessons Learned: Novell Open Enterprise Server Upgrades Made EasyNovell
 
Run Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateRun Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateNovell
 
Run Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateRun Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateNovell
 
Run Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateRun Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateNovell
 

Similar to Configure, Pack and Distribute: An RPM Creation Workshop (20)

Linux Disaster Recovery Made Easy
Linux Disaster Recovery Made EasyLinux Disaster Recovery Made Easy
Linux Disaster Recovery Made Easy
 
Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...
Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...
Application Repackaging Best Practices for Novell ZENworks 10 Configuration M...
 
BrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made Easy
BrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made EasyBrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made Easy
BrainShare 2010 SLC - ELS306 Linux Disaster Recovery Made Easy
 
Rapid Deployment of Novell ZENworks Configuration Management
Rapid Deployment of Novell ZENworks Configuration ManagementRapid Deployment of Novell ZENworks Configuration Management
Rapid Deployment of Novell ZENworks Configuration Management
 
Diagnostics of a Linux System
Diagnostics of a Linux SystemDiagnostics of a Linux System
Diagnostics of a Linux System
 
Best Practices for IT Asset Management Using Novell ZENworks
Best Practices for IT Asset Management Using Novell ZENworksBest Practices for IT Asset Management Using Novell ZENworks
Best Practices for IT Asset Management Using Novell ZENworks
 
Novell ZENworks Patch Management Best Practices
Novell ZENworks Patch Management Best PracticesNovell ZENworks Patch Management Best Practices
Novell ZENworks Patch Management Best Practices
 
Securing Your Linux System
Securing Your Linux SystemSecuring Your Linux System
Securing Your Linux System
 
What's New in RHEL 6 for Linux on System z?
What's New in RHEL 6 for Linux on System z?What's New in RHEL 6 for Linux on System z?
What's New in RHEL 6 for Linux on System z?
 
Introduction to Novell ZENworks Configuration Management Troubleshooting
Introduction to Novell ZENworks Configuration Management TroubleshootingIntroduction to Novell ZENworks Configuration Management Troubleshooting
Introduction to Novell ZENworks Configuration Management Troubleshooting
 
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
 
Migrate from Red Hat to SUSE Linux Enterprise Server
Migrate from Red Hat to SUSE Linux Enterprise ServerMigrate from Red Hat to SUSE Linux Enterprise Server
Migrate from Red Hat to SUSE Linux Enterprise Server
 
Automatize everything
Automatize everythingAutomatize everything
Automatize everything
 
Siebel server cloning
Siebel server cloningSiebel server cloning
Siebel server cloning
 
Multi-OS Continuous Packaging with docker and Project-Builder.org
Multi-OS Continuous Packaging with docker and Project-Builder.orgMulti-OS Continuous Packaging with docker and Project-Builder.org
Multi-OS Continuous Packaging with docker and Project-Builder.org
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsExtending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.js
 
Lessons Learned: Novell Open Enterprise Server Upgrades Made Easy
Lessons Learned: Novell Open Enterprise Server Upgrades Made EasyLessons Learned: Novell Open Enterprise Server Upgrades Made Easy
Lessons Learned: Novell Open Enterprise Server Upgrades Made Easy
 
Run Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateRun Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin Orchestrate
 
Run Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateRun Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin Orchestrate
 
Run Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin OrchestrateRun Book Automation with PlateSpin Orchestrate
Run Book Automation with PlateSpin Orchestrate
 

More from Novell

Filr white paper
Filr white paperFilr white paper
Filr white paperNovell
 
Social media class 4 v2
Social media class 4 v2Social media class 4 v2
Social media class 4 v2Novell
 
Social media class 3
Social media class 3Social media class 3
Social media class 3Novell
 
Social media class 2
Social media class 2Social media class 2
Social media class 2Novell
 
Social media class 1
Social media class 1Social media class 1
Social media class 1Novell
 
Social media class 2 v2
Social media class 2 v2Social media class 2 v2
Social media class 2 v2Novell
 
LinkedIn training presentation
LinkedIn training presentationLinkedIn training presentation
LinkedIn training presentationNovell
 
Twitter training presentation
Twitter training presentationTwitter training presentation
Twitter training presentationNovell
 
Getting started with social media
Getting started with social mediaGetting started with social media
Getting started with social mediaNovell
 
Strategies for sharing and commenting in social media
Strategies for sharing and commenting in social mediaStrategies for sharing and commenting in social media
Strategies for sharing and commenting in social mediaNovell
 
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECH
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECHInformation Security & Compliance in Healthcare: Beyond HIPAA and HITECH
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECHNovell
 
Workload iq final
Workload iq   finalWorkload iq   final
Workload iq finalNovell
 
The Identity-infused Enterprise
The Identity-infused EnterpriseThe Identity-infused Enterprise
The Identity-infused EnterpriseNovell
 
Shining the Enterprise Light on Shades of Social
Shining the Enterprise Light on Shades of SocialShining the Enterprise Light on Shades of Social
Shining the Enterprise Light on Shades of SocialNovell
 
Accelerate to the Cloud
Accelerate to the CloudAccelerate to the Cloud
Accelerate to the CloudNovell
 
The New Business Value of Today’s Collaboration Trends
The New Business Value of Today’s Collaboration TrendsThe New Business Value of Today’s Collaboration Trends
The New Business Value of Today’s Collaboration TrendsNovell
 
Preventing The Next Data Breach Through Log Management
Preventing The Next Data Breach Through Log ManagementPreventing The Next Data Breach Through Log Management
Preventing The Next Data Breach Through Log ManagementNovell
 
Iaas for a demanding business
Iaas for a demanding businessIaas for a demanding business
Iaas for a demanding businessNovell
 
Workload IQ: A Differentiated Approach
Workload IQ: A Differentiated ApproachWorkload IQ: A Differentiated Approach
Workload IQ: A Differentiated ApproachNovell
 
Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...
Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...
Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...Novell
 

More from Novell (20)

Filr white paper
Filr white paperFilr white paper
Filr white paper
 
Social media class 4 v2
Social media class 4 v2Social media class 4 v2
Social media class 4 v2
 
Social media class 3
Social media class 3Social media class 3
Social media class 3
 
Social media class 2
Social media class 2Social media class 2
Social media class 2
 
Social media class 1
Social media class 1Social media class 1
Social media class 1
 
Social media class 2 v2
Social media class 2 v2Social media class 2 v2
Social media class 2 v2
 
LinkedIn training presentation
LinkedIn training presentationLinkedIn training presentation
LinkedIn training presentation
 
Twitter training presentation
Twitter training presentationTwitter training presentation
Twitter training presentation
 
Getting started with social media
Getting started with social mediaGetting started with social media
Getting started with social media
 
Strategies for sharing and commenting in social media
Strategies for sharing and commenting in social mediaStrategies for sharing and commenting in social media
Strategies for sharing and commenting in social media
 
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECH
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECHInformation Security & Compliance in Healthcare: Beyond HIPAA and HITECH
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECH
 
Workload iq final
Workload iq   finalWorkload iq   final
Workload iq final
 
The Identity-infused Enterprise
The Identity-infused EnterpriseThe Identity-infused Enterprise
The Identity-infused Enterprise
 
Shining the Enterprise Light on Shades of Social
Shining the Enterprise Light on Shades of SocialShining the Enterprise Light on Shades of Social
Shining the Enterprise Light on Shades of Social
 
Accelerate to the Cloud
Accelerate to the CloudAccelerate to the Cloud
Accelerate to the Cloud
 
The New Business Value of Today’s Collaboration Trends
The New Business Value of Today’s Collaboration TrendsThe New Business Value of Today’s Collaboration Trends
The New Business Value of Today’s Collaboration Trends
 
Preventing The Next Data Breach Through Log Management
Preventing The Next Data Breach Through Log ManagementPreventing The Next Data Breach Through Log Management
Preventing The Next Data Breach Through Log Management
 
Iaas for a demanding business
Iaas for a demanding businessIaas for a demanding business
Iaas for a demanding business
 
Workload IQ: A Differentiated Approach
Workload IQ: A Differentiated ApproachWorkload IQ: A Differentiated Approach
Workload IQ: A Differentiated Approach
 
Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...
Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...
Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...
 

Configure, Pack and Distribute: An RPM Creation Workshop

  • 1. Configure, Pack, Distribute An RPM Creation Workshop Bart Whiteley Matthias G. Eckermann Senior Software Engineer Senior Product Manager Novell, Inc. SUSE Linux Enterprise ® bwhiteley@novell.com mge@novell.com
  • 2. Agenda Part I: Challenges of software management Part II: Introduction into RPM – Overview of RPM build process – The RPM “Spec” file – Dependencies – Building RPMs Part III: Hands-on – Building from source locally – Building in a change-root environment using the “build” tool – Building from a binary package – Building in the BuildService 2 © Novell, Inc. All rights reserved.
  • 3. Part I: Challenges of Software Management
  • 4. Challenges of Software Management ? 4 © Novell, Inc. All rights reserved.
  • 5. Requirements to a Sophisticated Software Management System • Systems management and consistency – Easy to install and uninstall – Easy to determine what is installed, and where – Leverage package management tools > ZENworks Linux Management ® • Dependency management • Life-cycle management – Easy to create packages > Leverage openSUSE Build Service ® – Easy to update and upgrade • Security and reliability – Easy to verify the installation 5 © Novell, Inc. All rights reserved.
  • 6. Applications • Executable (binary), libraries, data files, icons, Executable mime types • Documentation – normally included, might be removed Libraries Data during installation due to space constraints Configuration • Configuration – normally created after installation, Documentation can be pre-configured or defaults are pre-installed 6 © Novell, Inc. All rights reserved.
  • 7. Applications and Metadata • Application • Meta-data – Support for installation and management – Description, version, requirements and dependencies – what needs to be installed on the system to be able to run the application or its parts • Install, upgrade and remove process – Using system provided software management stack – No interaction needed (useful for auto-installation, appliances) – Clean remove – no leftovers, configuration files optionally 7 © Novell, Inc. All rights reserved.
  • 8. High Level Package Overview Package Meta-data Application Version Executable Description Libraries Data Requirements Configuration Documentation 8 © Novell, Inc. All rights reserved.
  • 9. Build Overview - Theory Installable Metadata Source File Software Packs Source File Application Source File Source File Tool Local changes Archive Patch Patch 9 © Novell, Inc. All rights reserved.
  • 11. Build Overview – RPM SPEC File Binary RPM Source File Source File SourceFile Source SourceFile File rpmbuild-ba Patch Source RPM Patch Patch 11 © Novell, Inc. All rights reserved.
  • 12. What Is it RPM? • RPM Package Manager – Program to manipulate with packages (rpm files) • Package file format specification – Files are named like: make-3.81-2.i586.rpm – [name]-[version]-[subversion].[architecture].rpm or just file.rpm • Library to manipulate (install, remove) rpm packages • Baseline of Linux Standard Base (LSB) packaging • The most common format in Enterprise Linux 12 © Novell, Inc. All rights reserved.
  • 13. RPM Philosophy • Standard, uniform and clean way to build, install, remove, update and manage software • Multi-architecture support • Non-interactive install process, easy to automate • Security – packages can be cryptographically signed • Reliability – package does not affect contents of other packages • Dependencies – package can be installed only if requirements are already installed • Verification – all files included in a package can be verified for permissions or contents modification • Building software – reproducible – unattended 13 © Novell, Inc. All rights reserved.
  • 14. Inputs and Outputs • Inputs – Spec file > Directs RPM in the build process – Source files > May be source archives (e.g. tarball or .zip) or single files – Patches > Patches to the pristine source archive, usually created with 'diff -u' • Outputs – One or more binary RPMS – Source RPM > An archive of the inputs 14 © Novell, Inc. All rights reserved.
  • 15. The Spec File • The preamble section • The prep section • The build section • The install section • Install and uninstall scripts • The clean section • File list 15 © Novell, Inc. All rights reserved.
  • 16. Preamble • Required tags • Optional tags – Name – Source – Patch – Version – Url – Release – Requires – Summary – Provides – License – Conflicts – Obsoletes – Group – PreReq – %description – BuildArch – BuildRoot – Serial – BuildRequires 16 © Novell, Inc. All rights reserved.
  • 17. Preamble Example # # Example spec file for cdplayer app... # Summary: A CD player app that rocks! Name: cdplayer Version: 1.0 Release: 1 License: GPL Group: Applications/Sound Source: ftp://ftp.gnomovision.com/pub/cdplayer/cdplayer-1.0.tgz URL: http://www.gnomovision.com/cdplayer/cdplayer.html Distribution: WSS Linux Vendor: White Socks Software, Inc. Packager: Santa Claus <sclaus@northpole.com> %description It slices! It dices! It's a CD player app that can't be beat. By using the resonant frequency of the CD itself, it is able to simulate 20X oversampling. This leads to sound quality that cannot be equaled with more mundane software... 17 © Novell, Inc. All rights reserved.
  • 18. The % Prep Section • Prepares the build environment • Executed as a bash script – Automatically removes remnants of a previous build – Expand source archive – Apply patches • Macros – %setup > Often all that is needed in %prep – %patch %prep > Apply a patch to the sources %setup 18 © Novell, Inc. All rights reserved.
  • 19. The % Build Section • Compile the software • Executed as a bash script %build ./configure make 19 © Novell, Inc. All rights reserved.
  • 20. The % Install Section • Executed as a bash script • Runs during the package build • Does not run during package installation • Install the software into a staging area – $RPM_BUILD_ROOT %install %{__rm} -rf $RPM_BUILD_ROOT %{__mkdir} $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install 20 © Novell, Inc. All rights reserved.
  • 21. The % Clean Section • This section is optional • Can be used to clean up files that are not part of the application's normal build area • Executed as a bash script 21 © Novell, Inc. All rights reserved.
  • 22. The % Files Section • Lists the files that are part of the package • Declare file ownership and permissions • Special handling for configuration files – %config – %config(noreplace) %files %defattr(-,root,root) %config(noreplace) /etc/foo.conf /usr/bin/* /usr/lib/* 22 © Novell, Inc. All rights reserved.
  • 23. Install/Uninstall Scripts • %pre – Executed prior to package installation • %post – Executed after package installation • %preun – Executed prior to package deletion • %postun – Executed after package deletion • Best to do as much as possible in build scripts, and as little as possible in install/uninstall scripts 23 © Novell, Inc. All rights reserved.
  • 24. Scripts During Upgrade • Scripts can complicate upgrades – %preun and %postun scripts also run during upgrade – The order of execution is not intuitive > Run %pre of new package > Install new files > Run %post of new package > Run %preun of old package > Delete any old files not overwritten by newer ones > Run %postun of old package – Important to get scripts right the first time > If you release a package with a bad %preun or %postun script, you can't fix it with an update 24 © Novell, Inc. All rights reserved.
  • 25. Distinguishing Upgrade from Delete • The first parameter passed to RPM scripts is the number of copies of the package that will be installed after the current package is installed or deleted – In %preun and %postun, if $1 is 0, the package is being deleted – In %preun and %postun, if $1 is > 0, the package is being upgraded %postun if [ $1 -gt 0 ]; then # package being upgraded else # package being deleted; cleanup fi 25 © Novell, Inc. All rights reserved.
  • 26. Dependencies • If anything listed in • Manual dependencies % files is a shared can be declared with library, its soname Preamble tags is added to the capabilities of – Requires the package – Provides • For all executables and shared libraries – Obsoletes in %files, ldd is – Conflicts used to determine the package – PreReq requirements 26 © Novell, Inc. All rights reserved.
  • 27. RPMbuild RPMbuild -bp execute %prep -bc execute %prep, %build -bi execute %prep, %build, %install -bb execute %prep, %build, %install (bin) -ba execute %prep, %build, %install (bin, src) 27 © Novell, Inc. All rights reserved.
  • 28. Build Environment • The RPM build directory structure – /usr/src/packages/SOURCES %{_sourcedir} > Contains source files and patches – /usr/src/packages/SPECS %{_specdir} > Contains Spec files – /usr/src/packages/BUILD %{_builddir} > Sources are unpacked and patched here > Compile takes place here – /usr/src/packages/RPMS/<arch> %{_rpmdir} > Binary RPMs end up here – /usr/src/packages/SRPMS %{_srcrpmdir} > Source RPMs end up here 28 © Novell, Inc. All rights reserved.
  • 29. Customized Build Environment • To build as a non-root user (good idea), define different paths for the build environment. – In ~/.rpmmacros $ cat ~/.rpmmacros %_topdir /home/jdoe/packages – On the command line $ cat ~/bin/myrpmbuild #!/bin/sh TOPDIR=${PWD}/rpmbuild mkdir -p ${TOPDIR}/{RPMS,SRPMS,SPECS,SOURCES,BUILD,tmp} rpmbuild --define "_topdir ${TOPDIR}" --define "_sourcedir ${PWD}" --define "_tmppath ${TOPDIR}/tmp" "$@" 29 © Novell, Inc. All rights reserved.
  • 30. Benefits of Using a Standard Package Format – Such as RPM • Software development more manageable • Multi architecture support easier • Software installation more secure • Software deployment manageable • Handling multiple version easy • Consistent systems and compliance 30 © Novell, Inc. All rights reserved.
  • 32. Building from Source Locally (1) Source Code // / / Copyr i ght ( c) 2010 SUSE Li nux Pr oduct s GmbH w com but t on. set Geom r y( 32, 32, 448, 192) ; el e_ et / / Aut hor : M t hi as G. Ecker m at ann < ge@ m novel l . com> QObj ect : : connect ( / / Li cense: GPL v2 &w com but t on, el e_ // SI GNAL( cl i cked( ) ) , &hel l o_ br ai nshar e, #i ncl ude <QAppl i cat i on> SLOT( qui t ( ) ) #i ncl ude <QFont > ); #i ncl ude <QPushBut t on> m n_w ndow show ) ; ai i . ( #i ncl ude < i dget > QW r et ur n hel l o_ br ai nshar e. exec( ) ; i nt m n( i nt ar gc, char *ar gv[ ] ) { ai } QAppl i cat i on hel l o_ br ai nshar e( ar gc, ar gv ) ; QW dget m n_w ndow i ai i ; m n_ w ndow r esi ze( 512, 256 ) ; ai i . QPushBut t on w comel e_but t on( " W com t o Br ai nshar e 2010! el e nNovel l - M aki ng I T W k as One. " , or &m n_ w ndow ai i ); w com but t on. set Font ( el e_ QFont ( " Ar i al " , 16, QFont : : Bol d ) ); 32 © Novell, Inc. All rights reserved.
  • 33. 1. Building from Source Locally (2) .spec file # Nam e: hel l o_br ai nshar e % nst al l i Li cense: GPL v2 i f [ - n " $RPM _BUI LD_ROOT" ] ; t hen Ver si on: 1 [ " $RPM _BUI LD_ROOT" ! = " / " ] && Rel ease: 1. m ge r m - r f $RPM BUI LD_ROOT && _ Sum ar y: m Hel l o Br ai nshar e 2010 m r $RPM kdi _BUI LD_ROOT Sour ce0: hel l o_br ai nshar e. cpp fi Gr oup: Pr oduct i vi t y m r -p kdi Bui l dRoot : % m {_t ppat h}/ % {nam bui l d e}- $RPM _BUI LD_ROOT/ usr / bi n Bui l dRequi r es: l i bqt 4- devel i nst al l hel l o_br ai nshar e $RPM _BUI LD_ROOT/ usr / bi n/ %descr i pt i on Hel l o Br ai nshar e 2010 pr ogr am f or demonst r at i on % i l es f pur poses. % at t r ( - , r oot , r oot ) def / usr / bi n/ hel l o_br ai nshar e % ep pr % up - c - T set % ean cl cp - a % 0} . {S: i f [ - n " $RPM _BUI LD_ROOT" ] ; t hen [ " $RPM _BUI LD_ROOT" ! = " / " ] && % ld bui r m - r f $RPM BUI LD_ROOT _ g++ - I / usr / i ncl ude/ Qt Gui - l Qt Cor e - l Qt Gui fi $RPM OPT_ FLAGS _ - s - o hel l o_br ai nshar e hel l o_br ai nshar e. cpp %changel og * M on M ar 08 2010 - m novel l . com ge@ - i ni t i al ver si on 33 © Novell, Inc. All rights reserved.
  • 34. Challenges and Risks When Building from Source Locally • Software-build might interfere with the buildhost – Security and Consistency: Risk of polluting the host with freshly built software – Resource Constraints: a build process might need lots of disk space, memory, compute power • Software-build might depend on special settings of the local build-host – violates goal of reproducible software builds • Multi-User and Multi-Architecture goal not easy to implement – even building 32bit on 64bit hosts is not always easy 34 © Novell, Inc. All rights reserved.
  • 35. Alternatives to Building from Source Locally • Change root environment – Create a build system within the host system; same kernel, but userland is separated – Mitigates: security, consistency, reproducible – Controls: Multi-architecture requirements. – Does not mitigate: Resource constraints – Technology used by the “build” tool, see #2 below • Virtualization – Create a build system within the host system; completely separated – Mitigates: security, consistency, reproducible – Controls: Resource constraints, Multi-architecture requirements – See #4 below: openSUSE Buildservice ® 35 © Novell, Inc. All rights reserved.
  • 36. 2. Building in a Change-root Environment Using the “Build” Tool (1) • “build” is available on the SUSE Linux Enterprise 11 ® Software Development Kit and on openSUSE ® • Build installs a minimal SUSE Linux as build system into some directory and will chroot to this system to compile the package. • Special .spec file options to support build # norootforbuild # needsrootforbuild 36 © Novell, Inc. All rights reserved.
  • 37. Building in a Change-root Environment Using the “Build” Tool (2) Functionality overview build [--clean|--no-init] [--no-checks] [--repository PATH] [--rpms path1:path2:...] [--arch arch1:arch2:...] [--root buildroot] [specfile|srcrpm] build --verify • Environment variables BUILD_RPMS BUILD_ROOT BUILD_RPM_BUILD_STAGE 37 © Novell, Inc. All rights reserved.
  • 38. 3. Building from a Binary Package (1) • Differences – No compile stage necessary – Can be used for nearly any type of existing software • Challenges – Binary packages might need an “installer” to run – system specific configuration – Installation paths not following the Linux Filesystem Hierarchy Standard (FHS) • Caveats – Legal aspects – Licensing 38 © Novell, Inc. All rights reserved.
  • 39. Building from a Binary Package (2) Binary Package Example: Mendeley Desktop (freeware, non-opensoure) • prepackaged tar, no rpm • Directories: mendeleydesktop-0.9.6.1-linux-x86_64/bin mendeleydesktop-0.9.6.1-linux-x86_64/lib mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop/libexec mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop/plugins mendeleydesktop-0.9.6.1-linux-x86_64/lib/mendeleydesktop/plugins/sqldrivers mendeleydesktop-0.9.6.1-linux-x86_64/share mendeleydesktop-0.9.6.1-linux-x86_64/share/applications mendeleydesktop-0.9.6.1-linux-x86_64/share/doc mendeleydesktop-0.9.6.1-linux-x86_64/share/doc/mendeleydesktop mendeleydesktop-0.9.6.1-linux-x86_64/share/icons mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/128x128 mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/128x128/apps mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/16x16 mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/16x16/apps mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/22x22 mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/22x22/apps mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/32x32 mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/32x32/apps mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/48x48 mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/48x48/apps mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/64x64 mendeleydesktop-0.9.6.1-linux-x86_64/share/icons/hicolor/64x64/apps mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/citationStyles mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/citationStyles/default mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/generated-svm-models mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/openOfficePlugin mendeleydesktop-0.9.6.1-linux-x86_64/share/mendeleydesktop/word-lists Goal: install to /opt/mendeleydesktop 39 © Novell, Inc. All rights reserved.
  • 40. Building from a Binary Package (3) .spec file Nam e: mendel eydeskt op % nst al l i Li cense: Com er ci al ( M m endel ey Lt d. ) i f [ - n " $RPM BUI LD_ ROOT" ] ; t hen _ Ver si on: 0. 9. 6. 1 [ " $RPM BUI LD_ ROOT" ! = " / " ] && _ Rel ease: 1. mge r m - r f $RPM BUI LD_ ROOT && _ Sum ar y: m Mendel ey i s a f r ee r esear ch m r $RPM kdi _BUI LD_ ROOT managem ent t ool fi Bui l dAr ch: x86_ 64 m r -p kdi $RPM BUI LD_ ROOT/ opt _ % i ne _f nam % def e {nam % e}- {ver si on}- l i nux- %{bui l dar ch} t ar - C $RPM BUI LD_ ROOT/ opt - xsj pf % 0} _ {S: Sour ce0: % f nam t ar . bz2 {_ e}. mv $RPM_BUI LD_ROOT/ opt / % nam {_f e} Gr oup: Pr oduct i vi t y $RPM_BUI LD_ROOT/ opt / %{name} URL: ht t p: / / w w m w . endel ey. com dow oad- / nl mendel ey- deskt op/ % i l es f Bui l dRoot : % tm {_ ppat h}/ % {nam bui l d e}- % at t r ( - , r oot , r oot ) def / opt / %{name} %descr i pt i on Mendel ey i s a f r ee r esear ch management t ool f or % ean cl deskt op & w eb i f [ - n " $RPM BUI LD_ ROOT" ] ; t hen _ [ " $RPM BUI LD_ ROOT" ! = " / " ] && _ % ep pr r m - r f $RPM BUI LD_ ROOT _ % up - c - T set fi % ld bui %changel og * M on M ar 08 2010 - m novel l . com ge@ - i ni t i al ver si on 40 © Novell, Inc. All rights reserved.
  • 41. 4. Building in the Buildservice • Open and complete distribution development platform • Create RPMs for multiple distributions and architectures • Create online package repositories • openSUSE Build Service is open source ® – Deploy your own internal build service • User Interfaces – Webinterface http://build.opensuse.org/ – Commandline interface: “osc” – Fat-clients – Integration into other tool-chains (qt-creator, kde4) 41 © Novell, Inc. All rights reserved.
  • 42. Building in the Buildservice (2) • “osc” command line interface • Very similar to “cvs” and “svn” command line tools: familiar for developers • Overview – Checking – Commit – Add – importsrcpkg – Build – Rebuild 42 © Novell, Inc. All rights reserved.
  • 43. Next Steps Learn more at: Brainshare Session ® BOF 102 en.opensuse.org/Build_Service build.opensuse.org Go, and build Join the openSUSE ® your packages! Buildservice online! 43 © Novell, Inc. All rights reserved.
  • 45. References http://rpm.org/max-rpm/ http://docs.fedoraproject.org/drafts/rpm-guide-en/ http://en.opensuse.org/SUSE_Build_Tutorial http://en.opensuse.org/Packaging/SUSE_Package_Conventions SUSE software management stack: ® http://en.opensuse.org/Libzypp http://www-128.ibm.com/developerworks/linux/library/l-rpm3.html http://www.ibm.com/developerworks/library/l-rpm1/ 45 © Novell, Inc. All rights reserved.
  • 46.
  • 47. Unpublished Work of Novell, Inc. All Rights Reserved. This work is an unpublished work and contains confidential, proprietary, and trade secret information of Novell, Inc. Access to this work is restricted to Novell employees who have a need to know to perform tasks within the scope of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of Novell, Inc. Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability. General Disclaimer This document is not to be construed as a promise by any participating company to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. Novell, Inc. makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for Novell products remains at the sole discretion of Novell. Further, Novell, Inc. reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All Novell marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.