There are many ways to do packaging for Debian/Ubuntu. This guide provides one simple way to package new applications to meet the ARB guidelines. For more complete details on Debian/Ubuntu packaging, we suggest reading the Ubuntu Packaging Guide. Depending on what kind of app you're submitting, you may also want to read our tips for Makefiles, Python apps, or Unity Lenses.

Create the Package Files

The dh_make utility is a quick way to start up a new package. (If you don't have it installed yet, just run sudo apt-get install dh-make.) Change into the top-level directory for your source code and run dh_make.

  cd myappdir
  dh_make --native --packagename=myapp_0.1 --copyright=gpl3 

When it asks for the "Type of package":

Review the summary it gives you, and then <Enter> to confirm.

Running dh_make will create a directory myappdir/debian, with a bunch of packaging files. Most of these files are just templates you won't need, so start by cleaning up unnecessary files with:

  cd debian
  rm *.ex *.EX README* docs

This will leave you with six files in the debian/ directory: changelog, compat, control, copyright, rules, and source/format.

DEBFULLNAME and DEBEMAIL

If dh_make has any trouble figuring out your name or email, set the DEBFULLNAME and DEBEMAIL environment variables:

  export DEBFULLNAME="My Name"
  export DEBEMAIL=myname@example.com

Edit the Package Files

The compat file will contain a single number "8", and doesn't need any changes. The source/format file will contain a simple string "3.0 (native)", and doesn't need any changes. The other files will need some small changes. You will also need to add a .desktop file.

changelog file

The finished file will look something like:

myapp (0.1-0extras11.10.1) oneiric; urgency=low

  * Initial Release.

 -- My Name <myname@example.com>  Sun, 01 Apr 2012 13:20:56 -0700

The finished file will look something like:

Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: myapp
Source: <https://code.launchpad.net/~myname/+junk/extras-myapp-oneiric>

Files: *
Copyright: 2011-2012 My Name <myname@example.com>
License: GPL-3.0+

License: GPL-3.0+
 This program is free software...

control file

The finished file will look something like:

Source: myapp
Section: utils
Priority: extra
Maintainer: My Name <myname@example.com>
Build-Depends: debhelper (>= 8.0.0), some-other-package
Standards-Version: 3.9.2
Homepage: http://myapp.example.com

Package: myapp
Architecture: all
Depends: ${misc:Depends}, some-other-package
Description: Short description
 Longer description, giving some details about what this
 app is for, and why someone might want to download it.
 
 Don't forget to indent each line of the long description
 with a space.

rules file

The finished file will look something like:

 #!/usr/bin/make -f

 %:
        dh $@

 override_dh_auto_install:
        dh_auto_install -- PREFIX=/opt/extras.ubuntu.com/myapp

extras-myapp.desktop file

Add a file named extras-<appname>.desktop to the top-level directory of your app.

The finished file will look something like:

[Desktop Entry]
Version=0.1
Type=Application
Terminal=false
Exec=/opt/extras.ubuntu.com/myapp/bin/myapp
Icon=/opt/extras.ubuntu.com/myapp/icons/myapp.svg
Name=My App
Comment=Short description
Categories=Utility

Build the Package

Change back to the top-level directory for your app. Try building your package with the command debuild. You may have to debug a few errors, and if you need any guidance along the way, feel free to ask us questions at app-review-board@lists.ubuntu.com.

Once you have the package build working with no errors, you can build a source package with debuild -S and then upload it to your PPA.

AppReviewBoard/Submissions/PackageQuickStart (last edited 2012-07-30 15:26:04 by 71-212-50-192)