Workshop: Advanced Packaging

Slides:



Advertisements
Similar presentations
Git/Unix Lab March Version Control ●Keep track of changes to a project ●Serves as a backup ●Revert to previous version ●Work on the same files concurrently.
Advertisements

Linux+ Guide to Linux Certification, Second Edition
Virtual Machine and UNIX. What is a VM? VM stands for Virtual Machine. It is a software emulation of hardware. By using a VM, you can have the same hardware.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Managing Software using RPM. ♦ Overview In Linux, Red Hat Package Manager referred as RPM is a tool used for managing software packages and its main function.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
V Avon High School Tech Crew Agenda Old Business –Delete Files New Business –Week 9 Topics: Coming up: –Yearbook Picture: Feb 7 12:20PM.
Dustin Harman VM Workshop 2015 RPM Basics. What is RPM? Red Hat Package Manager Native package manager on RHEL, Fedora, SUSE, some Mandriva RPM/SRPM files.
Package Management How to use rpms. Topics The Problem of Software Installation Package Management Systems Using RPM Finding RPMs Building RPMs.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Linux+ Guide to Linux Certification, Second Edition
CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Linux+ Guide to Linux Certification, Third Edition
Fall 2011 Nassau Community College ITE153 – Operating Systems Session 21 Administering User Accounts and Groups 1.
1 Begin to use Linux. 2 Background  Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991.
GLite build and integration system Building and Packaging Robert HARAKALY
CSC414 “Introduction to UNIX/ Linux” Lecture 6. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
PRESENTED BY ALI NASIR BITF13M040 AMMAR HAIDER BITF13M016 SHOIAB BAJWA BITF13M040 AKHTAR YOUNAS BITF13M019.
Tito Miroslav Suchý Red Hat
Getting Started in RPM Packaging Izhar Firdaus / KageSenshi Contributor Fedora Project
Into Fedora RPM packages Lubomir Rintel Presented by Fedora Package Maintainer Creative Commons Attribution-ShareAlike license applies. Packaging Gems.
1 April 2, Software Packaging and Releasing Best Practices William Cohen NCSU CSC 591W April 2, 2008.
Upgrade-advisor DebConf9 Caceres, Extremadura, Spain Frank lin Piat
Linux Filesystem Management
Getting Started with Linux
RPM101: A gentle intro to creating your own packages Richard Keech Red Hat Asia-Pacific.
Building Good RPM Packages
Version Control Systems
By Jonathan Rinfret UNIX/LINUX By Jonathan Rinfret
SEEM3460 Tutorial Unix Introduction.
File permissions Operating systems I800
Build process of ovirt-node and the plugins
How to make good RPM Packages
RPM Packaging for Sysadmins
Software Package development and management
Packaging a Structural Biology Application – imod / 3dmod
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Bash Introduction (adapted from chapters 1 and 2 of bash Cookbook by Albing, Vossing, & Newham) CPTE 440 John Beckett.
CVS – concurrent versions system
CVS – concurrent versions system
Agenda Bash Shell Scripting – Part II Logic statements Loop statements
SSE2034: System Software Experiment 3 Spring 2016
Part 1: Basic Commands/Utilities
Basic Commands ls cp ls –l (in detail format) echo ls –a
The Command Prompt Commands are the way to “do things” in Unix
The Linux Operating System
9 Linux on the Desktop.
Ubuntu Working in Terminal
Lab 1 introduction, debrief
BIF703 File Permissions.
An introduction to version control systems with Git
Introduction to UNIX.
Using Linux Commands Lab 3.
LINUX Commands Tuesday, September 18, 2018Tuesday, September 18, 2018
Unix : Introduction and Commands
Web Programming Essentials:
JENKINS TIPS Ideas for making your life with Jenkins easier
Enjoy Linux
Consult America Technology Consulting Services
Presentation transcript:

Workshop: Advanced Packaging Miroslav Suchý <msuchy@redhat.com>

Workshop Overview Assumptions You built at least one RPM package. Hopefully you are familiar with Mock Limitations This workshop skips common problems and shows only variety of tips and trick which are hard to spot (or easy to skip) in documentations. Information Feel free to ask question

Dynamic macro The internal Lua interpreter can be used for dynamic macro content creation: %{lua: print("Requires: foo >= 1.2")} Source: http://www.rpm.org/wiki/PackagerDocs/RpmLua

%pretrans Can be run during kickstart No packages installed yet. Not even shell. You should use lua (embedded in rpm) %pre -p <lua> print("Hello from Lua") Source: http://www.rpm.org/wiki/PackagerDocs/RpmLua

Triggers %triggerin –- sendmail ln -sf /usr/bin/sendmail /etc/mymailer/mailer %trigger{un|in|postun} Source: http://rpm.org/api/4.4.2.2/triggers.html

Tags are macros License: BSD This is tag %build echo %{license} Print BSD Can sometimes work in reverse. i.e. you can redefine %name, which change %buildroot, but does not change actual package name.

Saving state between scriptlets %pre touch %{_localstatedir}/lib/rpm- state/%{name}.DoSomethingLater %posttrans if [ -e %{_localstatedir}/lib/rpm- state/%{name}.DoSomethingLater ]; then # do some conditional stuff rm -f %{_localstatedir}/lib/rpm- state/%{name}.DoSomethingLater fi Source: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets

Create user and group Users can come from NIC or LDAP. Use: Requires(pre): shadow-utils %pre getent group GROUPNAME >/dev/null || \ groupadd -r GROUPNAME getent passwd USERNAME >/dev/null || \ useradd -r -g GROUPNAME -d HOMEDIR -s /sbin/nologin \ -c "Useful comment about the purpose of this account" \ USERNAME exit 0 Source: https://fedoraproject.org/wiki/Packaging:UsersAndGroups?rd=Packaging/UsersAndGr oups

Verbose file listing rpm -qplv some.rpm -rwxr-xr-x 1 root root 3371 Feb 4 23:01 /usr/sbin/rpmconf drwxr-xr-x 2 root root 0 Feb 4 23:01 /usr/share/licenses/rpmconf -rw-r--r-- 1 root root 35147 Dec 1 13:08 /usr/share/licenses/rpmconf/LICENSE -rw-r--r-- 1 root root 1424 Feb 4 23:01 /usr/share/man/man8/rpmconf.8.gz

Renaming package Use both Provides and Obsoletes Name: bar Version: 1.0 Release: 4%{?dist} Provides: foo = %{version}-%{release} Obsoletes: foo <= 1.0-4 # Important: We set the Obsoletes release to 4 to be higher than the previous Release: 3%{?dist} Source: https://fedoraproject.org/wiki/Packaging:Guidelines#Renaming.2FReplacing_Existing_Packages

Symlinks Relative symlinks: ln -s ./bar %{buildroot}/bin/foo Absolute Symlinks ln -s %{_bindir}/bar %{buildroot}/bin/foo Can break in buildtime or check phase. Source: https://fedoraproject.org/wiki/Packaging:Guidelines#Symlinks

Ghost files Declare that files are owned by package Not actually installed, but removed when package uninstalled. %install touch $RPM_BUILD_ROOT%{_localstatedir}/log/blather.log … %files %ghost %{_localstatedir}/log/blather.log Source: http://www.rpm.org/max-rpm-snapshot/s1-rpm-inside-files-list-directives.html

Directories inside /run Create %{_tmpfilesdir}/%{name}.conf d /run/NAME PERM USER GROUP - Source1: %{name}-tmpfiles.conf %install mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf # The next two lines may not be needed if the upstream's install script creates them mkdir -p %{buildroot}/run install -d -m 0755 %{buildroot}/run/%{name}/ %files %dir /run/%{name}/ %{_tmpfilesdir}/%{name}.conf Source: https://fedoraproject.org/wiki/Packaging:Tmpfiles.d

Rpmlint / fedora-review Guidelines evolves. Every few years: Run rpmlint on spec and binary packages. fedora-review -rn some.src.rpm

nosrc.rpm NoSource: 0, 1 Source package, but without Source0 and Source1 files. Useful when you cannot distribute source (e.g. OracleDB). See http://developerblog.redhat.com/2014/12/10/how-to-package- proprietary-software/

mock mock -r fedora-23-x86_64 some.src.rpm Use /etc/mock/fedora-23-x86_64.cfg mock -r ./custom-fedora-23-x86_64.cfg some.src Use $PWD/custom-fedora-23-x86_64.cfg

Mock customization /etc/mock/site-defaults.cfg All tunables with comments. ~/.mock/user.cfg Your personal changes.

Mock building in memory Can reduce buildtime to 16% (small pkgs) – 70 % (big packages) config_opts['plugin_conf']['tmpfs_enable'] = True config_opts['plugin_conf']['tmpfs_opts']['max_fs_size'] = '50g' Source: http://miroslav.suchy.cz/blog/archives/2015/05/28/increase_mock_performance_- _build_packages_in_memory/

Mock and LVM config_opts['plugin_conf']['root_cache_enable'] = False config_opts['plugin_conf']['lvm_root_enable'] = True config_opts['plugin_conf']['lvm_root_opts'] = { 'volume_group': 'my-volume-group', 'size': '8G', 'pool_name': 'mock', 'check_size': True, } Source: https://fedoraproject.org/wiki/Mock/Plugin/LvmRoot

Mock shell mock –chroot ls * No shell expansion well there is if there is only one arg eg. Mock –chroot 'ls *' mock –shell ls '*' Shell expanded in chroot. mock –shell Gives you shell in chroot

Mock --copyin Mock -r fedora-23-x86_64 --init Mock –copyin foo.tar.gz /builddir/build/SOURCES/ Mock -r fedora-23-x86_64 --no-clean some.nosrc.rpm

Mock-scm dnf install mock-scm mock -r fedora-22-x86_64 --scm-enable \ --scm-option method=git \ --scm-option package=rpmconf \ --scm-option git_get=set \ --scm-option spec=rpmconf.spec \ --scm-option branch=master --scm-option write_tar=True --scm-option git_get='git clone https://github.com/xsuchy/rpmconf.git'

Koji config Koji mock-config --task=XX Fedpkg mock-config

Secondary arch ppc-koji arm-koji s390-koji Part of fedora-packager package.

rpmdev-* rpmdev-bumpspec foo.spec rpmdev-vercmp 1.2.3 1.2.a rpmdev-extract foo.src.rpm spectool –-list-files foo.spec

Tito tito init tito tag tito build –rpm tito build –rpm –test tito release fedora-git man tito, tito.props, releasers.conf

SCL dnf install scl-utils scl-utils-build spec2scl spec2scl foo.spec > foo-slc.spec