User- and distro-friendly packaging

Similar documents
C Coding standard. Raphael kena Poss. July Introduction 2. 3 File system layout 2

FROM SCRIPT TO PACKAGES. good practices for hassle-free code reuse

CS354R: Game Technology

GUI Programming with GTK+

Compiling Software on UNIX. System Administration Decal Spring 2009 Lecture #4 George Wu Slides prepared by Joshua Kwan

CptS 360 (System Programming) Unit 3: Development Tools

Frédéric Crozat SUSE Linux Enterprise Release Manager

National Aeronautics and Space and Administration Space Administration. CFE CMake Build System

The pkgsrc wrapper framework

opensuse Packaging for the osmocom stack Martin Hauke

Python RPM Porting Guide Release 0.1

Compiler Theory. (GCC the GNU Compiler Collection) Sandro Spina 2009

The Common Debian Build System

Introduction to clang tools scan-build and clang-tidy.

MUST. MPI Runtime Error Detection Tool

AutoArchive. Release 1.4.1

MUST. MPI Runtime Error Detection Tool

Mingw-w64 and Win-builds.org - Building for Windows

DICE and LCFG Software Guidelines

Software Distribution and Package Management

openresty / array-var-nginx-module

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING

SOFTWARE CONFIGURATION MANAGEMENT

e2 factory the emlix Embedded Build Framework

Topic 6: A Quick Intro To C. Reading. "goto Considered Harmful" History

CSE 303: Concepts and Tools for Software Development

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

Developing with L4 Overview and Pointers

Install your scientific software stack easily with Spack

FPLLL. Contributing. Martin R. Albrecht 2017/07/06

Variables and Constants

GNU Autotools Tutorial

CSE 374 Programming Concepts & Tools

xtensor-io Sep 20, 2018

EE382M 15: Assignment 2

The WAF build system

Compilers Project 3: Semantic Analyzer

(Refer Slide Time: 01:40)

CS 220: Introduction to Parallel Computing. Arrays. Lecture 4

Part III Appendices 165

LLVMLinux: x86 Kernel Build

But first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15

Topic 6: A Quick Intro To C

Beyond Makefiles: Autotools and the GNU Build System

COMP26120 Academic Session: Lab Exercise 2: Input/Output; Strings and Program Parameters; Error Handling

Programming Assignment 1

Shared Libraries: The Dynamic Linker

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

ESTABLISHED Paul Kunz SLAC. Overview. Examples. Expose the downsides. Benefits. Risks and Costs. Building with Automake 1 Paul F.

XStatic Documentation

Shellbased Wargaming

Why Use the Autotools?...xviii Acknowledgments... xx I Wish You the Very Best... xx

Concurrent Variants, Isolation, and Feature Models in Software Deployment

ARC infrastructure and releases. Anders Wäänänen, NBI

Installing the new LOFAR Software on a fresh Ubuntu 14.04

contribution-guide.org Release

RPM How To: Intro. What is RPM? Why Building RPMS? Who is this howto designed for? Who can build RPMS? What do I need to build RPMS?

C / C++ Coding Rules

2 Compiling a C program

CSCE 120: Learning To Code

Make was originally a Unix tool from 1976, but it has been re-implemented several times, notably as GNU Make.

Intermediate Programming, Spring 2017*

Upgrading Your Geant4 Release

LR Parsing LALR Parser Generators

Data Management, Spring 2015: Project #1

Reliable C++ development - session 1: From C to C++ (and some C++ features)

Programming Assignment 1

Exercise Session 2 Systems Programming and Computer Architecture

9/10/2016. Time for Some Detailed Examples. ECE 120: Introduction to Computing. Let s See How This Loop Works. One Statement/Step at a Time

CMake & Ninja. by István Papp

Fedora Astronomy. The benefits for astronomical software from integration into Linux distributions. Christian Dersch.

Semantic Analysis. Lecture 9. February 7, 2018

Arithmetic Processing

Scripting in Python Laborations and projects

Bringing GNU Health. into opensuse. Dr. Axel Braun

Important From Last Time

LR Parsing. Table Construction

The why and how of getting packaged

Recursion. What is Recursion? Simple Example. Repeatedly Reduce the Problem Into Smaller Problems to Solve the Big Problem

Maintaining an Out-of-Tree Driver and an Upstream Driver Simultaneously (with minimal pain)

Cross Compiling. Real Time Operating Systems and Middleware. Luca Abeni

Maemo Diablo GNU Make and makefiles Training Material

Cucumber Linux Distribution

Important From Last Time

Installing Python Modules

Assignment 6: The Power of Caches

Flatpak workshop. flatpak.org

Reviewing gcc, make, gdb, and Linux Editors 1

CS 110 Computer Architecture. Lecture 2: Introduction to C, Part I. Instructor: Sören Schwertfeger.

Pretty-printing of kernel data structures

Being a Good OSS Contributor. Jeremy Mikola

Are you Really Helped by Upstream Kernel Code?

Bloat of Data. Unicode Era

Operating Systems 2013/14 Assignment 1. Submission Deadline: Monday, November 18th, :30 a.m.

In One Slide. Outline. LR Parsing. Table Construction

Deep C by Olve Maudal

Mesos on ARM. Feng Li( 李枫 ),

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Starting to Program in C++ (Basics & I/O)

Rethinking the core OS in 2015

Transcription:

User- and distro-friendly packaging Recommendations to upstream tarball providers Jan Engelhardt <jengelh@inai.de> Presented at the opensuse Conference 2011 2011-Sep-11 14 Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 1 / 26

This talk is R-rated :) Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 2 / 26

Table of Contents 1 Introduction 2 Source Archive 3 Code Inside 4 Further Considerations 5 Conclusion Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 3 / 26

Abstract Introduction This just for the non-live audience. Even after the release of a software tarball, there remains work to be done. Not all end-users run software from tarballs, but often rely on a form of infrastructure to (re)provide the software in a fashion of their liking e. g. a Linux distro shipping compiled binaries, and this transition is not completely automatable. This talk wants to give direction on how upstream software providers can reduce the workload for packagers in the downstream direction, and thus increase chances that your software will be available to more end-users. Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 4 / 26

Introduction Nomenclature Software Propagation Line upstream developers: LOC crafting release manager: package and release source code archive (usually a tarball ), and keeper of the GPG key distro contributor: takes tarball and produces a RPM package end-user: installation of tarball or RPM package Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 5 / 26

Introduction Target audience upstream developers: LOC crafting release manager: package and release source code archive (usually a tarball ), and keeper of the GPG key distro contributor: takes tarball and produces a RPM package end-user: installation of tarball or RPM package Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 5 / 26

Introduction Why You Should Care (1/3) You retain the freedom to design your tarball releases presenting guidelines not binding, but recommended nevertheless Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 6 / 26

Introduction Why You Should Care (1/3) You retain the freedom to design your tarball releases presenting guidelines not binding, but recommended nevertheless it s about the users direct: end-users indirect: administrators, distro contributors, help desk/support line Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 6 / 26

Introduction Why You Should Care (2/3) It s all about the users... faster for them to apply known paradigms (e. g../configure && make install ) users don t want to RTFM provided docs even exist Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 7 / 26

Introduction Why You Should Care (2/3) It s all about the users... faster for them to apply known paradigms (e. g../configure && make install ) users don t want to RTFM provided docs even exist Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 7 / 26

Introduction Why You Should Care (2/3) It s all about the users... faster for them to apply known paradigms (e. g../configure && make install ) users don t want to RTFM provided docs even exist When things go wrong negative reviews much have more weight Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 7 / 26

Introduction Why You Should Care (2/3) It s all about the users... faster for them to apply known paradigms (e. g../configure && make install ) users don t want to RTFM provided docs even exist When things go wrong negative reviews much have more weight software ratings (incl. word of mouth) playing a role upset as few users as possible Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 7 / 26

Introduction Why You Should Care (3/3) And distros... want to contain rank growth (de:wildwuchs) remember Factory has some 4600+ packages fewer deviations fewer code, fewer chances for bugs Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 8 / 26

Introduction Why You Should Care (3/3) And distros... want to contain rank growth (de:wildwuchs) remember Factory has some 4600+ packages fewer deviations fewer code, fewer chances for bugs And you want users, don t you? distro might just silently fix it to provide a better package experience Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 8 / 26

Versioning Fundamentals Source Archive sequenced version numbers (3.1 < 3.1.4 < 3.14) tools like rpm etc. use this interpretation other versioning schemes need conversion e. g. the decimal point scheme (3.1 < 3.14 < 3.2) 3.141 3.1.4.1 thankfully not widespread Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 9 / 26

Versioning Fundamentals Source Archive sequenced version numbers (3.1 < 3.1.4 < 3.14) tools like rpm etc. use this interpretation other versioning schemes need conversion e. g. the decimal point scheme (3.1 < 3.14 < 3.2) 3.141 3.1.4.1 thankfully not widespread (yes, I am ware of TEX) Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 9 / 26

Source Archive Source Archive Basics (1/4) name of the archive file: should contain name and version (or usually just name for tarred-up snapshots) archive should extract into a new directory, not $PWD $ tar -xvvf foo-1.0.tar.xz -rw-r--r-- root/root 283 2011-09-12 configure.ac Install into a new directory $ tar -xvvf foo-1.0.tar.xz -rw-r--r-- root/root 283 2011-09-12 foo-1.0/configure.ac Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 10 / 26

Source Archive Source Archive Basics (2/4) top-level extracted directory s version (if any) should match archive version $ tar -xvvf gap4r4p12.tar.xz -rw-r--r-- root/root 283 2011-09-12 gap4r4/configure Top-level directory s version (if any) should match archive version $ tar -xvvf foo-1.0.5.tar.xz -rw-r--r-- root/root 283 2011-09-12 foo-1.0.5/configure Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 11 / 26

Source Archive Source Archive Basics (3/4) omit redundant components Just one build per version so far; makes build number redundant VirtualBox-4.1-4.1.2_73507_openSUSE114-1.x86_64.rpm VirtualBox-4.1-4.1.0_73009_openSUSE114-1.x86_64.rpm VirtualBox-4.0-4.0.12_72916_openSUSE114-1.x86_64.rpm version provided in %name also redundant, since vbox-4.1 cannot be installed alongside vbox-4.0 Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 12 / 26

Source Archive Source Archive Basics (4/4) preferably do not mix separators; avoid releases, only do versions (rpm/deb lingo): ebtables-v2.0.10-2.tar.gz ebtables-2.0.10.2.tar.gz dots preferred as a separator within distros gap4r4p12.tar.gz gap-4.4.12.tar.gz Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 13 / 26

Archive Formats (1/2) Source Archive.tar is the container of choice, with.gz (oldskool) or.xz (modern) also circulating:.zip (archaic),.7z Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 14 / 26

Source Archive Archive Formats (2/2) recompressed and/or repackaged at times to different format reduction of BRPM/SRPM sizes Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 15 / 26

Source Archive Archive Formats (2/2) recompressed and/or repackaged at times to different format reduction of BRPM/SRPM sizes object files normally should not be in the archive much less in an SCM Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 15 / 26

Source Archive To Split or Not To Split? [ : This frame has +w capabilities.] big packages introduce serialization/limit scaleout split generic libraries from big projects: samba libtalloc, libtdb, libtevent util-linux libblkid, libmount, libuuid documentation often likes to be put into the main package success stories? *-data packages, mostly in the games project Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 16 / 26

Code Inside Source Availability Do provide the source in a SCM: to grab the HEAD and make patches against that instead rather important if tarball releases reflect a state too old to receive patches, classical long-winded release cycles and where stable and devel have diverged quite a bit gap 4.4 vs. 4.5 Linux 2.4 vs. 2.5 can see when and how my patch was applied can package the SCM HEAD and drop my local patch Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 17 / 26

Code Inside Source-level Build System Claim: plain Makefiles are the most buggy ones. Examples: wrongful population of CFLAGS, which is a user-overridable variable, with essential flags failure to properly implement DESTDIR for make install parallel make rendered non-functional Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 18 / 26

Code Inside Source-level Build System Claim: plain Makefiles are the most buggy ones. Examples: wrongful population of CFLAGS, which is a user-overridable variable, with essential flags failure to properly implement DESTDIR for make install parallel make rendered non-functional Use some common (source-level) build automation system. C, C++: automake, cmake, scons,... Python: setup.py Perl: Makefile.PL Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 18 / 26

Code Inside Source-level Build Systems (2/2) $BUILD_SYS no need to figure out names of variables in Makefiles use BS for consistency autoconf: options commonly start with --enable- or --with-... for simplicity, bug surface reduction automake: installation taken care of automatically Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 19 / 26

Code Inside Compilation (C, C++) (1/2) enable warnings, and address them -Wall is not enough; useful CFLAGS: -D_FORTIFY_SOURCE=2 -Wall -Waggregate-return -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Wformat=2 compiler may warn, but incorrectly, or only half of the time fixing itself requires in-depth knowledge of the used language Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 20 / 26

Code Inside Compilation (2/2) printf("%d\n", sizeof(int)); Emitted Warning (and only on 64-bit!) test.c:4:2: warning: format %d expects argument of type int, but argument 2 has type long unsigned int [-Wformat] Should we tr... %ld? Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 21 / 26

Code Inside Compilation (2/2) printf("%d\n", sizeof(int)); Emitted Warning (and only on 64-bit!) test.c:4:2: warning: format %d expects argument of type int, but argument 2 has type long unsigned int [-Wformat] Bzzzt %ld printf("%zu\n", sizeof(int)); /* or in the absence of C99: */ printf("%lu\n", (long)sizeof(int)); Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 21 / 26

Library Versioning (1/2) Code Inside Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 22 / 26

Code Inside Library Versioning (1/2) libqt4-4.7.1: libqtcore.so.4.7.1 so-version equaling the package version is a sign of a possible error other platforms do not necessarily use the same three-component style for SO versions meaning of SO versions is nevertheless consistent across platforms Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 22 / 26

Code Inside Library Versioning (1/2) libqt4-4.7.1: libqtcore.so.4.7.1 so-version equaling the package version is a sign of a possible error other platforms do not necessarily use the same three-component style for SO versions meaning of SO versions is nevertheless consistent across platforms How SO versions work Qt version linux SO ver means API range BSD SO ver 4.7.x 4.7.x Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 22 / 26

Library Versioning (1/2) Code Inside libqt4-4.7.1: libqtcore.so.4.7.1 so-version equaling the package version is a sign of a possible error other platforms do not necessarily use the same three-component style for SO versions meaning of SO versions is nevertheless consistent across platforms How SO versions work Qt version linux SO ver means API range BSD SO ver 4.7.x 4.7.x 4 11.so.11 4.8.x 4.8.x Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 22 / 26

Library Versioning (1/2) Code Inside libqt4-4.7.1: libqtcore.so.4.7.1 so-version equaling the package version is a sign of a possible error other platforms do not necessarily use the same three-component style for SO versions meaning of SO versions is nevertheless consistent across platforms How SO versions work Qt version linux SO ver means API range BSD SO ver 4.7.x 4.7.x 4 11.so.11 4.8.x 4.8.x 4 12.so.12 5.6.x 5.6.x Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 22 / 26

Code Inside Library Versioning (1/2) libqt4-4.7.1: libqtcore.so.4.7.1 so-version equaling the package version is a sign of a possible error other platforms do not necessarily use the same three-component style for SO versions meaning of SO versions is nevertheless consistent across platforms How SO versions work Qt version linux SO ver means API range BSD SO ver 4.7.x 4.7.x 4 11.so.11 4.8.x 4.8.x 4 12.so.12 5.6.x 5.6.x 5 11.so.11 Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 22 / 26

Library Versioning (2/2) Code Inside Actually do SO versioning libx264 libx264.so.115 Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 23 / 26

Library Versioning (2/2) Code Inside Actually do SO versioning libx264 libx264.so.115 When not caring about SO ver.: change basename to ensure uniqueness binutils-2.21 libbfd-2.21.so hunspell-1.2.12 hunspell-1.2.so.0.0.0 Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 23 / 26

Library Versioning (2/2) Code Inside Actually do SO versioning libx264 libx264.so.115 When not caring about SO ver.: change basename to ensure uniqueness binutils-2.21 libbfd-2.21.so hunspell-1.2.12 hunspell-1.2.so.0.0.0...or combine both libpng-1.2 libpng12.so.0.46.0 libpng-1.4 libpng14.so.14.4.0 glib-2.28.0 libglib-2.0.so.0.2800.0 a a arguably, libglib-2 as a basename would have been enough Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 23 / 26

Further Considerations e 3 Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 24 / 26

Further Considerations e 3 Extract: look for distros build scripts, and build logs of your package build.opensuse.org packages.debian.org Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 24 / 26

Further Considerations e 3 Extract: look for distros build scripts, and build logs of your package build.opensuse.org packages.debian.org Examine: see how they build it, see what workarounds they made CDBS has many architectures new compile errors/warnings OBS: rpmlint and BRP results Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 24 / 26

Further Considerations e 3 Extract: look for distros build scripts, and build logs of your package build.opensuse.org packages.debian.org Examine: see how they build it, see what workarounds they made CDBS has many architectures new compile errors/warnings OBS: rpmlint and BRP results Enhance: merge useful parts preemptively, do not wait for distro to submit Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 24 / 26

Conclusion stick to conventions, make it easy for users if you get patches that turn your Makefile into automake (or something else), do consider it do not be alarmed if someone runs spec-beautifier (or spec-cleaner / obs-service-format_spec_file) Ask if assistance needed: Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 25 / 26

Conclusion User- and distro-friendly packaging Recommendations to upstream tarball providers Jan Engelhardt <jengelh@inai.de> Presented at the opensuse Conference 2011 2011-Sep-11 14 Jan Engelhardt (o.s.c.2011) User- and distro-friendly packaging 2011-Sep-11 14 26 / 26