Software Packaging with Open Build Service
Craig Gardner Lars Vogdt Software Engineer Software Engineer [email protected] [email protected] Agenda
• Review of Importance of Packaging • Review of RPM Packaging • Advanced RPM Package Management for SUSE • SUSE Packaging in Open Build Service • Other Packaging in Open Build Service • Hands On Demonstration
2 Why Packaging is Critically Important Critically Important
• Delivery • Reproducibility and Consistency • Upgradeability and Uninstallability • Tracking / Auditing / Monitoring
4 Packaging Makes Your App Universal
Want to make your software truly useful?
Package It!
Packaging streamlines the delivery of your software
5 Review of RPM Basics RPM Metadata
• Version tracking • Manifest of files • Descriptive data • Rules for
‒ Installing
‒ Updating
‒ Uninstalling • Dependencies
7 RPM Packaging Fundamentals
• “package”
‒ Normal .rpm file (delivers the software)
‒ The set of files necessary to build • RPM database • rpm • rpmbuild
‒ Builds from sources
‒ Builds for a specific architecture
‒ Creates version'd binary packages for installation/upgrade
‒ cpio archive of files + scriptlets
8 A Little Hands On Advanced Package Management Advanced Concepts
• Source Patches
‒ Quilt http://users.suse.com/~agruen/quilt.pdf • Macros • Subpackages • Dependencies, capabilities, renaming, prereq, etc. • Library packages • scriptlets • What about Epoch? (it's generally bad) • What about triggers? (why they're generally bad)
11 Epoch
• perl version 5.00503 • perl version 5.6 • 5.6 ?> 5.00503
• Epoch saves the day!
Or does it?
12 Triggers
• Tread carefully – rare • Often have unintended effects • Better for distro maintained packages
‒ Not likely to have intended effects for 3rd party packages
‒ Certainly “ok” for appliances
13 More Hands On Demonstration Open Build Service https://build.opensuse.org/
Over 600 build hosts building more than 300,000 packages for more than 42,000 packagers on 9 different architectures
16 Build Service Basics
• Builds Everything SUSE (and openSUSE) • Builds on all architectures • Builds for all current distros (and some older) • Builds from sources, outputs installable packages
‒ Also builds ISOs, but that's a topic for another presentation • Available for you to do your builds
17 What is Open Build Service (OBS)?
Online Repository
Source Package Image S B O
OBS user submits source to OBS and gets a product
18 OBS Components
Command Hermes Installer Web UI Line Your Client Web UI (YaST,etc.) Client
OBS API (api.opensuse.org) Notification Mirror Server User controller, Database, Search, ... Interface
Storage
Build Build Build Build Build Build Host Host Host Host Host Host Backend
19 Server parts of Open Build Service
• Free and Open Source – everyone can download, install and run an own Open Build Service
• Stores all sources in revision control system • Stores all binaries • Manages signing keys for different repositories • Authorization and permission system available • Calculates the need of rebuilds • Acts as a database for all kind of queries and meta data • ...and many more
20 A Packagers OBS Tools
21 A Packagers OBS Tools Web Client
22 A Packagers OBS Tools osc
http://openbuildservice.org/download
23 Other Distros in Open Build Service Other Distros
https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto • RedHat / CentOS / Fedora / Mandriva
‒ RPM based, so use same specfile
‒ Macros for accommodating differences • Debian / Ubuntu
‒ packagename.dsc, debian.rules, and debian.control files
‒ debian.changelog file
‒ http://en.opensuse.org/openSUSE:Build_Service_Debian_builds
25 Hands On Demonstration Creating Packages
✔ Create a package
✔ in your own home project 1 ✔ on the reference server
27 Creating Packages Create your home project
build.opensuse.org → Login → Create your home project
28 Creating Packages Create a new package
Terminal X
you@laptop $ osc co home:you A home:you you@laptop $ cd home:you
you@laptop $ osc mkpac ctris A ctris you@laptop $ cd ctris
you@laptop $ vi ctris.spec
29 Creating Packages Write a specfile
Name: ctris Summary: Console based Tetris clone URL: http://www.hackl.dhs.org/ctris/ License: GPL Group: Amusements/Games/Action/Arcade Version: 0.42 Release: 1 Source: %{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: ncurses-devel Requires: ncurses
%description An ASCII version of the well known game Tetris
%prep %setup -q
%build make
%install make install DESTDIR=$RPM_BUILD_ROOT %debug_package
%clean rm -rf $RPM_BUILD_ROOT;
%files %defattr (-,root,root) %doc AUTHORS COPYING README TODO %doc %{_mandir}/man6/ctris.6.gz /usr/games/ctris
30 Creating Packages Create a new package
Terminal X
you@laptop $ wget -q http://www.hackl.dhs.org/data/download/download.php?file=ctris- 0.42.tar.bz2 -O ctris-0.42.tar.bz2
you@laptop $ osc addremove A ctris.spec A ctris-0.42.tar.bz2 you@laptop $ osc ci -m “First checkin of the ctris package”
31 Creating Packages Playtime
Try some stuff on your own:
Import an RPM package with osc importsrcpkg
Copy an existing package with osc copypac
32 Building Packages Building Packages
✔ Build a package
✔ locally on your laptop 2 ✔ and on the reference server
34 Building Packages Add Repositories
home:you → Repositories → Add repositories
35 Building Packages Local Builds
Terminal X
you@laptop $ osc build Building ctris.spec for openSUSE_12.2/i586 Getting buildinfo from server and store to /home/you/home:you/ctris/.osc/_buildinfo- openSUSE_12.2-i586.xml Getting buildconfig from server and store to /home/you/home:you/ctris/.osc/_buildconfig-openSUSE_12.2-i586 Updating cache of required packages 0.0% cache miss. 109/109 dependencies cached.
Verifying integrity of cached packages using keys from openSUSE:12.2 Writing build configuration Running build logging output to /var/tmp/build-root/.build.log...
36 Building Packages Local Builds for foreign distributions
Terminal X
you@laptop $ osc build Fedora_17 Building ctris.spec for Fedora_17/i586 Getting buildinfo from server and store to /home/heino/home:heino1938/ctris/.osc/_buildinfo-Fedora_17-i586.xml Getting buildconfig from server and store to /home/heino/home:heino1938/ctris/.osc/_buildconfig-Fedora_17-i586 Updating cache of required packages 0.0% cache miss. 204/204 dependencies cached.
Verifying integrity of cached packages using keys from Fedora:17 Writing build configuration Running build logging output to /var/tmp/build-root/.build.log...
37 Building Packages Checking build results
Terminal X
you@laptop $ osc results Fedora_17 i586 failed Fedora_17 x86_64 failed openSUSE_12.2 i586 succeeded openSUSE_12.2 x86_64 succeeded
you@laptop $ osc prjresults ctris F Fedora_17 i586 (published) F Fedora_17 x86_64 (published) . openSUSE_12.2 i586 (published) . openSUSE_12.2 x86_64 (published)
38 Building Packages Checking build logs
Terminal X
you@laptop $ osc localbuildlog
you@laptop $ osc remotebuildlog home:you ctris Fedora_17 x86_64
39 Building Packages Playtime
Try some stuff on your own:
Examine other projects with osc pr some:project
Examine the build root with osc chroot
40 Collaborating on Packages Collaborating on Packages
✔ Branch a package
✔ Submit a merge request 3 ✔ Review a merge request
42 Collaborating on Packages Branching
Terminal X
you@laptop $ osc branch home:hennevogel ctris A working copy of the branched package can be checked out with:
osc co home:you:branches:home:hennevogel/ctris
you@laptop $ osc co home:you:branches:home:hennevogel/ctris A home:you:branches:home:hennevogel A home:you:branches:home:hennevogel/ctris A home:you:branches:home:hennevogel/ctris/ctris-0.41.tar.bz2 A home:you:branches:home:hennevogel/ctris/ctris.changes A home:you:branches:home:hennevogel/ctris/ctris.spec At revision 2e6f2aea1a884fda8c6e9564c9323ab3.
you@laptop $ cd home:you:branches:home:hennevogel
43 Collaborating on Packages Updating
Terminal X
you@laptop $ vi ctris.spec
you@laptop $ wget -q http://www.hackl.dhs.org/data/download/download.php?file=ctris- 0.42.tar.bz2 -O ctris-0.42.tar.bz2
you@laptop $ rm ctris-0.41.tar.bz2
you@laptop $ osc addremove D ctris-0.41.tar.bz2 A ctris-0.42.tar.bz2
44 Collaborating on Packages Testing your changes
Terminal X
you@laptop $ osc build
you@laptop $ osc ci -m “Update to version 0.42”
you@laptop $ osc results
you@laptop $ osc remotebuildlog home:you:branches:home:hennevogel openSUSE_12.2 i586
45 Collaborating on Packages Submitting changes
Terminal X
you@laptop $ osc submitreq created request id 0815
you@laptop $ osc request -M 0815 State:new By:you When:2012-08-16T13:21:35 submit: home:you:branches:home:hennevogel/ctris -> home:hennevogel Descr: Update to version 0.42
46 Collaborating on Packages Assess Requests
Terminal X
you@laptophennevogel@work $ $ osc request list home:hennevogel 0815 State:new By:you When:2012-08-16T13:21:35 submit: home:you:branches:home:hennevogel/ctris -> home:hennevogel Descr: Update to version 0.42
hennevogel@work $ osc request accept 0815 -m "Thank you for your contribution :-)" Result of change request state: ok
47 Collaborating on Packages Tracking request
Terminal X
you@laptop $ osc request -M 0815 State:accepted By:hennevogel When:2012-08-16T13:43:04 submit: home:you:branches:home:hennevogel/ctris -> home:hennevogel From: new(you) Descr: Update Comment: Thank you for your contribution :-)
48 Collaborating on Packages Playtime
Try some stuff on your own:
Branch/submit a new package with osc branch -N
Track a request for openSUSE osc request list openSUSE:Factory
49 Resources Learn More
Packaging • Web: http://en.opensuse.org/Portal:Packaging • ML: http://lists.opensuse.org/opensuse-packaging • IRC: freenode #opensuse-packaging
Open Build Service • Web: http://openbuildservice.org • ML: http://lists.opensuse.org/opensuse-buildservice • IRC: freenode #opensuse-buildservice
51 Related Sessions @SUSECon
• FUT20733: Enhancing SUSE Linux Enterprise - SUSE Package Hub • TUT20829: Implementation of a SUSE-based Solution with SUSE Manager at Apollo-Optik • HO19988: Introduction to Software Packaging • TUT20013: Open Build Service for Administrators
52 Corporate Headquarters +49 911 740 53 0 (Worldwide) Join us on: Maxfeldstrasse 5 www.suse.com www.opensuse.org 90409 Nuremberg Germany
53 Unpublished Work of SUSE. All Rights Reserved. This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE. Access to this work is restricted to SUSE 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 SUSE. 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. SUSE 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 SUSE products remains at the sole discretion of SUSE. Further, SUSE 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 SUSE 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.