CPANPLUS-Dist-Deb

 view release on metacpan or  search on metacpan

lib/CPANPLUS/Dist/Deb.pm  view on Meta::CPAN

Source: $pkg
Section: perl
Priority: optional
Maintainer: $maintainer
Standards-Version: $std_version
Build-Depends: $build_depends
$bdi_line

Architecture: $arch
Package: $pkg
EOF

        ### we might have to print some 'Replaces:' lines
        ### - replace perl core if we were ever part of it
        ### - replaces 'standard' debian module (that may or may not exist)
        ###     if we are built without a prefix
        ### XXX OBSOLETE! since we install completely paralel to existing
        ### moduels, and dont replace any files, Replaces: is no longer
        ### required
#         if ( $self->module_is_supplied_with_perl_core or not $prefix ) {
#             my @printme;
#             
#             $fh->print('Replaces: ');
#             
#             ### so this module is also in perl core, add a rule telling the
#             ### .deb that it's ok to replace stuff from those packages.
#             push @printme, DEB_REPLACE_PERL_CORE
#                 if $self->module_is_supplied_with_perl_core;
# 
#             push @printme, DEB_PACKAGE_NAME->($self) if $prefix;
# 
#             $fh->print( join(', ', @printme), "\n" );
#         }
        
        ### so we have a prefix? best explain what package we are /actually/
        ### providing. Also note the Conflicts
        $contents .= "Provides: " . DEB_PACKAGE_NAME->($self) . "\n" if $prefix;
         
        ### XXX remove 'Conflicts:' -- versioned provides don't work
        ### with dpkg :( so if someone wants 'libfoo-perl > 2.0' it
        ### will be seen as not provided by our libfoo-perl, and 
        ### will propbably uninstall these things... bad bad :(
        #  "Conflicts: ". DEB_PACKAGE_NAME->($self) . "\n") 

        ### description should be mentioned twice: one long one, one
        ### short one... format is as follows:
        ### Description: short desc
        ### long description
    
        $contents .= << "EOF";
Depends: $depends
Description: $desc
 $desc

EOF

        ### run the contents through the callback for munging
        ### make this conditional, as this was introduced in the
        ### dev branch of 0.81_01, so not all may have it (automatically)
        ### installed
        if( $cb->_callbacks->munge_dist_metafile ) {
            $contents = $cb->_callbacks->munge_dist_metafile->( 
                            $cb, $contents 
                        );
        }                        

        $fh->print( $contents );

        $fh->close;
        $dist->status->control( $control );
    }


    ### get all the metadata for compat file and write it ###
    {   my $compat    = DEB_COMPAT->( $dist->status->builddir );

        my $fh;
        unless( $fh = FileHandle->new( ">$compat" ) ) {
            error( loc( "Could not open '%1' for writing: %2",
                        $compat, $! ) );
            $dist->status->prepared(0);
            return;
        }

        ### this is in the sample, but what the hell does it do?
        ### -- it's just the version of the spec files we used
        $fh->print( DEB_SPEC_FILE_VERSION . "\n");
        $fh->close;

        $dist->status->compat( $compat );
    }

    ### get all the metadata for changelog file and write it ###
    {   my $changelog   = DEB_CHANGELOG->( $dist->status->builddir );

        my $fh;
        unless( $fh = FileHandle->new( ">$changelog" ) ) {
            error( loc( "Could not open '%1' for writing: %2",
                        $changelog, $! ) );
            $dist->status->prepared(0);
            return;
        }

        ### XXX this will cause parse errors if the first line doesn't match
        ### if (m/^(\w[-+0-9a-z.]*) \(([^\(\) \t]+)\)((\s+[-0-9a-z]+)+)\;/i) {
        ### (taken from /usr/lib/dpkg/parsechangelog/debian ) which means that
        ### we can not have _ in package names, but dots are fine.

        my $pkg     = DEB_PACKAGE_NAME->($self, $prefix);
        my $version = DEB_VERSION->($self, $deb_version);
        my $urgency = DEB_URGENCY;
        my $email   = $conf->get_conf('email');
        my $who     = __PACKAGE__;

        ### geez timestamps are a b*tch with debian changelogs..
        ### this is the only correct format:
        ### Sun,  3 Jun 2001 20:36:41 +0200
        ### but scalar gmtime says:
        ### Sat Jul  3 14:23:31 2004
        my ($wday, $mon, $day, $time, $year) = split /\s+/, scalar gmtime;
        my $when = sprintf "%s, %2d %s %s %s +0100",
                    $wday, $day, $mon, $year, $time; # crackfueled :(



( run in 3.991 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )