Submit Search
Upload
Software Packaging with RPM
•
7 likes
•
2,423 views
Schalk Cronjé
Follow
Slides from a presentation at ACCU 2008 on packaging software with RPMs
Read less
Read more
Report
Share
Report
Share
1 of 96
Download now
Download to read offline
Recommended
Configure, Pack and Distribute: An RPM Creation Workshop
Configure, Pack and Distribute: An RPM Creation Workshop
Novell
RPM: Speed up your deploy
RPM: Speed up your deploy
fcrippa
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPM
Alexander Shopov
RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)
skalaivanibutp
Software management in linux
Software management in linux
nejadmand
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
Acácio Oliveira
Linux Presentation
Linux Presentation
kuldeepakgautam
RPM (LINUX)
RPM (LINUX)
Raghu nath
Recommended
Configure, Pack and Distribute: An RPM Creation Workshop
Configure, Pack and Distribute: An RPM Creation Workshop
Novell
RPM: Speed up your deploy
RPM: Speed up your deploy
fcrippa
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPM
Alexander Shopov
RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)
skalaivanibutp
Software management in linux
Software management in linux
nejadmand
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
Acácio Oliveira
Linux Presentation
Linux Presentation
kuldeepakgautam
RPM (LINUX)
RPM (LINUX)
Raghu nath
2.5 use rpm and yum package management
2.5 use rpm and yum package management
Acácio Oliveira
Yum (Linux)
Yum (Linux)
Raghu nath
RHCE Training
RHCE Training
ajeet yadav
Rac on NFS
Rac on NFS
mengjiagou
RHCE FINAL Questions and Answers
RHCE FINAL Questions and Answers
Radien software
Snort296x centos6x 2
Snort296x centos6x 2
Trinh Tuan
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
maclean liu
J Ruby On Rails Presentation
J Ruby On Rails Presentation
railsconf
OTRS
OTRS
Muhammad Qazi
Redhat 6 & 7
Redhat 6 & 7
r9social
High performance content hosting
High performance content hosting
Aleksey Korzun
Known basic of NFV Features
Known basic of NFV Features
Raul Leite
3. configuring a compute node for nfv
3. configuring a compute node for nfv
videos
RHCE (RED HAT CERTIFIED ENGINEERING)
RHCE (RED HAT CERTIFIED ENGINEERING)
Sumant Garg
OSDC 2014: Nat Morris - Open Network Install Environment
OSDC 2014: Nat Morris - Open Network Install Environment
NETWAYS
12 yum
12 yum
josemanuelacostarendon
NIH package manager for pkgsrc
NIH package manager for pkgsrc
Транслируем.бел
Ansible ex407 and EX 294
Ansible ex407 and EX 294
IkiArif1
Docker Setting for Static IP allocation
Docker Setting for Static IP allocation
Ji-Woong Choi
4. open mano set up and usage
4. open mano set up and usage
videos
40 Lideres según MBZ (Alemania) @0
40 Lideres según MBZ (Alemania) @0
Maldonado-EUROSOLAR Carlos
Материалы круглого стола по инженерному делу в Совете Федерации. Часть 1
Материалы круглого стола по инженерному делу в Совете Федерации. Часть 1
Союз молодых инженеров России
More Related Content
What's hot
2.5 use rpm and yum package management
2.5 use rpm and yum package management
Acácio Oliveira
Yum (Linux)
Yum (Linux)
Raghu nath
RHCE Training
RHCE Training
ajeet yadav
Rac on NFS
Rac on NFS
mengjiagou
RHCE FINAL Questions and Answers
RHCE FINAL Questions and Answers
Radien software
Snort296x centos6x 2
Snort296x centos6x 2
Trinh Tuan
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
maclean liu
J Ruby On Rails Presentation
J Ruby On Rails Presentation
railsconf
OTRS
OTRS
Muhammad Qazi
Redhat 6 & 7
Redhat 6 & 7
r9social
High performance content hosting
High performance content hosting
Aleksey Korzun
Known basic of NFV Features
Known basic of NFV Features
Raul Leite
3. configuring a compute node for nfv
3. configuring a compute node for nfv
videos
RHCE (RED HAT CERTIFIED ENGINEERING)
RHCE (RED HAT CERTIFIED ENGINEERING)
Sumant Garg
OSDC 2014: Nat Morris - Open Network Install Environment
OSDC 2014: Nat Morris - Open Network Install Environment
NETWAYS
12 yum
12 yum
josemanuelacostarendon
NIH package manager for pkgsrc
NIH package manager for pkgsrc
Транслируем.бел
Ansible ex407 and EX 294
Ansible ex407 and EX 294
IkiArif1
Docker Setting for Static IP allocation
Docker Setting for Static IP allocation
Ji-Woong Choi
4. open mano set up and usage
4. open mano set up and usage
videos
What's hot
(20)
2.5 use rpm and yum package management
2.5 use rpm and yum package management
Yum (Linux)
Yum (Linux)
RHCE Training
RHCE Training
Rac on NFS
Rac on NFS
RHCE FINAL Questions and Answers
RHCE FINAL Questions and Answers
Snort296x centos6x 2
Snort296x centos6x 2
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
J Ruby On Rails Presentation
J Ruby On Rails Presentation
OTRS
OTRS
Redhat 6 & 7
Redhat 6 & 7
High performance content hosting
High performance content hosting
Known basic of NFV Features
Known basic of NFV Features
3. configuring a compute node for nfv
3. configuring a compute node for nfv
RHCE (RED HAT CERTIFIED ENGINEERING)
RHCE (RED HAT CERTIFIED ENGINEERING)
OSDC 2014: Nat Morris - Open Network Install Environment
OSDC 2014: Nat Morris - Open Network Install Environment
12 yum
12 yum
NIH package manager for pkgsrc
NIH package manager for pkgsrc
Ansible ex407 and EX 294
Ansible ex407 and EX 294
Docker Setting for Static IP allocation
Docker Setting for Static IP allocation
4. open mano set up and usage
4. open mano set up and usage
Viewers also liked
40 Lideres según MBZ (Alemania) @0
40 Lideres según MBZ (Alemania) @0
Maldonado-EUROSOLAR Carlos
Материалы круглого стола по инженерному делу в Совете Федерации. Часть 1
Материалы круглого стола по инженерному делу в Совете Федерации. Часть 1
Союз молодых инженеров России
SEO for Software Companies
SEO for Software Companies
Patrick McKenzie
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila Szegedi
ZeroTurnaround
Mozllla Labs presentation
Mozllla Labs presentation
Bogomil Shopov
Credentials index brand capital
Credentials index brand capital
indexbrand
LinkedIn Financial Services Webinar Part 2 - 6-19-12
LinkedIn Financial Services Webinar Part 2 - 6-19-12
LinkedIn
Abordando o Gap de Habilidades em Redes na América Latina para Promover o Des...
Abordando o Gap de Habilidades em Redes na América Latina para Promover o Des...
Cisco do Brasil
sols_print_enrolment_record
sols_print_enrolment_record
Chen Zhao
Kelompok tani ternak3
Kelompok tani ternak3
Amalia Dinata
Електронни терористи ли сме
Електронни терористи ли сме
Bogomil Shopov
Insights from data in Education
Insights from data in Education
Gramener
Driving Total Health with Health IT and Health 2.0
Driving Total Health with Health IT and Health 2.0
Holly Potter
antología
antología
Pedro Daniel Veas Vegas
Schuldrecht Allgemeiner Teil
Schuldrecht Allgemeiner Teil
Till Karsten
Philips Case Study
Philips Case Study
LinkedIn
presentation for Staffordshire University
presentation for Staffordshire University
leolaoshi
Viewers also liked
(17)
40 Lideres según MBZ (Alemania) @0
40 Lideres según MBZ (Alemania) @0
Материалы круглого стола по инженерному делу в Совете Федерации. Часть 1
Материалы круглого стола по инженерному делу в Совете Федерации. Часть 1
SEO for Software Companies
SEO for Software Companies
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila Szegedi
Mozllla Labs presentation
Mozllla Labs presentation
Credentials index brand capital
Credentials index brand capital
LinkedIn Financial Services Webinar Part 2 - 6-19-12
LinkedIn Financial Services Webinar Part 2 - 6-19-12
Abordando o Gap de Habilidades em Redes na América Latina para Promover o Des...
Abordando o Gap de Habilidades em Redes na América Latina para Promover o Des...
sols_print_enrolment_record
sols_print_enrolment_record
Kelompok tani ternak3
Kelompok tani ternak3
Електронни терористи ли сме
Електронни терористи ли сме
Insights from data in Education
Insights from data in Education
Driving Total Health with Health IT and Health 2.0
Driving Total Health with Health IT and Health 2.0
antología
antología
Schuldrecht Allgemeiner Teil
Schuldrecht Allgemeiner Teil
Philips Case Study
Philips Case Study
presentation for Staffordshire University
presentation for Staffordshire University
Similar to Software Packaging with RPM
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
NETWAYS
Satellite 6 - Pupet Introduction
Satellite 6 - Pupet Introduction
Michael Lessard
Docker practice
Docker practice
wonyong hwang
Docker Clustering - Batteries Included
Docker Clustering - Batteries Included
C4Media
App container rkt
App container rkt
Xiaofeng Guo
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
Acácio Oliveira
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
Acácio Oliveira
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
Docker, Inc.
Toolbox of a Ruby Team
Toolbox of a Ruby Team
Arto Artnik
Sling Applications - A DevOps perspective
Sling Applications - A DevOps perspective
Robert Munteanu
Docking your services_with_docker
Docking your services_with_docker
Tikal Knowledge
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt application
Dinesh Manajipet
PHP QA Tools
PHP QA Tools
rjsmelo
RAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and Database
Nikhil Kumar
Performance characteristics of traditional v ms vs docker containers (dockerc...
Performance characteristics of traditional v ms vs docker containers (dockerc...
Boden Russell
Chicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - Mediafly
Mediafly
OpenStack for Centos
OpenStack for Centos
Chandan Kumar
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
Christy Norman
Ksplice - Keep your Database systems up to date with no downtime
Ksplice - Keep your Database systems up to date with no downtime
Luis Marques
Similar to Software Packaging with RPM
(20)
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
stackconf 2022: Cluster Management: Heterogeneous, Lightweight, Safe. Pick Three
Satellite 6 - Pupet Introduction
Satellite 6 - Pupet Introduction
Docker practice
Docker practice
Docker Clustering - Batteries Included
Docker Clustering - Batteries Included
App container rkt
App container rkt
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
Toolbox of a Ruby Team
Toolbox of a Ruby Team
Sling Applications - A DevOps perspective
Sling Applications - A DevOps perspective
Docking your services_with_docker
Docking your services_with_docker
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt application
PHP QA Tools
PHP QA Tools
RAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and Database
Performance characteristics of traditional v ms vs docker containers (dockerc...
Performance characteristics of traditional v ms vs docker containers (dockerc...
Chicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - Mediafly
OpenStack for Centos
OpenStack for Centos
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
Ksplice - Keep your Database systems up to date with no downtime
Ksplice - Keep your Database systems up to date with no downtime
More from Schalk Cronjé
DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM World
Schalk Cronjé
DocuOps & Asciidoctor
DocuOps & Asciidoctor
Schalk Cronjé
What's new in Asciidoctor
What's new in Asciidoctor
Schalk Cronjé
Probability Management
Probability Management
Schalk Cronjé
Seeking Enligtenment - A journey of purpose rather than instruction
Seeking Enligtenment - A journey of purpose rather than instruction
Schalk Cronjé
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Schalk Cronjé
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
Schalk Cronjé
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Schalk Cronjé
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
Schalk Cronjé
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
Schalk Cronjé
Gradle in 45min
Gradle in 45min
Schalk Cronjé
Basic Gradle Plugin Writing
Basic Gradle Plugin Writing
Schalk Cronjé
Seeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instruction
Schalk Cronjé
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Schalk Cronjé
Beyond Estimates - Probability Management
Beyond Estimates - Probability Management
Schalk Cronjé
Documentation An Engineering Problem Unsolved
Documentation An Engineering Problem Unsolved
Schalk Cronjé
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Schalk Cronjé
Gradle in a Polyglot World
Gradle in a Polyglot World
Schalk Cronjé
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Schalk Cronjé
Death of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused Testing
Schalk Cronjé
More from Schalk Cronjé
(20)
DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor
DocuOps & Asciidoctor
What's new in Asciidoctor
What's new in Asciidoctor
Probability Management
Probability Management
Seeking Enligtenment - A journey of purpose rather than instruction
Seeking Enligtenment - A journey of purpose rather than instruction
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
Gradle in 45min
Gradle in 45min
Basic Gradle Plugin Writing
Basic Gradle Plugin Writing
Seeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instruction
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Beyond Estimates - Probability Management
Beyond Estimates - Probability Management
Documentation An Engineering Problem Unsolved
Documentation An Engineering Problem Unsolved
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Gradle in a Polyglot World
Gradle in a Polyglot World
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Death of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused Testing
Software Packaging with RPM
1.
Software Packaging with
RPM Schalk W. Cronjé ysb33r@gmail.com ACCU 2008 © Schalk W. Cronjé
2.
Background ●
RPM == Red Hat Package Manager ● No longer just Red Hat ● Leadership by Marc Ewing and Erik Troan ● Development was in decay by start of decade – Back on track by combined efforts of main Linux vendors ● Not only for packaging traditional binary artefacts – also documents, java packages, perl modules etc. ACCU 2008 © Schalk W. Cronjé
3.
Original Design Goals ●
Ease of use ● Package-oriented focus ● Upgradability of packages ● Tracking of package interdependencies ● Query capabilities ● Verification ● Support for multiple architectures ● Use of pristine sources Source: RPM Guide http://docs.fedoraproject.org ACCU 2008 © Schalk W. Cronjé
4.
RPM Contents ●
Compressed archive file – cpio format ● Installation instructions – Permissions and ownership to be applied to each file – Helper scripts (scriplets) ACCU 2008 © Schalk W. Cronjé
5.
RPM's place in
the world ● Primary software package management for – RedHat – Suse – Mandriva – Fedora – CentOs ● Available on other platforms including: – Solaris – NetBSD – FreeBSD ACCU 2008 © Schalk W. Cronjé
6.
Supported H/W Architectures ●
Intel compatible 32-bit (i386 ...) ● Intel compatible 64-bit (x86_64) ● Intel Itanium (ia64) ● HP Alpha / Digital (alpha ...) ● Sparc/Ultra Sparc (sparc) ● ARM (armv3l ..) ● MIPS (mps, mipsel) ● Power PC (ppc ...) ● Motorola 68000 series (m68k ...) ● SGI MIPS (sgi) ● IBM RS6000 (rs6000) ● IBM S/390 (i370, s390x, s390 ) ACCU 2008 © Schalk W. Cronjé
7.
RPM World ●
RPM is not ... Repository Management Tools (urpmi, rpmdrake, yum ...) – yum – urpmi perl python – rpmdrake Base commands (rpm,rpmbuild ..) rpmdb RPM libraries (db4) ACCU 2008 © Schalk W. Cronjé
8.
RPM's Peers ●
apt – Debian, Ubuntu ● portage – Gentoo ● pkgsrc – NetBSD, DragonBSD ● ports – FreeBSD ACCU 2008 © Schalk W. Cronjé
9.
Naming convention # RPM
macro convention %{name}-%{version}-%{release}.%{arch}.rpm # Typical bc-1.06-20.i586.rpm # Decorated with vendor distribution bc-1.06-20mdv2007.1.i586.rpm Vendor release # Source Package bc-1.06-20mdv2007.1.src.rpm # Architecture independent binary package fonts-ttf-dejavu-2.15-2mdv2007.1.noarch.rpm ACCU 2008 © Schalk W. Cronjé
10.
Command-line Interface
Installing & Removal ACCU 2008 © Schalk W. Cronjé
11.
Installing & Upgrading
Packages # Installation (requires root) rpm -ivh bc-1.06-20mdv2007.1.i586.rpm # Upgrading (requires root) rpm -Uvh bc-1.06-20mdv2007.1.i586.rpm -U works for installation Use -vh to produce visual as well feedback [#] rpm -Uvh bc-1.06-20mdv2007.1.i586.rpm Preparing... ########################################### [100%] ACCU 2008 © Schalk W. Cronjé
12.
Removing Packages # Removal
(requires root) rpm -e NAME rpm --erase NAME Only the name is required [#] rpm -e bc ACCU 2008 © Schalk W. Cronjé
13.
Downgrading Packages # Downgrading
to older version (requires root) rpm -Uvh --oldpackage NAME [#] rpm -Uvh --oldpackage bc-1.05-20mdv2007.1.i586.rpm Preparing... ########################################### [100%] ACCU 2008 © Schalk W. Cronjé
14.
Command-line Interface
Querying the database ACCU 2008 © Schalk W. Cronjé
15.
Is this Package
Installed? # Is this package installed? rpm -q NAME # Is this version of the package installed? rpm -q NAME-VERSION [#] rpm -q bc bc-1.06-20mdv2007.1 [#] rpm -q bcb package bcb is not installed [#] rpm -q bc-1.06 bc-1.06-20mdv2007.1 [#] rpm -q bc-1.07 package bc-1.07 is not installed ACCU 2008 © Schalk W. Cronjé
16.
Getting a list
of all packages # Getting the list rpm -qa [#] rpm -qa glibc-2.4-8mdv2007.1 libcrack2-2.8.9-2mdv2007.1 libattr1-2.4.32-2mdv2007.1 libsqlite3_0-3.3.8-1mdv2007.1 gawk-3.1.5-3mdv2007.1 libkrb53-1.5.2-6.2mdv2007.1 rpm-4.4.6-21mdv2007.1 libx11_6-1.1.1-2.1mdv2007.1 libfreetype6-2.3.1-3.1mdv2007.1 libxrender1-0.9.2-1mdv2007.1 ACCU 2008 © Schalk W. Cronjé
17.
Searching for Installed
Packages # Can use grep ... rpm -qa | grep GREP-PATTERN rpm -qa --pipe "grep GREP-PATTERN" # Or use internal pattern match rpm -qa 'GLOB' [#] rpm -qa 'gcc*' gcc-cpp-4.2.2-0.RC.1mdv2008.0 gcc-4.2.2-0.RC.1mdv2008.0 gcc-c++-4.2.2-0.RC.1mdv2008.0 ACCU 2008 © Schalk W. Cronjé
18.
Modifying display format #
Use --qf and RPM Macro Patterns # to customise output rpm -q --qf 'RPM-MACRO-PATTERN' rpm -qa --qf '%{name}n' # Display the summary line rpm -q --qf '%{summary}' NAME [#] rpm -qa --qf '%{name} ' 'gcc*' gcc-cpp gcc gcc-c++ [#] rpm -qa --qf '%{name}: %{summary}n' 'gcc*' gcc-cpp: The C Preprocessor gcc: GNU Compiler Collection gcc-c++: C++ support for gcc ACCU 2008 © Schalk W. Cronjé
19.
Who Supplied this
File? # Use -f to refer to any installed filename rpm -qf FILENAME [#] rpm -qf /usr/bin/zcat gzip-1.3.11-5mdv2007.1 [#] rpm -qf /home/schalk/accu.txt file /home/schalkc/accu.txt is not owned by any package ACCU 2008 © Schalk W. Cronjé
20.
List of Files
in Package # Use -l rpm -q -l NAME [#] rpm -ql bc /usr/bin/bc /usr/bin/dc /usr/share/doc/bc-1.06 /usr/share/doc/bc-1.06/AUTHORS /usr/share/doc/bc-1.06/COPYING /usr/share/doc/bc-1.06/COPYING.LIB /usr/share/doc/bc-1.06/FAQ /usr/share/doc/bc-1.06/NEWS /usr/share/doc/bc-1.06/README /usr/share/info/bc.info.bz2 /usr/share/info/dc.info.bz2 /usr/share/man/man1/bc.1.bz2 /usr/share/man/man1/dc.1.bz2 ACCU 2008 © Schalk W. Cronjé
21.
Checking Installed Package
Requirements # --requires lists requirements of package rpm -q --requires NAME Requires exact version of package [#] rpm -q --requires gcc binutils >= 2.16.91.0.7-6mdk gcc-cpp = 4.2.2-0.RC.1mdv2008.0 libgcc >= 3.3.2-5mdk update-alternatives Requires minimum glibc-devel >= 2.4-6mdk version of package rpmlib(VersionedDependencies) <= 3.0.3-1 libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.2) libc.so.6(GLIBC_2.3) Needs library installed libc.so.6(GLIBC_2.3.4) libc.so.6(GLIBC_2.4) rtld(GNU_HASH) ACCU 2008 © Schalk W. Cronjé
22.
What Does this
Package Provide? # --provides lists symbolic names that # a package provides rpm -q --provides NAME [#] rpm -q --provides gcc gcc4.2 = 4.2.2-0.RC.1mdv2008.0 devel(libgcc_s) gcc = 4.2.2-0.RC.1mdv2008.0 ACCU 2008 © Schalk W. Cronjé
23.
Finding a Package
Providing a Service # --whatprovides shows the package which provides # a specific symbolic name rpm -q --whatprovides SYMBOLIC_NAME [#] rpm -q qt package qt is not installed [#] rpm -q –-whatprovides qt qt3-common-3.3.8-4mdv2007.1 ACCU 2008 © Schalk W. Cronjé
24.
Displaying Package Information
# --info dumps information about a package # Usually Header + %description rpm -q --info NAME [#] rpm -q --info qcc-c++ Name : gcc-c++ Relocations: (not relocatable) Version : 4.2.2 Vendor: Mandriva Release : 0.RC.1mdv2008.0 Build Date: Sa 15 Sep 2007 02:56:09 BST Install Date: Do 27 Mrt 2008 21:19:45 GMT Build Host: n4.mandriva.com Group : Development/C++ Source RPM: gcc-4.2.2-0.RC.1mdv2008.0.src.rpm Size : 8732938 License: GPLv3+ Signature : DSA/SHA1, Vr 05 Okt 2007 00:56:31 BST, Key ID e7898ae070771ff3 Packager : Pixel <pixel@mandriva.com> URL : http://gcc.gnu.org/ Summary : C++ support for gcc Description : This package adds C++ support to the GNU C compiler. It includes support for most of the current C++ specification, including templates and exception handling. It does include the static standard C++ library and C++ header files; the library for dynamically linking programs is available separately. ACCU 2008 © Schalk W. Cronjé
25.
Inspecting Uninstalled Package #
Same as for other queries # Just add -p rpm -qp -l rpm -qp –-provides rpm -qp --requires rpm -qp --info [#] rpm -qlp /home/schalkc/ypanything-1.1-3.i586.rpm /etc/rc.d/init.d/ypanything /etc/ypanything.conf /usr/sbin/ypanything /usr/share/doc/ypanything-1.1 /usr/share/doc/ypanything-1.1/CHANGELOG /usr/share/doc/ypanything-1.1/COPYING /usr/share/doc/ypanything-1.1/README /var/lib/ypanything/ldap.group.pl /var/lib/ypanything/ldap.passwd.pl ACCU 2008 © Schalk W. Cronjé
26.
Building RPMs
ACCU 2008 © Schalk W. Cronjé
27.
Rules ●
Don't build as root. ● Setup a build environment ● Don't build as root. ● Ensure own spec files don't require root to build ● Don't build as root. ● Use macro names for system applications ACCU 2008 © Schalk W. Cronjé
28.
Creating a Build
Environment ● Create .rpmrc ● Create .rpmmacros ● Create directories ACCU 2008 © Schalk W. Cronjé
29.
.rpmrc buildarchtranslate:
i386: i586 buildarchtranslate: i486: i586 buildarchtranslate: i586: i586 buildarchtranslate: i686: i586 ACCU 2008 © Schalk W. Cronjé
30.
.rpmmacros %_topdir
/home/schalkc/RPM %_builddir %{_topdir}/BUILD %_tmppath %{_topdir}/tmp %_rpmdir %{_topdir}/RPMS %packager Schalk <ysb33r@gmail.com> # Add if building for a commercial company %vendor SomeCompany # Add if signing RPMs %_signature gpg %_gpg_path ~/.gnupg ACCU 2008 © Schalk W. Cronjé
31.
Create Directories # Create
directory for delivering binary RPMs mkdir -p /home/schalkc/RPM/RPMS %{_rpmdir} # Create directory for delivering source RPMs mkdir -p /home/schalkc/RPM/SRPMS %{_srcrpmdir} # Create directores used for building packages mkdir -p /home/schalkc/RPM/BUILD %{_builddir} mkdir -p /home/schalkc/RPM/tmp %{_tmppath} # Create directory for source locations mkdir -p /home/schalkc/RPM/SOURCES %{_sourcedir} # Create directory for spec files mkdir -p /home/schalkc/RPM/SPECS %{_specdir} ACCU 2008 © Schalk W. Cronjé
32.
Rebuilding a Source
Package ● Motivation – No binary package available – Existing binary package will not install – Customisation via command-line # Use --rebuild command rpmbuild --rebuild bc-1.06-20mdv2007.1.src.rpm ACCU 2008 © Schalk W. Cronjé
33.
Source Rebuild Process
rpmbuild --rebuild %{_sourcedir} %{_specdir} unpack implicit rpmbuild -bb %{_rpmdir}/%{arch} ACCU 2008 © Schalk W. Cronjé
34.
Build Process rpmbuild -b[a|s|b|p|c|i]
%prep %{_builddir}/ %{name}-% {version} %clean %build %install %{buildroot} %{_srcrpmdir} %{_rpmdir} ACCU 2008 © Schalk W. Cronjé
35.
Mapping RPM to
OSS Convention %clean rm -rf / make clean %prep tar -xf %build ./configure make %install make install ACCU 2008 © Schalk W. Cronjé
36.
Building Packages # Build
everything rpmbuild-ba /path/to/specfile # Build binary RPMs rpmbuild -bb /path/to/specfile # Build source RPM only rpmbuild -bs /path/to/specfile ACCU 2008 © Schalk W. Cronjé
37.
Intermediate Build Commands #
Setup, but don't build (Invokes %prep) rpmbuild -bp /path/to/specfile # Setup and build (Invokes %build) rpmbuild -bc /path/to/specfile # Setup, build and install, but don't package rpmbuild -bi /path/to/specfile # To skip a previous stage rpmbuild --short-circuit -b[p|c|i] /path/to/spec-file ACCU 2008 © Schalk W. Cronjé
38.
Spec Files
ACCU 2008 © Schalk W. Cronjé
39.
Variables & Macros ●
Defined using define variable value ● Used as %{variable} ● If not found expands to literal string ● %% => % ● System macros start with _ or _ _ define myvar myvalue # Will print 'myvalue' echo %{myvar} # Will print '%{myvarr}' echo %{myvarr} # Will print '%{myvar}' echo %%{myvar} ACCU 2008 © Schalk W. Cronjé
40.
Conditional Sections ●
Conditionals were limited in older versions ● Later versions have added special conditionals: – %ifos – %ifarch ACCU 2008 © Schalk W. Cronjé
41.
Equivalent of #if #
The old way to do the equivalent of #if %if %{?my_variable:1}%{!?my_variable:0} ... %else ... %endif # The new way to do the equivalent of #if %if %{my_variable} ... %else ... %endif ACCU 2008 © Schalk W. Cronjé
42.
Spec File Layout ●
Header ● Description – %description ● Build – %prep, %build, %install, %clean ● Package: – %files, %verify, scriptlets ● Changelog – %changelog ACCU 2008 © Schalk W. Cronjé
43.
Spec File Header A
number of fields in the format name: value One line summary of package Summary: Dotted version number Version: Affects: %{version} Release: Release number of package License: License e.g. LGPL Affects: %{release} Source: Source file. Patch: Usually tarball or zip Buildroot: Patch files Always set to: %{_tmppath}/%{name}-%{version} Affects: %{buildroot} ACCU 2008 © Schalk W. Cronjé
44.
Summary:
GNU's bc (a numeric processing language) Name: bc Version: 1.06 Release: 6 License: GPL URL: http://www.gnu.org/software/bc/bc.html Group: Sciences/Mathematics Source: ftp://ftp.gnu.org/gnu/bc/bc-%{version}.tar.bz2 Patch0: bc-1.06-readline42.patch.bz2 BuildRequires: flex gpm-devel ncurses-devel readline-devel Buildroot: %{_tmppath}/%{name}-%{version} ACCU 2008 © Schalk W. Cronjé
45.
Description
● To provide a multi-line description of a package ● Usually taken from README %description The bc package includes bc and dc. Bc is an arbitrary precision numeric processing arithmetic language. Dc is an interactive arbitrary precision stack based calculator, which can be used as a text mode calculator. Install the bc package if you need its number handling capabilities or if you would like to use its text mode calculator. ACCU 2008 © Schalk W. Cronjé
46.
Preparation Phase (%prep) ●
Unpacks & decompresses all sources via %setup ● Assumes that destination directory is %{_builddir}/%{name}-%{version} ● Decompresses and applies all patches via %patch ● %setup / %setup0 => Source, Source0 ● %setup1 => Source1 ... ● %patch / %patch0 => Patch, Patch0 ● %patch1 => Patch1 ... ACCU 2008 © Schalk W. Cronjé
47.
Example %prep %prep %setup -q %patch
-p1 -b .readline42 ACCU 2008 © Schalk W. Cronjé
48.
Build Phase (%build) ●
Performs the tasks associated with configuring and building ● Most distributions provide a special %make macro to help with Autoconf environments ● Direct access to GNU Make via %{__make} ACCU 2008 © Schalk W. Cronjé
49.
Build Installation Phase
(%install) ● Performs the actions of installing software into a special root ● Software is packaged up from this root according to %files ● Most distributions provide a %makeinstall macro to help with AutoConf environments ACCU 2008 © Schalk W. Cronjé
50.
Example %build, %install,
%clean %build %configure --with-readline %make LDFLAGS=-s %install rm -rf %{buildroot} %makeinstall %clean rm -rf %{buildroot} ACCU 2008 © Schalk W. Cronjé
51.
File Management (%files) ●
Specifies which files have to be packaged up ● Will error if: – File specified, but not found – File found, but not specified ● Can specify default modes & ownership – Use %defattr ● Can specifiy mode & ownership per file – Use inline %attr ACCU 2008 © Schalk W. Cronjé
52.
Example %files %files %defattr(-,root,root) %doc COPYING
COPYING.LIB FAQ AUTHOR NEWS README %{_bindir}/bc %{_bindir}/dc %{_mandir}/man1/bc.1* %{_mandir}/man1/dc.1* %{_infodir}/dc.info* ACCU 2008 © Schalk W. Cronjé
53.
Overriding Attributes ## specific
permissions and ownerships can be changed from default ## by using %attr %files %defattr(-,root,root) %attr(0711,nullmail,nullmail) %{_sbindir}/nullmailer-queue ACCU 2008 © Schalk W. Cronjé
54.
Earmarking Configuration Files ##
Mark configuration files as %config ## Prevents --verify from reporting MD5 errors. %files %config %{_sysconfdir}/ldap.conf ## Add 'noreplace' to prevent upgrades from overwriting a config file ## Upgrade will create a file with a .rpmsave suffix %files %config(noreplace) %{_sysconfdir}/ldap.conf ## Can even be combined with %attr %files %config(noreplace) %attr(0640,root,ldap) %{_sysconfdir}/ldap.conf ACCU 2008 © Schalk W. Cronjé
55.
Ignoring Installed Files ##
Some installed files need not be packaged ## If not explicitly called out installation phase will fail %files %exclude %{_sysconfdir}/ldap.conf.example ACCU 2008 © Schalk W. Cronjé
56.
Packaging Empty Directory ##
By default rpmbuild will not package empty directories ## To package an empty directory use %dir %files %defattr (-,root,root) %dir %{_locatestatedir}/ypanything ## Specific permissions and ownership is possible %files %defattr (-,root,root) %dir %attr(0700,daemon,daemon) %{_locatestatedir}/ypanything ACCU 2008 © Schalk W. Cronjé
57.
Pre-installation scriptlet (%pre) ●
Allows for work to be done before package transaction is started ● If scriptlet exits non-zero installation is aborted ● Can use count to determine whether installation or upgrade ● Shell type is 'sh' not 'bash' ACCU 2008 © Schalk W. Cronjé
58.
%pre ## Can use
conditional: ## 1 is first-install, ## >1 is upgrade %pre echo 'This is entering pre-package installation' if [ "$1" = 1 ] ; then echo 'This is the first time this package is installed' fi ACCU 2008 © Schalk W. Cronjé
59.
Post-installation scriptlet (%post) ●
Is executed after all files have installed on system ● Can call installed files ● Useful for updating SYSV initscripts. ● If scriptlet exists zero, warning is issued, but installation continues. ● Can use count to determine whether installation or upgrade ● Shell type is 'sh' not 'bash' ACCU 2008 © Schalk W. Cronjé
60.
%post ## Can use
conditional: ## 1 is first-install, ## >1 is upgrade %post echo 'This is entering post installation phase' if [ "$1" = 1 ] ; then /sbin/chkconfig --add nullmailer /sbin/chkconfig nullmailer on else /sbin/service nullmailer condrestart fi ACCU 2008 © Schalk W. Cronjé
61.
Pre-uninstall scriptlet (%preun) ●
Is executed before a package is uninstalled ● Can call installed files ● Useful for stopping services. ● If scriptlet exists zero, operation is aborted. ● Can use count to determine whether installation or upgrade ● Shell type is 'sh' not 'bash' ACCU 2008 © Schalk W. Cronjé
62.
%preun ## Can use
conditional: ## 0 is final removal, ## >0 is downgrade %preun echo 'This is entering pre-uninstall phase' if [ "$1" = 0 ]; then /sbin/chkconfig nullmailer off /sbin/chkconfig --del nullmailer fi ACCU 2008 © Schalk W. Cronjé
63.
Post-uninstall scriplet (%postun) ●
Is executed after all files have been removed ● Useful for final cleanup ● If scriptlet exists zero, warning is printed, but operation succeeds ● Can use count to determine whether installation or upgrade ● Shell type is 'sh' not 'bash' ACCU 2008 © Schalk W. Cronjé
64.
%postun ## Can use
conditional: ## 0 is final removal, ## >0 is downgrade %postun echo 'This is entering post-uninstall phase' if [ "$1" = 0 ]; then %{_sbindir}/userdel nullmail %{_sbindir}/groupdel nullmail 2>/dev/null || /bin/true fi ACCU 2008 © Schalk W. Cronjé
65.
Multiple Packages ●
Multiple packages allows flexibility to build once, but install selectively ● Few other packaging systems have this feature ● Additional packages are indicated by using %package ● Use -n in order to change stem ● Each package requires a %description ● Each package may have custom %files and scriptlets ACCU 2008 © Schalk W. Cronjé
66.
## This spec
will produce: ## nullmailer-1.00-2.i386.rpm ## nullmailer-sendmail-wrapper-1.00-2.i386.rpm ## nullmailer-mailq-wrapper-1.00-2.i386.rpm Name: nullmailer Summary: Simple relay-only mail transport agent Version: 1.00 Release: 2 ... BuildRoot: %{_tmppath}/%{name}-%{version} Provides: smtpdaemon smtp-daemon Conflicts: sendmail Conflicts: qmail %package sendmail-wrapper Summary: Sendmail wrapper for nullmailer. Group: Networking/Mail Conflicts: courier-sendmail-wrapper Requires: %{name} = %{version} %package mailq-wrapper Summary: Mailq wrapper for nullmailer. Group: Networking/Mail Requires: %{name} = %{version} ACCU 2008 © Schalk W. Cronjé
67.
## Within -n
this spec will produce: ## nullmailer-1.00-2.i386.rpm ## sendmail-wrapper-1.00-2.i386.rpm ## mailq-wrapper-1.00-2.i386.rpm Name: nullmailer Summary: Simple relay-only mail transport agent Version: 1.00 Release: 2 ... BuildRoot: %{_tmppath}/%{name}-%{version} Provides: smtpdaemon smtp-daemon Conflicts: sendmail Conflicts: qmail %package -n sendmail-wrapper Summary: Sendmail wrapper for nullmailer. Group: Networking/Mail Conflicts: courier-sendmail-wrapper Requires: %{name} = %{version} %package -n mailq-wrapper Summary: Mailq wrapper for nullmailer. Group: Networking/Mail Requires: %{name} = %{version} ACCU 2008 © Schalk W. Cronjé
68.
## A custom
%description is required per package %description Nullmailer is a mail transport agent designed to only relay all its messages through a fixed set of "upstream" hosts. It is also designed to be secure. %description sendmail-wrapper Provides a sendmail wrapper for applications that looks for /usr/lib/sendmail or /usr/sbin/sendmail %description -n mailq-wrapper Provides a mailq wrapper so that information can be retrieved using the mailq command. ACCU 2008 © Schalk W. Cronjé
69.
## %files and
customisation can occur per package ## This applies to the base package %files ## These are files for nullmailer-sendmail-wrapper %files sendmail-wrapper ## These are files for mailq-wrapper (note -n) %files -n mailq-wrapper ## This is %pre for the base package %pre ## This is a %postun for mailq-wrapper (note -n) %postun -n mailq-wrapper ACCU 2008 © Schalk W. Cronjé
70.
CPAN Modules -
The Quick Way ● In RPM-based system CPAN Perl modules should be installed using RPM ● Provides for better dependency management ● Most CPAN modules can be built by customising a simple template NOTE: Same approach applies for other language modules i.e. Python, Ruby. ACCU 2008 © Schalk W. Cronjé
71.
## Set the
name of the package as known in CPAN. Replace any :: with - %define cpan_package Net-IPv4Addr ## Set the Version from CPAN Version: 0.10 ## Set the release number. This starts at 1, bump as needed Release: 1 ## A one-liner description Summary: Perl extension for parsing IPv4 addresses. Name: perl-%{cpan_package} Group: Development/Perl License: GPL or Artistic Source: %{cpan_package}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} %description Net::IPv4Addr provides functions ... ## ... more to follow ... ACCU 2008 © Schalk W. Cronjé
72.
%prep %setup -q -n
%{cpan_package}-%{version} %build %{__perl} Makefile.PL INSTALLDIRS="vendor" %{__make} %install %{__rm} -rf $RPM_BUILD_ROOT %{__make} pure_install DESTDIR=%{buildroot} %clean %{__rm} -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc README %{_bindir}/ipv4calc %{perl_vendorlib}/* %{_mandir}/man*/* %changelog * Mon Jul 17 2007 Schalk W. Cronje 1.10-1 - Created spec file ACCU 2008 © Schalk W. Cronjé
73.
Commercial Packages
ACCU 2008 © Schalk W. Cronjé
74.
Commercial Requirements ●
Might not want to distribute source ● Need agreement to license before install ● Might not use spec-driven build ● Linux packaging as an after-thought ACCU 2008 © Schalk W. Cronjé
75.
Source RPMs with
Limited Source ● It is possible to build SRPMs that do not contain all of the source ● Allows for distribution of all non-restricted components ● Restricted components can then be obtained under NDA / licence / payment ● Allows for multi-configuration distribution ● Header fields: – NoSource – NoPatch ACCU 2008 © Schalk W. Cronjé
76.
Using NoPatch with
Conditional Source0: our-standard-code.tar.bz2 NoPatch0: special-performance-patch-against-payment.patch.bz2 %prep %setup -q %if %{?with_performance_patch:1}%{!?with_performance_patch:0} %patch %endif ACCU 2008 © Schalk W. Cronjé
77.
Binary-only RPMs ●
It is always just possible to build binary RPMs without distributing SRPMs ● Integrate rpmbuild -bb as part of build process ● This is the recommended solution ACCU 2008 © Schalk W. Cronjé
78.
Packaging up Files
Only ● Environment might produce artefacts via another build system ● Distribution via RPM is an afterthought ● Solution is to create a list of files via build system, then feed this to spec file ● Use %files -f ACCU 2008 © Schalk W. Cronjé
79.
Packaging up Files
Only Summary: A scanner for HTTP Name: mycompany-http-scanner Version: 1.06 Release: 6 License: MyCompany's Commercial License Group: Networking/Daemon Buildroot: %{_tmppath}/%{name}-%{version} %desciption We are providing this incredible, best since sliced bread, HTTP scanner. %prep %build %install %files -f /dev/fd/0 [#] cat myfilelist.txt | rpmbuild -bb mycompany-http-scanner.spec ACCU 2008 © Schalk W. Cronjé
80.
Turning off AutoReqProv
● Due to packaging method, automatic requires/provides might not be feasible ● Responsibility with packager to manually provide requirements ● Header fields: – AutoReqProv – Requires – Provides AutoReqProv: no Requires: libgcc >= 3.3.2 Provides: http-scanner ACCU 2008 © Schalk W. Cronjé
81.
More Tips &
Tricks (not for the faint of heart) ACCU 2008 © Schalk W. Cronjé
82.
Installing Custom Macros ●
To help other build packages against your package install your own macros ● Create a file named the same as your top- level package ● Install into /etc/rpm.d ● Will be read during rpmbuild initialisation ● Choose macro names carefully – Remember: No namespace support – Approach naming similar to C macros ACCU 2008 © Schalk W. Cronjé
83.
Calling RPM from
GNU Make # Assume BUILDDIR was set in Makefile RPMDIR=$(BUILDDIR)/rpm rpm: mkdir -p $(RPMDIR)/rpm $(RPMDIR)/build $(RPMDIR)/tmp && MAKEFLAGS= rpmbuild -bb --define "_sourcedir $(CURDIR)" --define "_rpmdir $(RPMDIR)/rpm" --define "_builddir $(RPMDIR)/build" --define "_tmppath $(RPMDIR)/tmp" MyProjectSpec.spec ACCU 2008 © Schalk W. Cronjé
84.
Calling RPM from
GNU Make #2 ## Define GNU Make macro rpmbuild=mkdir -p $2/rpm $2/build $2/tmp && MAKEFLAGS= rpmbuild -bb --define "_sourcedir $1" --define "_rpmdir $2/rpm" --define "_builddir $2/build" --define "_tmppath $2/tmp" $3 RPMDIR=$(BUILDDIR)/rpm rpm: @$(call rpmbuild,$(CURDIR),$(RPMDIR),MyProject.spec) ACCU 2008 © Schalk W. Cronjé
85.
Using SVN revision
as RPM Release [#] rpm -ba --define "m_release $(svn info 2>/dev/null | grep ^Revision | awk '{print $2}')" MyProject.spec # In GNU Make RPMRELEASE=$(strip $(shell svn info 2>/dev/null | grep ^Revision | awk '{print $$2}')) ACCU 2008 © Schalk W. Cronjé
86.
SVN + Gmake
+ RPM (1 of 2) rpmbuild=mkdir -p $2/rpm $2/build $2/tmp && MAKEFLAGS= rpmbuild -bb --define "_sourcedir $1" --define "_rpmdir $2/rpm" --define "_builddir $2/build" --define "_tmppath $2/tmp" $(if $4,--define "m_release $4") $3 RPMRELEASE=$(strip $(shell svn info 2>/dev/null | grep ^Revision | awk '{print $$2}')) rpm: $(call rpmbuild,$(CURDIR),$(RPMDIR), MyProject.spec,$(RPMRELEASE)) ACCU 2008 © Schalk W. Cronjé
87.
SVN + Gmake
+ RPM (2 of 2) ## Set the version of this build. ## It can be overridden from the Makefile ## if necessary %if %{?m_release:1}%{!?m_release:0} Release: %{m_release} %else Release: 1 %endif ACCU 2008 © Schalk W. Cronjé
88.
Re-entering Gmake from
RPM (1 of 2) ● Possibility of combining RPM build process into Gmake, but reusing same Makefile from within spec file ● Allows for less maintenance make rpm rpmbuild Makefile make OPT1=VAL1 ... spec make install OPT1=VAL1 ... ACCU 2008 © Schalk W. Cronjé
89.
Re-entering Gmake from
RPM (2 of 2) ## Spec-file %define crondir %{_sysconfdir}/cron.d %define apacheconfdir %{_sysconfdir}/httpd/conf.d %define statedir %{_localstatedir}/lib/my-project %define perldir %{perl_privlib} %define perlmodroot %{perldir}/McAfee/Bletchley %define BUILDSCRIPT_OPTS1 PREFIX_LOCALESTATEDIR=%{statedir} %define BUILDSCRIPT_OPTS2 PREFIX_PERLMODROOT=%{perldir} PREFIX_CRONDIR=% {crondir} %define BUILDSCRIPT %{__make} -C %{_sourcedir} %{BUILDSCRIPT_OPTS1} % {BUILDSCRIPT_OPTS2} PREFIX_VERSION=%{version} %build %{BUILDSCRIPT} BUILDROOT=%{_builddir} %install %{__rm} -rf %{buildroot} %{BUILDSCRIPT} install INSTALL_DIR=%{buildroot} ACCU 2008 © Schalk W. Cronjé
90.
Querying Spec File
for Artefacts # Use rpmquery --specfile # rpmquery --qf '%{name}-%{version}-%{release}.% {arch}.rpm' --specfile SPECFILENAME [#] rpmquery --qf '%{name}-%{version}-%{release}.%{arch}.rpm' --specfile ypanything.spec ypanything-1.1-3.i586.rpm [#] rpmquery --qf '%{name}-%{version}-%{release}.%{arch}.rpm' --specfile nullmailer.spec nullmailer-1.00-0.RC7.2mdk.i586.rpm nullmailer-sendmail-wrapper-1.00-0.RC7.2mdk.i586.rpm nullmailer-mailq-wrapper-1.00-0.RC7.2mdk.i586.rpm ACCU 2008 © Schalk W. Cronjé
91.
Unpacking Contents # Unpack
content of RPM-contained archive rpm2cpio PACKAGE | cpio -id [#] rpm -qlp ypanything-1.1-3.i586.rpm /etc/rc.d/init.d/ypanything /etc/ypanything.conf /usr/sbin/ypanything /usr/share/doc/ypanything-1.1 /usr/share/doc/ypanything-1.1/CHANGELOG /usr/share/doc/ypanything-1.1/COPYING /usr/share/doc/ypanything-1.1/README /var/lib/ypanything/ldap.group.pl /var/lib/ypanything/ldap.passwd.pl [#] rpm2cpio ypanything-1.1-3.i586.rpm | cpio -id 152 blocks [#] ls /etc /usr /var ypanything-1.1-3.i586.rpm ACCU 2008 © Schalk W. Cronjé
92.
Don't Strip my
Binaries! ● RPM strips symbols by default ● Override this behaviour by redefining __os_install_post ● Similar behaviour customisation possible for other macros %define __os_install_post %{nil} ACCU 2008 © Schalk W. Cronjé
93.
What are the
Scriptlets? # Query scriptlets of an installed package rpm -q --scripts NAME rpm -q -p --scripts PACKAGE rpm -q --scripts --specfile SPECFILE no %pre [#] rpm -q --scripts -p /ypanything-1.1-3.i586.rpm preinstall program: /bin/sh postinstall scriptlet (using /bin/sh): if [ "$1" = 1 ]; then %post chkconfig --add ypanything fi preuninstall scriptlet (using /bin/sh): if [ "$1" = 0 ]; then %preun chkconfig ypanything off chkconfig --del ypanything fi postuninstall program: /bin/sh no %postun ACCU 2008 © Schalk W. Cronjé
94.
Working Around Failing
Scriptlets # Any scriptlet or trigger scripts can be disabled rpm -Uvh --noscripts PACKAGE rpm -Uvh --notriggers PACKAGE rpm -Uvh --nopre PACKAGE rpm -Uvh --nopost PACKAGE rpm -e --noscripts NAME rpm -e --notriggers NAME rpm -e --nopreun NAME rpm -e --nopostun NAME [#] rpm -e --nopreun ypanything ACCU 2008 © Schalk W. Cronjé
95.
Final Tips ●
See /usr/lib/rpm/macros for raw definitions of macros ● Use rpm --showrc to list macros ● Understand how to use rpm -V to validate files after installation and for simple security audits ● Always use %{__command} macros instead of commands. ACCU 2008 © Schalk W. Cronjé
96.
Thank you May you
successfully build RPMs! ACCU 2008 © Schalk W. Cronjé
Download now