[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Debian package creation scripts


In order to easily build Debian packages, I wrote a script called mkdeb.  I
use it for projects where I am upstream, to make a package without doing a
release first (this is just for testing, when I build an official package I
use a real release as orig.tar.gz).  It's a fairly simple script, which
creates an orig.tar.gz from the current directory, and calls debuild using it.

I also made a new version of it which renames the package to -dbg and builds
the package with debugging symbols.  This works for the few packages I tested,
but probably not for all, as changing the package name has quite some

Anyway, the question I have about this:  Is something like this useful for
others?  Is it worth putting it in a Debian package, for example?  I find it
very useful, and feel that it is missing from the current helper scripts.  Or
did I just duplicate some effort? :-)

Since the scripts aren't very large, I included the non-debug version as an

Bas Wijnen

I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see

if [ ! -d debian ] ; then
	echo >&2 "No debian directory found.  Aborting."
	exit 1

# first check for cvs conflict files, otherwise you'll be notified by lintian,
# which is very late.
cvs_conflict_files="`find . -name '.#*'`"
if [ "$cvs_conflict_files" ] ; then
	echo >&2 "You still have cvs conflict files in your directory:"
	for i in $cvs_conflict_files ; do echo $i ; done
	exit 1

name="$(basename "$(pwd)")"
debversion="$(head -n 1 debian/changelog | cut -f2 -d\( | cut -f1 -d\) )"
echo name=$name, version=$version

temp="`mktemp -d "$dir/mkdeb.XXXXXX"`"
mkdir "$temp/$name-$version.orig"
tar -czf - . | tar -C "$temp/$name-$version.orig" -xzf -
find "$temp" -name CVS | xargs rm -rf
pushd . >/dev/null
cd "$temp/$name-$version.orig"
fakeroot debian/rules clean
rm -rf "$temp/$name-$version.orig/debian"
tar -C "$temp" -czf "$dir/${name}_$version.orig.tar.gz" "$name-$version.orig"
rm -rf "$temp"

rm -rf "$dir/$name-$version"
mkdir "$dir/$name-$version"
tar -czf - . | tar -C "$dir/$name-$version" -xzf -
find "$dir/$name-$version" -name CVS | xargs rm -rf

cd "$dir/$name-$version"
debuild "$@"

Attachment: signature.asc
Description: Digital signature

Reply to: