Difference between revisions of "Basic Debian Packaging"

From FreekiWiki
Jump to navigation Jump to search
m (→‎prerequisites: simplified prereqs)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
===overview===
+
This class is not currently offered. [[User:Laurel|Laurel]] 21:32, 31 July 2010 (UTC)
this class should give a basic understanding of how to build a debian package from some common types of source tarballs or repositories, with the assistance of several helper utilities.
 
  
===background===
+
The Basic Debian Packaging class should give a basic understanding of how to build a debian package from some common types of source tarballs or repositories, with the assistance of several helper utilities.
====prerequisites====
+
 
 +
==background==
 +
===prerequisites===
 
* basic familiarity with [[Basic_Linux_Command_Line_for_Builders|commandline]] and [[Command Line 2]]
 
* basic familiarity with [[Basic_Linux_Command_Line_for_Builders|commandline]] and [[Command Line 2]]
 
* basic familiarity with [[Where_Is_Everything|linux]]
 
* basic familiarity with [[Where_Is_Everything|linux]]
Line 9: Line 10:
 
* familiarity with a text editor
 
* familiarity with a text editor
  
====suggested background====
+
===suggested background===
 
* rudimentary understanding of building and compiling software
 
* rudimentary understanding of building and compiling software
 
* basic understanding of cvs or subversion
 
* basic understanding of cvs or subversion
  
===terms===
+
==terms==
 
* upstream
 
* upstream
 
the source of the software- the originating author, the current development team
 
the source of the software- the originating author, the current development team
Line 25: Line 26:
 
the directory in which the source code is unpacked.
 
the directory in which the source code is unpacked.
  
===tips for working environment===
+
==tips for working environment==
 
* keep a web browser pointed to this page
 
* keep a web browser pointed to this page
 
* open several terminal windows
 
* open several terminal windows
Line 36: Line 37:
 
** keep hitting tab!
 
** keep hitting tab!
  
===topics covered===
+
==topics covered==
====prep work====
+
===prep work===
=====finding software=====
+
====finding software====
 
* is it already packaged:
 
* is it already packaged:
 
** packages.debian.org
 
** packages.debian.org
Line 46: Line 47:
 
** google.com
 
** google.com
  
=====grab and unpack a tarball=====
+
====grab and unpack a tarball====
 
* gnu hello:
 
* gnu hello:
 
  wget http://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz
 
  wget http://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz
 
  tar xvzf hello-2.1.1.tar.gz
 
  tar xvzf hello-2.1.1.tar.gz
  
=====environment variables=====
+
====environment variables====
 
* DEBEMAIL
 
* DEBEMAIL
 
* DEBFULLNAME
 
* DEBFULLNAME
Line 61: Line 62:
 
  export DEBEMAIL DEBFULLNAME EDITOR
 
  export DEBEMAIL DEBFULLNAME EDITOR
  
====the debian directory====
+
===the debian directory===
=====creating the debian directory=====
+
====creating the debian directory====
 
* using dh_make (package dh-make)
 
* using dh_make (package dh-make)
 
  dh_make -s -c gpl
 
  dh_make -s -c gpl
* dh-make-perl
+
* dh-make-perl for packaging perl modules
  
=====contents of a debian directory=====
+
====contents of a debian directory====
 
* copyright
 
* copyright
 
** add copyright holder's name and relevent copyright
 
** add copyright holder's name and relevent copyright
 
  egrep -ri copyright * | less
 
  egrep -ri copyright * | less
 
* changelog
 
* changelog
** dch
+
** dch (a.k.a. debchange, part of the devscripts package)
 
** version
 
** version
 
** release
 
** release
 
  dch -i
 
  dch -i
* control
+
'''This is the most important section, and the part that's least susceptible to manpages.'''
* rules
+
* control - what packages are being made, what dependencies there are, who made them, and descriptions
* other files
+
* rules - the file that controls the build process
** *.install
+
* other files (note that these may not be needed for a proper makefile-based source package)
 +
** *.install - in here, put all the files you want installed, first their location in the tree, then a space, then their location in the filesystem, but leave off the root / at the beginning.
 
** *.manpages
 
** *.manpages
 
** *.examples
 
** *.examples
Line 87: Line 89:
 
* other examples: *.ex and *.EX files
 
* other examples: *.ex and *.EX files
  
====cdbs basics====
+
===cdbs basics===
 
* add cdbs to build-depends or build-depends-indep debian/control
 
* add cdbs to build-depends or build-depends-indep debian/control
  
* magic snippet for a complete debian/rules file:
+
* magic snippet for a complete debian/rules file (i.e. replace rules with the following lines):
 
  #!/usr/bin/make -f
 
  #!/usr/bin/make -f
 
  # uncomment the next line if using a makefile-based source
 
  # uncomment the next line if using a makefile-based source
Line 100: Line 102:
 
* look in /usr/share/cdbs/1/class for more source types
 
* look in /usr/share/cdbs/1/class for more source types
  
====debuild====
+
===debuild===
 
* without gpg keys:
 
* without gpg keys:
 
  debuild -uc -us
 
  debuild -uc -us
  
====basic troubleshooting====
+
===basic troubleshooting===
 
* lesspipe
 
* lesspipe
 
  lesspipe ../hello_2.1.1_i386.deb | less
 
  lesspipe ../hello_2.1.1_i386.deb | less
Line 112: Line 114:
 
** pbuilder/sbuild
 
** pbuilder/sbuild
  
====lintian====
+
===lintian===
 
* debian policy checker
 
* debian policy checker
  lintian -i ../hello_2.1.1_i386.deb
+
  lintian -i ../hello_2.1.1_i386.changes
  
===additional and related topics===
+
==additional and related topics==
 
* [[Debian Package Repositories]]
 
* [[Debian Package Repositories]]
 
* gnupg-signed packages
 
* gnupg-signed packages
 +
* http://wiki.debian.org/HowToPackageForDebian
 
* https://wiki.ubuntu.com/HowToBuildDebianPackagesFromScratch
 
* https://wiki.ubuntu.com/HowToBuildDebianPackagesFromScratch
* http://women.alioth.debian.org/wiki/index.php/English/BuildingWithoutHelper
+
* http://women.debian.org/wiki/English/BuildingWithoutHelper
 
* [http://www.debian.org/doc/maint-guide/index.en.html Debian New Maintainers' Guide]
 
* [http://www.debian.org/doc/maint-guide/index.en.html Debian New Maintainers' Guide]
 
* [http://www.debian.org/doc/debian-policy/ Debian Policy]  
 
* [http://www.debian.org/doc/debian-policy/ Debian Policy]  

Latest revision as of 13:33, 31 July 2010

This class is not currently offered. Laurel 21:32, 31 July 2010 (UTC)

The Basic Debian Packaging class should give a basic understanding of how to build a debian package from some common types of source tarballs or repositories, with the assistance of several helper utilities.

background

prerequisites

suggested background

  • rudimentary understanding of building and compiling software
  • basic understanding of cvs or subversion

terms

  • upstream

the source of the software- the originating author, the current development team

  • downstream

the packager of software- a debian maintainer

most of ubuntu's software comes directly from debian, so debian would be considered upstream to ubuntu. most of debian's packages come from other projects, such as GNU, Linux, KDE and GNOME, which would be considered upstream to debian.

  • top level of source directory

the directory in which the source code is unpacked.

tips for working environment

  • keep a web browser pointed to this page
  • open several terminal windows
  • don't forget to use the "man" command, or -h and --help
  • commandline reminders
    • remember to use tab completion.
    • hit tab twice, fast.
    • hit tab again!
    • remember to use the up arrow to re-do a previous command
    • keep hitting tab!

topics covered

prep work

finding software

  • is it already packaged:
    • packages.debian.org
  • other sources of software:
    • freshmeat.net
    • sourceforge.net
    • google.com

grab and unpack a tarball

  • gnu hello:
wget http://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz
tar xvzf hello-2.1.1.tar.gz

environment variables

  • DEBEMAIL
  • DEBFULLNAME
  • EDITOR
DEBEMAIL=yourname@example.com 
EDITOR=nano
DEBFULLNAME="Your Name Here"
export DEBEMAIL DEBFULLNAME EDITOR

the debian directory

creating the debian directory

  • using dh_make (package dh-make)
dh_make -s -c gpl
  • dh-make-perl for packaging perl modules

contents of a debian directory

  • copyright
    • add copyright holder's name and relevent copyright
egrep -ri copyright * | less
  • changelog
    • dch (a.k.a. debchange, part of the devscripts package)
    • version
    • release
dch -i

This is the most important section, and the part that's least susceptible to manpages.

  • control - what packages are being made, what dependencies there are, who made them, and descriptions
  • rules - the file that controls the build process
  • other files (note that these may not be needed for a proper makefile-based source package)
    • *.install - in here, put all the files you want installed, first their location in the tree, then a space, then their location in the filesystem, but leave off the root / at the beginning.
    • *.manpages
    • *.examples
    • *.init
    • *.postinst
    • *.postrm
  • other examples: *.ex and *.EX files

cdbs basics

  • add cdbs to build-depends or build-depends-indep debian/control
  • magic snippet for a complete debian/rules file (i.e. replace rules with the following lines):
#!/usr/bin/make -f
# uncomment the next line if using a makefile-based source
#include /usr/share/cdbs/1/class/makefile.mk
# uncomment the next line if using a autotools-based source
#include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
  • look in /usr/share/cdbs/1/class for more source types

debuild

  • without gpg keys:
debuild -uc -us

basic troubleshooting

  • lesspipe
lesspipe ../hello_2.1.1_i386.deb | less
  • build dependencies
  • package dependencies
    • install in a clean debian base-install
    • pbuilder/sbuild

lintian

  • debian policy checker
lintian -i ../hello_2.1.1_i386.changes

additional and related topics