Skip to content
Snippets Groups Projects
Commit d72b4304 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

debian package building (or hacking)

parent a460867f
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
echo 'increment the version number, when necessary!'
epoch=0
version=0.1-1
pkgdir=tmp/stage/libgg-aix-pm-perl/$epoch/$version
scripts/pmlnk.pm --copy --target $pkgdir/data/usr/share/perl5 .
mkdir $pkgdir/control
cp debian/control $pkgdir/control
cp debian/debian-binary $pkgdir
scripts/mkdeb.pl $pkgdir
Package: libgg-aix-pm-perl
Version: 0.1-1
Architecture: all
Maintainer: Gerhard Gonter <ggonter@gmail.com>
Original-Maintainer: Gerhard Gonter <ggonter@gmail.com>
Installed-Size: 629
Depends: perl
Section: perl
Priority: optional
Homepage: http://aix-pm.sourceforge.net/
Description: Perl modules from the aix-pm collection
The AIX:: name space plus more. Perl modules that deal with AIX specific
issues. A slowly evolving EMC CLARiiON monitoring tool belongs to the
"plus more" part.
2.0
......@@ -2,6 +2,9 @@
use strict;
use Data::Dumper;
$Data::Dumper::Indent= 1;
my $pkg_base= $ENV{PKGBASE} || '~/tmp/pkg';
while (my $arg= shift (@ARGV))
......@@ -36,17 +39,26 @@ sub mk_package
my $pkg_name= shift;
my $pkg_epoch= shift;
my $pkg_version= shift;
my $deb= '../../../'. $pkg_name . '-';
$deb .= $pkg_epoch.':' if ($pkg_epoch > 0);
$deb .= $pkg_version .'.deb';
print __LINE__, " deb=[$deb]\n";
my $pkg_arch= shift;
chdir($base) or die "base not found [$base]";
chdir($pkg_name) or die "pkg_name not found [$pkg_name]";
chdir($pkg_epoch) or die "pkg_epoch not found [$pkg_epoch]";
chdir($pkg_version) or die "pkg_version not found [$pkg_version]";
my $ctrl= Debian::Package::Control->read_control_file ('control/control');
print __LINE__, " ctrl: ", Dumper($ctrl);
unless (defined ($pkg_arch))
{
$pkg_arch= $ctrl->{fields}->{Architecture}->{value} || 'all';
}
my $deb= '../../../'. $pkg_name . '_';
# my $deb= $pkg_name . '-';
$deb .= $pkg_epoch.':' if ($pkg_epoch > 0);
$deb .= $pkg_version . '_' . $pkg_arch .'.deb';
print __LINE__, " deb=[$deb]\n";
# mk_md5sums();
unlink('control.tar.xz');
unlink('data.tar.xz');
......@@ -57,7 +69,8 @@ sub mk_package
cmd(qw(xz -zv control.tar data.tar));
# the ar file must contain these fils in this order
# the ar file must contain these fils in this order and should be wiped before
unlink($deb);
cmd('ar', 'rcSv', $deb, 'debian-binary');
cmd('ar', 'rcSv', $deb, 'control.tar.xz');
cmd('ar', 'rcSv', $deb, 'data.tar.xz');
......@@ -78,3 +91,50 @@ sub mk_md5sums
# chdir('..');
}
package Debian::Package::Control;
sub read_control_file
{
my $class= shift;
my $fnm= shift;
open (FI, '<:utf8', $fnm) or die "can't read control file [$fnm]";
my @segments;
my $segment;
my %fields;
while (<FI>)
{
chop;
print __LINE__, " l=[$_] segment=[$segment]\n";
if ($_ =~ m/^#/)
{
if (defined ($segment) && $segment->{type} eq 'comment')
{
push (@{$segment->{lines}} => $_);
}
else
{
$segment= { type => 'comment', lines => [ $_ ] };
push (@segments, $segment);
}
}
elsif ($_ =~ m#^ #)
{
die 'invalid continuation' unless (defined ($segment));
push (@{$segment->{lines}} => $_);
}
elsif ($_ =~ m#^([A-Z][\w\-_]+): *(.+)#)
{
my ($field, $value)= ($1, $2);
print __LINE__, " field=[$field] value=[$value]\n";
$segment= { type => 'field', field => $field, value => $value, lines => [ $_ ] };
push (@segments, $segment);
$fields{$field}= $segment;
}
}
close(FI);
my $res= { fields => \%fields, segments => \@segments };
bless ($res, $class);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment