<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gareth Jones &#187; packaging</title>
	<atom:link href="http://blog.garethj.com/tag/packaging/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.garethj.com</link>
	<description></description>
	<lastBuildDate>Mon, 09 Aug 2010 10:35:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Building .deb packages for Python applications</title>
		<link>http://blog.garethj.com/2009/06/building-deb-packages-for-python-applications/</link>
		<comments>http://blog.garethj.com/2009/06/building-deb-packages-for-python-applications/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 15:29:00 +0000</pubDate>
		<dc:creator>gareth</dc:creator>
				<category><![CDATA[techy solutions]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[deb]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[packaging]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.garethj.com/?p=132</guid>
		<description><![CDATA[Building .deb packages for Python applications Recently I wanted to build a .deb package for an internal IBM application I was writing so that users could easily install it and also so we could distribute them through some internal repositories. &#8230; <a href="http://blog.garethj.com/2009/06/building-deb-packages-for-python-applications/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Building .deb packages for Python applications</p>
<p>Recently I wanted to build a .deb package for an internal IBM application I was writing so that users could easily install it and also so we could distribute them through some internal repositories. This proved a bit harder than I expected so this is a quick summary of how I ended up doing it. Note that your requirements might be entirely different!</p>
<p>The first thing to do is to create the files required by the packaging process. I discovered that the <code>dh_make</code> command can create a load of sample files that can be used as part of this process. To do this, create a directory in the format [package-name]-[version] (e.g. my-great-app-1.0) and run <code>dh_make</code> from within it (I specified &#8216;s&#8217; for single binary when prompted). This will create a load of sample files in a &#8216;debian&#8217; subdirectory. Delete any of these you don&#8217;t need (which is probably most of them); I kept the following:</p>
<ul>
<li><strong>changelog</strong> &#8211; change history for all versions of the app (keep to the <a href="http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog">format specified by the Debian Policy Manual</a>)</li>
<li><strong>compat</strong> &#8211; no idea why I needed this but things don&#8217;t work properly later if I don&#8217;t</li>
<li><strong>control</strong> &#8211; the details of the package you are creating (see <a href="http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles">the specification</a> for all configuration options)</li>
<li><strong>dirs</strong> &#8211; the list of directories in which your app will install files (e.g. /usr/bin, /usr/share/pyshared/my-great-app, /usr/share/applications)</li>
<li><strong>README.Debian</strong> &#8211; the README for your app</li>
<li><strong>rules</strong> &#8211; a MakeFile with instructions for how to create the package (for my Python app the important bit here was in the &#8216;install&#8217; section; here I created a <code>$(CURDIR)/debian/my-great-app</code> subdirectory and copied all files into it as if it were <code>/</code>, e.g. binary to <code>$(CURDIR)/debian/my-great-app/usr/bin/my-great-app</code>)</li>
</ul>
<p>Once I&#8217;d created all those files and put them in <code>my-great-app/packaging/debian</code> and my source in <code>my-great-app/src</code> I created a simple build script <code>my-great-app/bin/build</code>. This looked something like the following:</p>
<p><code><br />
#!/bin/bash</p>
<p>export VERSION=1.0<br />
export DEBFULLNAME="Gareth Jones"<br />
export DEBEMAIL="my-real-email-not-this@somewhere.com"</p>
<p>cd ../build<br />
sudo rm -rf my-great-app*<br />
mkdir -p my-great-app-$VERSION<br />
cp -u ../src/*.py ../src/*.desktop ../src/*.ico ../packaging/my-great-app my-great-app-$VERSION<br />
tar -czf my-great-app-$VERSION.orig.tar.gz my-great-app-$VERSION/<br />
cd my-great-app-$VERSION<br />
mkdir debian<br />
cp -u ../../packaging/debian/* debian/<br />
gksu dpkg-buildpackage<br />
</code></p>
<p>This should create you a <code>my-great-app_1.0-1_all.deb</code> and the <code>my-great-app_1.0-1_i386.changes</code>, <code>my-great-app_1.0-1.dsc</code> and <code>my-great-app_1.0-1.tar.gz</code> files your repository maintainer might want.</p>
<p>A really useful video I found for helping me fill in the contents of the debian control files (and getting me through the whole process) was <a href="http://wiki.showmedo.com/index.php/LinuxJensMakingDeb">here</a>. Definitely worth checking out if you need to do this yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.garethj.com/2009/06/building-deb-packages-for-python-applications/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
