Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
authorJeremiah Foster <jeremiah@test.maemo.org>
Wed, 29 Jul 2009 01:04:06 +0000 (04:04 +0300)
committerJeremiah Foster <jeremiah@test.maemo.org>
Wed, 29 Jul 2009 01:04:06 +0000 (04:04 +0300)
ability for minimae to analyze binary debs. Not sure what happens in lintian when it
reads a binary deb, I have only come to the place where it "schedules" a package and
I assume it unwinds a data structure into the lab but I have not seen that process
yet.

Also, lintian will not build on this machine since there are conflicts.

lib/Maemian/Schedule.pm
minimae

index 48abecb..e11328a 100644 (file)
@@ -68,12 +68,16 @@ sub add_file {
     return 1;
 }
 
+# add_deb takes the name of a binary deb and the letter "b" as args.
 sub add_deb {
-    my ($self, $type, $file) = @_;
-
-    my $info = get_deb_info($file);
-    return unless defined $info;
-    return $self->add_file($type, $file, %$info);
+  my ($self, $type, $file) = @_;
+
+  my $info = get_deb_info($file);
+# use the following code to peer into the control file of the deb
+#  print map { $_, ": ",
+#    %$info->{$_} . "\n" } keys %$info;
+  return unless defined $info;
+  return $self->add_file($type, $file, %$info);
 }
 
 sub add_dsc {
diff --git a/minimae b/minimae
index 30b9261..26721b6 100755 (executable)
--- a/minimae
+++ b/minimae
@@ -8,6 +8,10 @@
 
 minimae - A small, cuddly version of maemian
 
+=head1 VERSION
+
+This document describes minimae version 0.1
+
 =head1 PURPOSE
 
 Maemian is the maemo version of lintian - a policy checker designed to
@@ -31,6 +35,9 @@ use Pod::Usage;
 use Carp;
 use lib qw(/home/jeremiah/maemian/lib/);
 use Maemian::Output;
+use Maemian::Schedule;
+
+my $LINTIAN_LAB = "/home/jeremiah/maemian/lab";
 
 # --- Command line options
 my $inputfile;                     # --- A file passed on the command line
@@ -47,7 +54,7 @@ GetOptions
 pod2usage() if $help;
 pod2usage() if not $inputfile;
 
-# --- Output settings.
+# --- Output settings
 my $out = new Maemian::Output;
 if ($verbose) {
   $out->verbose(1);
@@ -89,5 +96,17 @@ if ($inputfile) {
   croak "No input file found: $!\n";
 }
 
+my $schedule = new Maemian::Schedule(verbose => $verbose);
+# .deb file?
+if ($inputfile =~ /\.deb$/) {
+  $out->v_msg("Lab is $LINTIAN_LAB");
+
+  # schedule is a hash containing two hashes followed by an array
+  $schedule->add_deb('b', $inputfile)
+    or warning("$inputfile is a zero-byte file, skipping");
+}
+
+
+
 
 1;