1 April 2, Software Packaging and Releasing Best Practices William Cohen NCSU CSC 591W April 2, 2008
2 2 Source Tarball ● Tag to check out source for release from code repository ● All files in tarball should in code repository: ● No locally created files in tarball ● Tarball creates single directory with everything inside single directory ● Tarball name matches directory created, e.g. oprofile tar.gz creat directory oprofile ● Use compression, text files in source compress well
3 April 2, Source Tarball Contents ● Clear license information ● Install: ● List requirement for building software ● Instructions to build ● Readme: ● Pointer to project page for additional information and help ● Complete source code: ● Okay to depend on other projects ● Avoid putting copies of other project's source files into code
4 April 2, Source Building ● Describe in the INSTALL file ● Keep it simple: ●./configure – setup options ● make – build the software ● make install – places software in proper locations ● Configure, build and install are separate steps ● Only the install should need root privileges ● Do not hard code location of build and install destination
5 April 2, Distribution Packaging
6 April 2, Naming ● Names of source rpm and generated rpms should match up ● May have subpackages, for example gcc-c ● Dash '-' used to delimit parts of NVR ● Unique names, each name identifies a single package ● Version numbering so upgrades work properly: ● Snapshot, alpha, beta, and release candidates: ● kernel rc7 becomes kernel rc7
7 April 2, Summary and Description ● Summary field provides one line description of what package is ● Description field provides a paragraph ● Keep the lines less than 80 characters in length ● For more detailed information people should refer to th documentation
8 April 2, URL, Source, and Patches ● URL: entry ● Points to the project page ● Verify correct and up to date ● Source: entry ● Points to location for pristine source ● Verify correct an up to date ● Use patches for any modifications on source ● Patch n : entries ● Patches to apply to pristine source
9 April 2, Licensing ● RPM License: entry ● Reference to the license of the resulting binary RPM ● Make sure that the field is accurate ● List of concise names for licenses: ●
10 April 2, Avoid Binaries or Libraries in Source RPM ● Security Issues: ● Cannot check the security of a binary ● Cannot generate patches for a binary ● Compiler: ● Code compile with specific flags, e.g. Fortify option ● ABI and library changes ● Possible exceptions: ● Cross compiled code ● Firmware
11 April 2, Changelogs ● Describe what has changed in the rpm ● Include the version information so easy to know which build has change ● Include what specific bugs fixed
12 April 2, Static Libraries ● Avoid static libraries ● Cannot determine which packages use static library ● When correction made in static library do not know what other packages need to be rebuild ● Use shared libraries instead, automatic use of new and improved code
13 April 2, Dependencies ● State the dependencies required to build package builds and for package to operates properly ● Used by build systems to set up build environment ● BuildRequires: ● Things needed when the binary rpm built from srpm ● With autoconfig can have things in the binary rpm differ depending on build environment ● Requires: ● Things needed for binary rpm ● RPM figures out dependencies on shared libraries when building
14 April 2, Documentation ● Not everyone needs/wants the documentation ● Consider putting documentation into subpackage if very large
15 April 2, Desktop/GUI Applications ● Do not want to start via command line ● Need to have icon and entry so menu item available
16 April 2, Packaging Sanity Checks ● Compare with earlier packaging ● Files: ● Ownership and permissions ● Size ● Added, deleted, or moved ● Proper requires/provides
17 April 2, Building the RPM ● Avoid building rpms as root ● Use the rpm macro (~/.rpmmacros): %home %(echo $HOME) %_topdir %{home}/rh-rpms
18 April 2, Rpmlint ● Handy script to look for possible problems
19 April 2, Further Reading ● ● ● guidelines.html guidelines.html ●