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

[lintian] 01/01: lintian: Auto-remove entries in temp labs



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 4d5acdc0a73b1e9a461d4a2bf1da227e60273da5
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Apr 10 18:41:15 2016 +0000

    lintian: Auto-remove entries in temp labs
    
    In a temp lab, remove the entire entry rather than auto-removing
    individual collections.  It has less "administrative overhead" and
    conserves more disk space when processing multiple items.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 commands/lintian         | 12 ++++++++++--
 lib/Lintian/Lab/Entry.pm |  6 +++++-
 lib/Lintian/Unpacker.pm  |  3 ++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/commands/lintian b/commands/lintian
index eaaa264..dae5cc6 100755
--- a/commands/lintian
+++ b/commands/lintian
@@ -873,10 +873,18 @@ sub auto_clean_package {
     my $pkg_type = $lpkg->pkg_type();
     my $base = $lpkg->base_dir();
     my $changed = 0;
+    if ($lpkg->lab->is_temp) {
+        debug_msg(1, "Auto removing: $proc_id ...");
+        my $raw_res = timed_task {
+            $lpkg->remove;
+        };
+        perf_log("$proc_id,auto-remove entry,${raw_res}");
+        return 2;
+    }
     for my $coll (@auto_remove) {
         my $ci = $collmap->getp($coll);
         next unless $lpkg->is_coll_finished($coll, $ci->version);
-        debug_msg(1, "Auto removing: $coll ...");
+        debug_msg(1, "Auto removing: $proc_id ($coll) ...");
         $changed = 1;
         eval {
             my $raw_res = timed_task {
@@ -1112,7 +1120,7 @@ sub process_group {
                 $exit_code = 2;
                 $all_ok = 0;
             }
-            if ($ret) {
+            if ($ret and $ret != 2) {
                 # Update the status file as auto_clean_package may
                 # have removed some collections
                 unless ($lpkg->update_status_file) {
diff --git a/lib/Lintian/Lab/Entry.pm b/lib/Lintian/Lab/Entry.pm
index f8bbc95..df2f7e9 100644
--- a/lib/Lintian/Lab/Entry.pm
+++ b/lib/Lintian/Lab/Entry.pm
@@ -153,9 +153,13 @@ sub _new_from_proc {
 
 Returns the base directory of this package inside the lab.
 
+=item lab
+
+Returns a reference to the laboratory related to this entry.
+
 =cut
 
-Lintian::Lab::Entry->mk_ro_accessors(qw(base_dir));
+Lintian::Lab::Entry->mk_ro_accessors(qw(lab base_dir));
 
 =item from_lab (LAB)
 
diff --git a/lib/Lintian/Unpacker.pm b/lib/Lintian/Unpacker.pm
index efd9fa5..14a728c 100644
--- a/lib/Lintian/Unpacker.pm
+++ b/lib/Lintian/Unpacker.pm
@@ -531,7 +531,8 @@ sub process_tasks {
         my $state = 'unchanged';
         $state = 'changed' if $changed;
         $state = 'failed' if exists $failed{$procid};
-        $finish_hook->($lpkg, $state, sub { $changed = 1 })
+        # Gracefully handle the hook deleting the entire entry
+        $finish_hook->($lpkg, $state, sub { $changed = $lpkg->exists ? 1 : 0 })
           if $finish_hook;
         if ($changed) {
             $state = 'sf-error';

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: