Difference between revisions of "Basic Debian Packaging"

From FreekiWiki
Jump to navigation Jump to search
(made more sub-categories, added terms section)
Line 12: Line 12:
 
* 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===
 +
 +
* 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.
  
 
===topics covered===
 
===topics covered===
====finding software====
+
====prep work====
 +
=====finding software=====
 
* is it already packaged:
 
* is it already packaged:
 
** packages.debian.org
 
** packages.debian.org
Line 22: Line 36:
 
** google.com
 
** google.com
  
====grab and unpack your 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 59: Line 73:
 
** *.init
 
** *.init
 
** *.postinst
 
** *.postinst
 +
** *.postrm
 
* 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
 +
 
 
* magic snippet for a complete debian/rules file:
 
* magic snippet for a complete debian/rules file:
 
  #!/usr/bin/make -f
 
  #!/usr/bin/make -f
Line 69: Line 86:
 
  #include /usr/share/cdbs/1/class/autotools.mk
 
  #include /usr/share/cdbs/1/class/autotools.mk
 
  include /usr/share/cdbs/1/rules/debhelper.mk
 
  include /usr/share/cdbs/1/rules/debhelper.mk
* add cdbs to build-depends or build-depends-indep debian/control
+
 
 +
* look in /usr/share/cdbs/1/class for more source types
  
 
====debuild====
 
====debuild====
 
* commandline arguments: -uc -us
 
* commandline arguments: -uc -us
 +
 
====basic troubleshooting====
 
====basic troubleshooting====
 
* lesspipe
 
* lesspipe

Revision as of 16:55, 24 March 2006

overview

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

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.

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

creating debian directory

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

contents of a debian directory

  • copyright
    • add copyright holder's name and relevent copyright
egrep -ri copyright * | less
  • changelog
    • dch
    • version
    • release
dch -i
  • control
  • rules
  • other files
    • *.install
    • *.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:
#!/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

  • commandline arguments: -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.deb

additional and related topics