Monday, 22 June 2009

Releases

I have built a repository for testing purposes that you are invited to use if you are sufficiently brave.

To use the repository, add

deb http://skinny.tuxfamily.org/skinny-testrep/ binary/ 

to your /etc/apt/sources.list and update apt or aptitude or do a reload in synaptic. Then look for entries under skinny.

Note that because I am not using digital signing (yet?), apt,aptitude, synaptic, etc. will warn you that the skinny packages cannot be authenticated. The risk in installing these unauthenticated packages is no greater than the risk of installing a tar or other package that you may download off the Web. But if you are feeling extra cautious, you can download the packages only (without installing) then inspect the code manually to verify that there hasn’t been a third-party interception.

RFC 822-conformant dates with Geany

Debian changelogs must include the date in RFC 822 format. The strftime format string I am using with Geany to produce such a date is “%a, %d %b %Y %H:%M:%S %z”. This probably only works in GNU. See strftime manpages.

Sunday, 21 June 2009

Debian packaging workflow 2

Update (2009-06-25): I have moved this workflow to a static page. What appears below should be considered obsolete.

I have made some refinements to the SkinnyDebbie packaging workflow.

File Structure

{package-root}

{package-root} is {someplace-convenient}/{package-name}, where {package-name} is the name of the package without version or platform info. For example, if {package-name} is foobar, {package-root} might be:

/home/mithat/package-dev/foobar

The {package-root} structure

+ {package-root}
    + debian
        + DEBIAN
            control
            postinst
            prerm
            [other-control-files]
        + {mirror-of-file-system-with-binaries-etc}
    + docs
        + man
            + man[1-9] ...
        changelog.Debian
        copyright
    build.sh

Descriptions

{package-root}/debian

This is just a wrapper for the whole shebang. This structure (with DEBIAN and {mirror-of-file-system-with-binaries-etc} directories inside) attempts to be consistent with the regular Debian build process.

{package-root}/docs

Contains documentation in a centralized location to make it easier to maintain. The stuff here is copied into {package-root}/debian as needed by build.sh (see below).

{package-root}/docs/man

Man files for the package go here in plaintext. /docs/man/man1 has {whatever}.1 man files, /docs/man/man8 has {whatever}.8 man files, etc. Man files are required by Debian policy for anything in /usr/bin or /usr/sbin.

{package-root}/docs/changelog.Debian

Changelog for the release in plaintext, formatted according to Debian policy requirements. According to my reading of the official Debian policy, this file should actually be called “changelog” since the upstream and package maintainers are the same and therefore share a changelog, but I can’t get a clean lintian check whithout naming the the version that appears in the final package “changelog.Debian.gz”. The changelog file is required by Debian policy.

{package-root}/docs/copyright

Copyright info in plaintext, formatted according to Debian policy requirements. The copyright file is required by Debian policy.

{package-root}/build.sh

The big fun. The file build.sh does the actual building of the package. It will copy over the documentation files (above) into the right places in the right form in /debian/DEBIAN/{mirror-of-file-system-with-binaries-etc} and then make the package. Note that by using fakeroot the package files can be owned and the build executed by user. In other words, sudo is not required.

A copy of build.sh used to make the skinny-xdm-beautify can be had here. In its present form, you will have to hand-tweak the PACKAGENAME variable as well as the names and places of the manpages.

The process

1 ) Build the package:

cd {package-root}
./build.sh

2 ) Test the package:

lintian {name-of-package-file}

Example:

lintian foobar_0.9.0-2_all.deb

3 ) Copy the new package to {local-repository}/binary and delete the old version.

4 ) Recreate the Packages.gz file for the repository. Example:

cd {local-repository}
dpkg-scanpackages binary /dev/null | gzip -9c >> binary/Packages.gz

5 ) Upload/sync changes to the online repository. Example:

<TBD>

Wednesday, 17 June 2009

A Debian packaging workflow

The workflow I used earlier to generate the test package was:

1 ) Develop the scripts/binaries/whatever.

2 ) Create a directory {package-name} that has the following structure (where + indicates a directory):

+{package-name}
    +DEBIAN
        control
        postinst
        prerm
    +{mirror-of-file-system-with-binaries-etc}

3 ) Make sure the package files are owned by root:

sudo chown root:root -R {package-name}

4 ) Create a package with:

sudo dpkg -b {package-name} {package-name}_{major.minor.version}-{debian-package-version}_{all|{platform}}.deb

Example:

sudo dpkg -b foobar foobar_0.9.0-2_all.deb

5 ) Test package with lintian:

lintian {package-name}_{major.minor.version}-{debian-package-version}_{all|{platform}}.deb

Example:

lintian foobar_0.9.0-2_all.deb

6 ) Copy package to {repository}/binary and delete old version (You don’t need to be root to do this.)

7 ) Recreate Packages.gz for repository:

cd {repository}
dpkg-scanpackages binary /dev/null | gzip -9c >> binary/Packages.gz

8 ) Upload/sync changes to online repository.

Note: I am using {} in place of angled brackets because Flatpress is making angled brackets difficult.

Tuesday, 16 June 2009

Package and repository success

Tonight I successfully created a simple package (with only one linitian error!) and created a Web-based repository for it. I also updated the package, uploaded it to the repository, and voila! automagically apt picked up the fact that the package had been updated.

While I am still finding packaging, package management and the FHS slow going, I feel like I am making progress.

Sites that were particularly useful in setting up the repository are this one, this one, and this one.

Update: this one seems pretty useful as well

I am still wondering if deb packages are really the best way to distribute Skinny. But at least I know I can make it work.