Scott Harrison > DPKG-Tools-0.1 > DPKG::Make

Download:
DPKG-Tools-0.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.1   Source  

NAME ^

DPKG::Make - cleanly generate an Debian package (.dpkg)

SYNOPSIS ^

    use DPKG::Make;

    # The "Manifest": list of files that will comprise the software package.
    my @filelist=('tmproot/file1.txt',
                  'tmproot/file2.txt',
                  'tmproot/file3.txt',
                  'tmproot/file4.txt');

    my %doc; my %conf; my %metadata;

    # Define special handling of files.
    $doc{'tmproot/file1.txt'}=1;
    $conf{'tmproot/file2.txt'}=1;

    # Bare minimum metadata (descriptive data of the software package).
    my $pathprefix='tmproot';
    my $tag='test'; # cannot use uppercase characters
    my $version='0.1';
    my $release='1';

    # Highly descriptive metadata.
    %metadata=(
               'vendor'=>'Excellence in Perl Laboratory',
               'summary'=>'a Test Software Package',
               'name'=>$tag,
               'copyrightname'=>'...',
               'group'=>'base',
               'AutoReqProv'=>'no',
               'requires=>[()],
               'email'=>'joe@somewhere.com',
               'description'=>'This package is generated by DPKG::Make. '.
                      'This implements the '.$tag.' software package',
        'pre'=>'echo "You are installing a package built by DPKG::Make; '.
                      'DPKG::Make is available at http://www.cpan.org/."',
               );

    # Temporary "sandbox" (this should not be /tmp because this is deleted!).
    my $buildloc='TempBuildLoc';

    # The "execute" subroutine coordinates all of the DPKG building steps.
    DPKG::Make::execute($tag,$version,$release,$arch,$buildloc,$pathprefix,
                       \@filelist,\%doc,\%conf,
                       \%metadata);

    # You can also build a DPKG in more atomic steps; these three smaller
    # steps are equivalent to the execute command.

    # Step 1: Generate the rpm source location.
    DPKG::Make::dpkgsrc($tag,$version,$release,$arch,$buildloc,$pathprefix,
                      \@filelist,\%doc,\%conf,
                      \%metadata);

    # Step 2: Build the rpm and copy into the invoking directory.
    DPKG::Make::compiledpkg($buildloc,$metadata{'name'},$version,
                          $release,$arch,
                          $currentdir,$invokingdir);

    # Step 3: clean the location used to gather and build the rpm.
    DPKG::Make::cleanbuildloc($buildloc);

SUBROUTINES ^

DPKG::Make::testsystem()

Check to see if DPKG builder application is available

INPUT

n/a

OUTPUT

n/a

ERROR

if necessary commands do not exist (dpkg, debuild, etc), print error and exit

NOTE

To date, this testing action has been fully adequate, though imperfect.

DPKG::Make::execute($tag,$version,$release,$arch,$buildloc,$pathprefix,\@filelist,\%doc,\%conf,\%metadata);

Build the DPKG in one clean sweep.

INPUT

6 scalar strings, 1 array reference, and 3 hash references

OUTPUT

n/a

ERROR

Errors are monitored by the other subroutines that are called.

NOTE

First calls &dpkgsrc, then &compiledpkg, then &cleanbuildloc.

DPKG::Make::dpkgsrc($tag,$version,$release,$arch,$buildloc,$pathprefix,\@filelist,\%doc,\%conf,\%metadata);

Properly assemble the DPKG source location (prior to building).

INPUT

6 scalar strings, 1 array reference, and 3 hash references

OUTPUT

n/a

ERROR

$version, $release, and $buildloc variables need to have a string length greater than zero, else the module causes an exit(1).

$tag must only consist of alphanumeric characters, else the module causes an exit(1). $tag cannot include the underscore '_' character and must be all lowercase.

NOTE

Should be called before &compiledpkg and &cleanbuildloc.

DPKG::Make::compiledpkg($buildloc,$name,$version,$release,$arch,$currentdir,$invokingdir);

Properly assemble the DPKG source location.

INPUT

7 scalar strings

OUTPUT

n/a

ERROR

None captured. debuild warning and exit status is ignored for now... (debuild is stringent about pgp-signing which I do not think is totally necessary).

NOTE

Should be called after &rpmsrc and before &cleanbuildloc.

DPKG::Make::cleanbuildloc($buildloc);

Clean build location - usually TempBuildLoc.

INPUT

1 scalar string

OUTPUT

n/a

ERROR

If the input argument is empty, then abort. Also should abort if cannot remove the location specified by the input argument.

NOTE

Should be called after &dpkgsrc and after &compiledpkg.

DPKG::Make::find_info($file_system_location);

Recursively gather information from a directory

INPUT

1 scalar string

OUTPUT

n/a

ERROR

If $file_system_location is neither a directory, or softlink, or regular file, then abort.

NOTE

Called by &rpmsrc.

DESCRIPTION ^

Automatically generate an dpkg software package from a list of files.

DPKG::Make builds the RPM in a very clean and configurable fashion. (Finally! Making RPMs outside of /usr/src/redhat without a zillion file intermediates left over!)

DPKG::Make generates and then deletes temporary files needed to build an RPM with. It works cleanly and independently from pre-existing directory trees such as /usr/src/redhat/*.

DPKG::Make accepts five kinds of information, three of which are significant:

When using DPKG::Make::execute, a temporary directory named $buildloc is

The DPKG will typically be named "$metadata{'name'}-$version.deb". If $metadata{'name'} is not specified, then $tag is used.

Here are some of the items are generated inside the $buildloc directory during the construction of an Debian package (DPKG):

The final output of DPKG::Make::execute is a binary .deb file (as well as .dsc, .tar.gz, and .changes files). The ./buildloc directory is deleted (along with the ./buildloc/*/debian directory). The typical file name generated by DPKG::Make is $tag-$version.deb.

README ^

Automatically generate a DPKG software package from a list of files.

DPKG::Make builds the Debian package in a very clean and configurable fashion without requiring knowledge of Debian package building internals.

DPKG::Make generates and then deletes temporary files (and binary root directory tree) to build an Debian package with.

So far, this module has been tested on Debian v2.2. It still is not as mature as RPM::Make (see RPM-Tools at www.cpan.org), but is in a basic working condition right now. I need to do more to streamline everything associated with generating a debian package according to the many debian "policies".

PREREQUISITES ^

This script requires the strict module.

AUTHOR ^

 Scott Harrison
 sharrison@users.sourceforge.net

Please let me know how/if you are finding this module useful and any/all suggestions. -Scott

LICENSE ^

Written by Scott Harrison, sharrison@users.sourceforge.net

Copyright Michigan State University Board of Trustees

This file is part of the LearningOnline Network with CAPA (LON-CAPA).

This 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; either version 2 of the License, or (at your option) any later version.

This file 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.

The GNU Public License is available for review at http://www.gnu.org/copyleft/gpl.html.

For information on the LON-CAPA project, please visit http://www.lon-capa.org/.

STATUS ^

This module is new. Its API is similar to RPM::Make which comes from RPM-Tools.

OSNAMES ^

Linux

syntax highlighting: