Recently I've been working on a Debian (and by extension, Ubuntu) package for OpenLP, with lots of help from a friend who is a Debian developer. While I already had a base package thanks to another friend of mine who helped me set up the Ubuntu PPAs for OpenLP, it was old and in need of some updating.
Even though I had fiddled with and tweaked the PPA package, I still didn't really understand how Debian packaging works. One of the resources that helped me understand things was the Debian New Maintainer's Guide. The guide goes through the process of creating a new package, explaining each of the parts of the package, what they should look like, and how to build the package. As it shows each part and each step, it offers helpful examples, as well as links to the relevant parts of Debian packaging policy.
Before you start working on your package, make sure it isn't aready in the process of being packaged by checking the WNPP package in the Debian bug tracker. Once you're sure there isn't already a package in progress, you need to file an ITP - Intend To Package. The easiest way to do this is to use the "reportbug" command, though make sure to configure it first.
One of the key tools in the whole packaging process is a command line tool called lintian. Running lintian on your package will highlight problems and incompatabilities. It is especially useful to run lintian in "pedantic" mode (by using the --pedantic argument), and clean up all the really small things which are not terribly important, but can contribute to causing your package to be rejected.
One of the issues you will come across is the correct attribution of ownership and licensing, through the debian/copyright file. If you have used any code or files which come from somewhere else, you need to make sure you have their copyright in the debian/copyright file.
The debian/copyright file only needs a particular license listed in full once, and the rest of the time you can just refer to the license. Most of the popular licenses are already in Debian, so in most cases you can just reference the license and specify where to find it. Here's an example of a copyright file:
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: OpenLP Upstream-Contact: Raoul Snyman <xxxxxxxxxx@xxxxxx> Source: http://openlp.org/ Files: * Copyright: 2004, Raoul Snyman <xxxxxxxxxx@xxxxxx> and others License: GPL-2 Files: openlp/plugins/remotes/html/jquery.js openlp/plugins/remotes/html/jquery.mobile.js Copyright: 2011, John Resig, 2011, The Dojo Foundation License: Expat or GPL-2 Files: resources/*.png Copyright: 2005, David Vignoni, 2005, Nuno Pinheiro, 2005, Kenneth Wimer, 2005, Johann Ollivier Lapeyre, License: LGPL-2 Files: resources/openlp* resources/about-new.bmp resources/android_app_qr.png resources/images/README.txt resources/images/splash-screen-new.bmp resources/images/wizard_createtheme.bmp resources/images/wizard_exportsong.bmp resources/images/wizard_firsttime.bmp resources/images/wizard_importbible.bmp resources/images/wizard_importsong.bmp Copyright: 2004, Raoul Snyman <xxxxxxxxxx@xxxxxx> and others License: GPL-2 License: GPL-2 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License only. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. License: LGPL-2 On Debian GNU/Linux systems, the complete text of the GNU Library General Public License can be found in `/usr/share/common-licenses/LGPL-2' License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note that paragraphs such as, "You are free to use either the MIT or the GPL" are absent from the copyright file. These paragraphs are unnecessay and do not form part of the actual licenses so they are excluded. As long as the proper attribution and licensing is present, your copyright file should be fine.
Last, but possibly the most important of all, working closely with a Debian developer is important. Without a Debian developer sponsoring your package, it won't get into the repositories. But not only that, the Debian developer will ensure that your package meets the requirements for inclusion into Debian.