SlideShare a Scribd company logo
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.
Configure, Pack and Distribute: An RPM Creation Workshop
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

PDF
Software Packaging with RPM
PDF
Bundling Packages and Deploying Applications with RPM
ODP
RPM: Speed up your deploy
PPTX
RPM (Red Hat Package Manager)
PPT
2.5 use rpm and yum package management
PPT
101 2.5 use rpm and yum package management
PPTX
Software management in linux
PPT
101 2.5 use rpm and yum package management
Software Packaging with RPM
Bundling Packages and Deploying Applications with RPM
RPM: Speed up your deploy
RPM (Red Hat Package Manager)
2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
Software management in linux
101 2.5 use rpm and yum package management

What's hot (20)

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

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

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

More from Novell (20)

PDF
Filr white paper
PDF
Social media class 4 v2
PDF
Social media class 3
PDF
Social media class 2
PDF
Social media class 1
PDF
Social media class 2 v2
PDF
LinkedIn training presentation
PDF
Twitter training presentation
PDF
Getting started with social media
PDF
Strategies for sharing and commenting in social media
PPT
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECH
PPT
Workload iq final
PDF
The Identity-infused Enterprise
PDF
Shining the Enterprise Light on Shades of Social
PDF
Accelerate to the Cloud
PDF
The New Business Value of Today’s Collaboration Trends
PDF
Preventing The Next Data Breach Through Log Management
PDF
Iaas for a demanding business
PDF
Workload IQ: A Differentiated Approach
PDF
Virtual Appliances: Simplifying Application Deployment and Accelerating Your ...
Filr white paper
Social media class 4 v2
Social media class 3
Social media class 2
Social media class 1
Social media class 2 v2
LinkedIn training presentation
Twitter training presentation
Getting started with social media
Strategies for sharing and commenting in social media
Information Security & Compliance in Healthcare: Beyond HIPAA and HITECH
Workload iq final
The Identity-infused Enterprise
Shining the Enterprise Light on Shades of Social
Accelerate to the Cloud
The New Business Value of Today’s Collaboration Trends
Preventing The Next Data Breach Through Log Management
Iaas for a demanding business
Workload IQ: A Differentiated Approach
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.
  • 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.