[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, infra-513663, updated. 2.4.3-137-g510aa4f



The following commit has been merged in the infra-513663 branch:
commit 510aa4f09577fa12b690cde66ab22d95e6a2f190
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jan 8 11:57:59 2011 +0100

    Remove the notion of "unpack level"
    
    Removed all references to "unpack level" and related variables
    in Lintian.  The command-line/config/ENV controls for unpack-level
    has been disabled for a while and have now been removed as well.

diff --git a/frontend/lintian b/frontend/lintian
index 8553ce5..4049485 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -49,7 +49,6 @@ my $lintian_info = 0;		#flag for -i|--info switch
 our $display_experimentaltags = 0; #flag for -E|--display-experimental switch
 our $display_pedantictags = 0;	#flag for --pedantic switch
 our $ftpmaster_tags = 0;	#flag for -F|--ftp-master-rejects switch
-my $unpack_level = undef;	#flag for -l|--unpack-level switch
 our $no_override = 0;		#flag for -o|--no-override switch
 our $show_overrides = 0;	#flag for --show-overrides switch
 my $color = 'never';		#flag for --color switch
@@ -98,7 +97,6 @@ my %check_info;
 our $LINTIAN_LAB = undef;
 our $LINTIAN_ARCHIVEDIR = undef;
 our $LINTIAN_DIST = undef;
-our $LINTIAN_UNPACK_LEVEL = undef;
 our $LINTIAN_ARCH = undef;
 our $LINTIAN_SECTION = undef;
 our $LINTIAN_AREA = undef;
@@ -387,7 +385,6 @@ my %opthash = (			# ------------------ actions
 	       "display-source=s" => \&record_display_source,
 	       "suppress-tags=s" => \&record_suppress_tags,
 	       "suppress-tags-from-file=s" => \&record_suppress_tags_from_file,
-	       "unpack-level|l=i" => \$unpack_level,
 	       "no-override|o" => \$no_override,
 	       "show-overrides" => \$show_overrides,
 	       "color=s" => \$color,
@@ -485,7 +482,7 @@ if ($LINTIAN_CFG) {
     undef $LINTIAN_CFG;
 }
 
-use constant VARS => qw(LAB ARCHIVEDIR DIST UNPACK_LEVEL SECTION AREA ARCH);
+use constant VARS => qw(LAB ARCHIVEDIR DIST SECTION AREA ARCH);
 # read configuration file
 if ($LINTIAN_CFG) {
     open(CFG, '<', $LINTIAN_CFG)
@@ -547,28 +544,6 @@ if (defined $LINTIAN_SECTION) {
     }
 }
 
-# determine requested unpack level
-if (defined($unpack_level)) {
-    print STDERR "warning: --unpack-level is deprecated, ignoring.\n";
-    # specified through command line
-} elsif (defined($LINTIAN_UNPACK_LEVEL)) {
-    # specified via configuration file or env variable
-    print STDERR "warning: LINTIAN_UNPACK_LEVEL is deprecated, ignoring.\n";
-}
-
-# determine by action
-if (($action eq 'unpack') or ($action eq 'check')) {
-    $unpack_level = 1;
-} else {
-    $unpack_level = 0;
-}
-
-unless (($unpack_level == 0) or ($unpack_level == 1)) {
-    die("bad unpack level $unpack_level specified");
-}
-
-$LINTIAN_UNPACK_LEVEL = $unpack_level;
-
 # export current settings for our helper scripts
 foreach (('ROOT', 'CFG', VARS)) {
     no strict 'refs';
@@ -660,7 +635,6 @@ debug_msg(1,
 	  "Laboratory: $LINTIAN_LAB",
 	  "Archive directory: $LINTIAN_ARCHIVEDIR",
 	  "Distribution: $LINTIAN_DIST",
-	  "Default unpack level: $LINTIAN_UNPACK_LEVEL",
 	  "Architecture: $LINTIAN_ARCH",
 	  delimiter(),
     );
@@ -1048,7 +1022,6 @@ unless ($count) {
 v_msg(sprintf("Processing %d packages...", $count));
 debug_msg(1,
 	  "Selected action: $action",
-	  "Requested unpack level: $unpack_level",
 	  sprintf("Requested data to collect: %s", join(',',sort keys %unpack_infos)),
 	  sprintf("Selected checks: %s", join(',',sort keys %checks)),
     );
@@ -1063,7 +1036,6 @@ require Lintian::Collect;
 
 ## REFACTORING NOTES:
 ## If we are here $action is one of "check", "unpack" or "remove"
-##  $unpack_level is 1 if $action is "check" or "unpack" else it is 0.
 ##  
 
 if($action eq 'remove'){
@@ -1089,7 +1061,7 @@ if($action eq 'remove'){
     exit $exit_code;
 }
 
-# Now action is always either "check" or "unpack" and $unpack_level is 1
+# Now action is always either "check" or "unpack"
 
 my %overrides;
 my %running_jobs;
@@ -1100,7 +1072,6 @@ foreach my $pkg_info ($schedule->get_all) {
     my $lpkg;
     my $long_type;
     my $base;
-    my $act_unpack_level;
     my $info;
     my $loaded_overrides = 0;
     eval{ $lpkg = $LAB->get_lab_package($pkg, $ver, $type, $file); };
@@ -1114,7 +1085,6 @@ foreach my $pkg_info ($schedule->get_all) {
 
     # The Lab will normalize it.
     $long_type = $lpkg->pkg_type();
-    $act_unpack_level = $lpkg->unpack_level();
 
     $TAGS->file_start($file, $pkg, $ver, $arch, $long_type);
     $map->initialise();
@@ -1128,9 +1098,8 @@ foreach my $pkg_info ($schedule->get_all) {
     debug_msg(1, "Base directory in lab: $base");
 
 
-    # unpack to requested unpack level
-    $act_unpack_level = $lpkg->unpack($unpack_level);
-    if ($act_unpack_level == -1) {
+    # Ensure it has been unpacked
+    unless ($lpkg->unpack()){
 	warning("could not unpack package to desired level",
 		"skipping $action of $long_type package $pkg");
 	$exit_code = 2;
diff --git a/lib/Lab/Package.pm b/lib/Lab/Package.pm
index 8240f18..9d334bd 100644
--- a/lib/Lab/Package.pm
+++ b/lib/Lab/Package.pm
@@ -32,8 +32,8 @@ Lab::Package - A package inside the Lab
  my $lab = new Lab("dir", "dist");
  my $lpkg = $lab->get_lab_package("name", "version", "type", "path");
 
- # Make sure the package is unpacked to at least level 1.
- $lpkg->unpack(1) >= 1 or die("Could not unpack: $!");
+ # Unpack the package
+ $lpkg->unpack() or die("Could not unpack: $!");
  # Remove package from lab.
  $lpkg->delete_lab_entry();
 
@@ -116,13 +116,9 @@ Returns the type of package (e.g. binary, source, udeb ...)
 
 Returns the base directory of this package inside the lab.
 
-=item $lpkg->unpack_level()
-
-Returns the current unpack level.
-
 =cut
 
-Lab::Package->mk_accessors(qw(lab pkg_name pkg_version pkg_path pkg_type base_dir unpack_level));
+Lab::Package->mk_accessors(qw(lab pkg_name pkg_version pkg_path pkg_type base_dir));
 
 =pod
 
@@ -147,102 +143,48 @@ sub delete_lab_entry {
 
 =pod
 
-=item $lpkg->unpack($new_level)
+=item $lpkg->unpack()
 
-Increases the unpack level to B<$new_level> if it is not already at
-least B<$new_level>. Returns the unpack level (which will always be at
-least B<$new_level>) on success. In case of an error, it will return
--1 (or fail if an unknown unpack level was specified).
+Runs the unpack script for the type of package.  This is
+deprecated but remains until all the unpack scripts have
+been replaced by coll scripts.
 
 =cut
 
 sub unpack {
-    my ($self, $new_level) = @_;
-    my $level = $self->{unpack_level};
+    my ($self) = @_;
+    my $level = $self->{_unpack_level};
     my $base_dir = $self->{base_dir};
     my $pkg_type = $self->{pkg_type};
     my $pkg_path = $self->{pkg_path};
 
     debug_msg(1, sprintf("Current unpack level is %d",$level));
 
-    return $level if $level >= $new_level;
+    # Have we already run the unpack script?
+    return 1 if $level;
 
     $self->remove_status_file();
 
-    if ( ($level == 0) and (-d $base_dir) ) {
+    if ( -d $base_dir ) {
         # We were lied to, there's something already there - clean it up first
-        $self->delete_lab_entry() or return -1;
-    }
-
-    if($level < 1 && $new_level >= 1){
-        # create new directory
-	debug_msg(1, "Unpacking package to level 1 ...");
-	if (($pkg_type eq 'binary') || ($pkg_type eq 'udeb')) {
-            Lintian::Command::Simple::run("$ENV{LINTIAN_ROOT}/unpack/unpack-binpkg-l1", $base_dir, $pkg_path) == 0
-		or return -1;
-	} elsif ($pkg_type eq 'changes') {
-	    Lintian::Command::spawn({}, ["$ENV{LINTIAN_ROOT}/unpack/unpack-changes-l1", $base_dir, $pkg_path])
-		or return -1;
-	} else {
-	    Lintian::Command::Simple::run("$ENV{LINTIAN_ROOT}/unpack/unpack-srcpkg-l1", $base_dir, $pkg_path) == 0
-		or return -1;
-	}
-    }
-
-    if ($new_level >= 2) {
-	fail("Requested no longer existent unpack-level $new_level");
-    }
-
-    $self->{unpack_level} = $new_level;
-    return $new_level;
-}
-
-=pod
-
-=item $lpkg->pack($new_level)
-
-Reduce the unpack level to B<$new_level>. Returns the unpack level
-after the operation has finished. If B<$new_level> is less than 1,
-then this will call delete_lab_entry. Returns -1 in case of an
-error.
-
-Note if the current level is lower than the new requested level, then
-nothing happens and the currnet level is returned instead.
-
-=cut
-
-# TODO: is this the best way to clean dirs in perl?
-# no, look at File::Path module
-sub pack {
-    my ($self, $new_level) = @_;
-    my $level = $self->{unpack_level};
-
-    # Are we already more packed than requested?
-    return $level if($level <= $new_level);
-
-    if($new_level < 1){
-	return -1 unless($self->delete_lab_entry());
-	return 0;
+        $self->delete_lab_entry() or return 0;
     }
 
-    if($new_level < 2){
-	my $base = $self->{base_dir};
-	$self->{unpack_level} = $new_level;
-	$self->remove_status_file();
-	# remove unpacked/ directory
-	debug_msg(1, "Decreasing unpack level to 1 (removing files) ...");
-	if ( -l "$base/unpacked" ) {
-	    delete_dir("$base/".readlink("$base/unpacked"))
-		or return -1;
-	    delete_dir("$base/unpacked") or return -1;
-	} else {
-	    delete_dir("$base/unpacked") or return -1;
-	}
-	return $new_level;
+    # create new directory
+    debug_msg(1, "Unpacking package ...");
+    if (($pkg_type eq 'binary') || ($pkg_type eq 'udeb')) {
+	Lintian::Command::Simple::run("$ENV{LINTIAN_ROOT}/unpack/unpack-binpkg-l1", $base_dir, $pkg_path) == 0
+	    or return 0;
+    } elsif ($pkg_type eq 'changes') {
+	Lintian::Command::spawn({}, ["$ENV{LINTIAN_ROOT}/unpack/unpack-changes-l1", $base_dir, $pkg_path])
+	    or return 0;
+    } else {
+	Lintian::Command::Simple::run("$ENV{LINTIAN_ROOT}/unpack/unpack-srcpkg-l1", $base_dir, $pkg_path) == 0
+	    or return 0;
     }
 
-    # This should not happen unless we implement a new unpack level.
-    fail("Unhandled pack case to $new_level from $level");
+    $self->{_unpack_level} = 1;
+    return 1;
 }
 
 sub update_status_file{
@@ -252,7 +194,7 @@ sub update_status_file{
     my $fd;
     my $stf = "$self->{base_dir}/.lintian-status";
     # We are not unpacked => no place to put the status file.
-    return 0 if($self->{unpack_level} < 1);
+    return 0 if($self->{_unpack_level} < 1);
     $pkg_path = $self->{pkg_path};
     unless( @stat = stat($pkg_path)){
 	warning("cannot stat file $pkg_path: $!",
@@ -363,7 +305,7 @@ sub _check {
 	    $act_unpack_level = 0;
 	}
     }
-    $self->{unpack_level} = $act_unpack_level;
+    $self->{_unpack_level} = $act_unpack_level;
     return 1;
 }
 
diff --git a/man/lintian.pod.in b/man/lintian.pod.in
index 4358ce5..7a5d7c9 100644
--- a/man/lintian.pod.in
+++ b/man/lintian.pod.in
@@ -104,14 +104,12 @@ L</CHECKS> section below.
 
 =item B<-u>, B<--unpack>
 
-Unpack the specified packages up to the current unpack level.  The
-default and only unpack level is 1 for this option.  See the L</UNPACK
-LEVELS> section below.
+Unpacks the package will all collections.  See the L</COLLECTION>
+section below.
 
 =item B<-r>, B<--remove>
 
-Clean up the lintian directory of the specified packages up to the
-current unpack level.  The default unpack level is 0 for this option.
+Clean up the lintian directory of the specified packages.
 
 =back
 
@@ -205,10 +203,6 @@ names or comma-separated lists of tag names to suppress.  The
 suppressed tags will not be reported if they occur and will not affect
 the exit status of Lintian.
 
-=item B<-l> n, B<--unpack-level> n
-
-Set unpack level to I<n>.  See the L</UNPACK LEVELS> section, below.
-
 =item B<-o>, B<--no-override>
 
 Don't use the overrides file.
@@ -252,8 +246,6 @@ By default, temporary labs will be removed after lintian is finished.
 Specifying this options will leave the lab behind, which might be
 useful for debugging purposes.  You can find out where the temporary
 lab is located by running lintian with the B<--verbose> option.
-Implies B<--unpack-level=2> unless another unpack level is specified
-directly.
 
 =back
 
@@ -354,40 +346,6 @@ specification).
 
 =back
 
-=head1 UNPACK LEVELS
-
-=over 4
-
-=item B<0 (none)>
-
-The package does not exist in the I<laboratory> at all.
-
-=item B<1 (basic)>
-
-A directory for this package exists in the I<laboratory> and basic
-information is extracted.  This does not take much space.
-
-For binary and udeb packages, the I<control> and I<fields> directories
-and the index file are unpacked, and symbolic links are made to the
-B<.deb> file and to the lintian directory for the source package.
-
-For source packages, the binary and fields directories are unpacked,
-and symbolic links are made to the source package files.
-
-=item B<2 (contents)>
-
-This unpack level is deprecated and no longer functional. The
-I<unpacked> collection script replaced it.
-
-=back
-
-Lintian will unpack packages as far as is necessary to do its checks,
-but it will leave the package in whatever unpack level was specified
-when it is done.
-
-The default unpack level can be overwritten by setting the
-B<LINTIAN_UNPACK_LEVEL> variable in the configuration file.
-
 =head1 CHECKS
 
 @CHECKS@

-- 
Debian package checker


Reply to: