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

[lintian] 02/02: Stop installing and clean up /var/spool/lintian on upgrade



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

nthykier pushed a commit to branch master
in repository lintian.

commit 539a4e3ae0ef90a3ec6d4fb17c4f36c6775ac5d0
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Sep 14 18:50:58 2014 +0200

    Stop installing and clean up /var/spool/lintian on upgrade
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog |  5 +++++
 debian/dirs      |  1 -
 debian/postinst  | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index f472ed6..86ef3ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,11 @@ lintian (2.5.28) UNRELEASED; urgency=medium
   * data/cruft/non-free-license:
     + [BR] Detect cc-by-nc-sa license.  (Closes:  #749768).
 
+  * debian/dirs:
+    + [NT] Stop installing /var/spool/lintian
+  * debian/postinst:
+    + [NT] Remove empty Lintian labs in /var/spool/lintian on
+      upgrade.
   * debian/postrm:
     + [NT] Remove the "changes" folder when purging the
       Lintian lab in /var/spool/lintian.
diff --git a/debian/dirs b/debian/dirs
index ea49a65..be90752 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -1,4 +1,3 @@
 etc
 usr/bin
 usr/share/lintian
-var/spool/lintian
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..77c47fc
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,36 @@
+#!/bin/sh
+set -e
+
+LAB_DIRS='binary source udeb info changes'
+
+non_empty_dir() {
+    dir="$1"
+    [ -d "$dir" ] && [ "$(ls -A "$dir")" ]
+}
+
+if [ "$1" = "configure" ]; then
+    if [ -d /var/spool/lintian ]; then
+        IN_USE=no
+        HAS_LAB_FOLDER=no
+        for DIR in $LAB_DIRS ; do
+            if [ -d "/var/spool/lintian/$DIR" ] ; then
+                HAS_LAB_FOLDER=yes
+            fi
+            if non_empty_dir "/var/spool/lintian/$DIR" ; then
+                IN_USE=yes
+                break
+            fi
+        done
+        if [ "$IN_USE" = "no" ] && [ "$HAS_LAB_FOLDER" = "yes" ]; then
+            echo "Removing empty lintian lab in /var/spool/lintian"
+            for DIR in $LAB_DIRS ; do
+                if [ -d "/var/spool/lintian/$DIR" ]; then
+                    rmdir "/var/spool/lintian/$DIR"
+                fi
+            done
+            rmdir --ignore-fail-on-non-empty /var/spool/lintian
+        fi
+    fi
+fi
+
+#DEBHELPER#

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


Reply to: