Proper way to develop a debian package

News and discussion about development of the Debian OS itself

Proper way to develop a debian package

Postby wirawan0 » 2013-07-02 20:01

What is the proper way to maintain and build upon an already-debianized package? Say, if I want to fork xfce4-power-manager, I can start by downloading the source code in here:

http://packages.debian.org/sid/xfce4-power-manager

(assuming that I have chosen the right release point). Now suppose I want to introduce some modifications in the source code. The build process using `debuild' will complain because there would be some uncommited changes. I see that patches are maintained in a `quilted' way.

I am a bit at lost, having never been introduced to a Debian build system in a nice way. Can someone give me a pointer on how to properly fork and maintain a debian package? Can I use revision control such as Git, and if so, how? There is an upstream thing, then many patches...

WP
wirawan0
 
Posts: 33
Joined: 2011-09-09 15:59

Re: Proper way to develop a debian package

Postby guybertron » 2013-09-27 17:04

I am also interested in modifying and contributing to the development of Debian software.

I am interested in the development environments that would be used to say, work on one specific package.
I like the relative stability of the "testing" distribution on my desktop and would not want to run Sid on a day-to-day basis. At the same time I would like to add enhancements to one or two specific (GUI gnome) packages. Is this sensible?

How would I best set up my development environment so that it could still function as a usable desktop machine? Again, is this sensible?
Do I need VM's, chrooted filesystems etc?

If I work on Debian sources e.g. from Sid, what is the relationship between the Sid version of the package and the e.g. Git repo where the generic (non specific to Debian) sources reside?

Any help would be appreciated! Thanks!
guybertron
 
Posts: 12
Joined: 2009-04-07 23:07

Re: Proper way to develop a debian package

Postby stevepusser » 2013-09-28 04:51

The "orig.tar.gz/bz2/xz" source package is the original upstream source package. Any changes Debian and you make should be in the /debian/patches folder. Assuming you're talking about the new and increasingly popular 3.0 (quilt) source format (there will be a debian.tar.gz source file), the procedure is as follows: (you need to have the packaging tools installed, such as debhelper, fakeroot, and dpkg-dev)

Download the Debian source files.

Extract them with "dpkg-source -x <file-name>.dsc" (use actual name of .dsc file)

This applies whatever patches are in debian/patches and in the "series" file in that folder.

Go ahead and make whatever changes you need to the source. Make changes to fix just one issue for each patch.

Once the changes are made, go back to the root of the extracted source folder and execute

Code: Select all
dpkg-source --commit


This will create a patch with your changes, add it to the series file, and open it in the nano text editor. You will have an opportunity to name your patch and add some description of it to the headers in it. Hit <Ctrl><X> to get out of the editor.

If you want to fix bugs, you should contact the Debian maintainer and contribute patches, or you can join the development team of the upstream package source, or at least contribute patches there, too. The Debian maintainer can also send patches upstream, including yours. Adding new features is best done in the upstream sources, not in Debian, unless it's a Debian native package such as Synaptic.

If you're going to mess around with base system libraries, a separate install or a VM would be safe. If you're just changing userspace applications, a normal install is reasonably safe.
Last edited by stevepusser on 2013-09-28 18:27, edited 1 time in total.
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12057
Joined: 2009-10-06 05:53

Re: Proper way to develop a debian package

Postby Birdy » 2013-09-28 17:04

1) If the upstream source code uses git, you can use git-buildpackage.
An easy explanation is to be found here:
https://wiki.debian.org/Diaspora/Packaging/git
The top level of that wiki.debian.org page is about ruby/diaspora, but might give you further ideas anyway (mainly "basic quilt" might be of interest).

2) If you ask for a sponsor (RFS) you will need a git repo somehwere. Say temporary at gitorious. Post the link to your git repo in the RFS, so people can git-import it and check for errors). Also use https://mentors.debian.net/

3) Try to get in touch with a team (in your example above with the xfce4 team). http://pkg-xfce.alioth.debian.org/
I think that is really the most important step. They will help you with the (quite complex) details. Hopefully (but usually really yes. If people realize you are serious, then you sure will get friendly help).
You can also ask in IRC oftc.irc.net channel #debian-mentors (make sure you are prepared well if you ask here. You might run into rtfm answers if the questions are not good).

4) In general debian communication is more in mailing lists or in irc channels, not in forums.

5) The http://www.debian.org/doc/manuals/maint ... rt.en.html will give you a short overview (say patches) and is easy to follow. It will miss more confusing stuff like git. I wouldn't worry that much about the developers-reference yet (glance over it, but it _is_ huge and confusing) -instead i would follow the advice of my mentors or of my team (learn one thing at a time).

The above are very loose hints. From the top of my head. Sorry if it's pointless (and it might also be wrong).
Birdy
 
Posts: 358
Joined: 2013-05-28 13:26

Re: Proper way to develop a debian package

Postby Birdy » 2013-09-28 17:09

Before you ask for a Sponsor make sure it is lintian clean and make sure it builds with pbuilder (to check it the dependencies are correct).
Birdy
 
Posts: 358
Joined: 2013-05-28 13:26

Re: Proper way to develop a debian package

Postby guybertron » 2013-09-30 11:37

Thanks to all for the valuable information!
The package management system is obviously a massive boon for all general Debian users, but an extra hurdle for a noob developer to get their head around!
I suppose you can't have a system optimized for both ease of everyday use and ease of development.

I think to some extent it kind of puts you off having a tinker with the source code, as it (package management) seems such a large overhead to get started with!
guybertron
 
Posts: 12
Joined: 2009-04-07 23:07

Re: Proper way to develop a debian package

Postby stevepusser » 2013-09-30 15:40

guybertron wrote:Thanks to all for the valuable information!
The package management system is obviously a massive boon for all general Debian users, but an extra hurdle for a noob developer to get their head around!
I suppose you can't have a system optimized for both ease of everyday use and ease of development.

I think to some extent it kind of puts you off having a tinker with the source code, as it (package management) seems such a large overhead to get started with!


It's not really difficult once you do it a few times. And it's a great idea to keep the original source code tarball untouched, and make any changes only from the patches. No sneaky malware or anything can get in.

It used to be a lot harder to create patches from scratch for a non-developer like me, but the new source format makes it easy.
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12057
Joined: 2009-10-06 05:53


Return to Debian Development

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable