Bug#894368: lintian: Please add check for empty directories in the source package
Package: lintian
Version: 2.5.80
Severity: wishlist
Tags: patch
Dear Maintainers,
Please add check for empty directories in the source package to help
git-based workflows.
The proposed description of the check from the patch:
Tag: source-contains-empty-dir
Severity: pedantic
Certainty: certain
Info: The source contains an empty directory
Having an empty directory in itself does not cause problems but empty
directories can't be stored in Git, which is a very popular version
control system for maintaining source packages.
.
Keeping the empty directory in the source package prevent others from
easily contributing to the package by importing it in full to a local
repository, making changes, then generating an updated source package
with tools like git-buildpackage. In that workflow the empty directory
would be lost potentially causing errors if the installed binary package
relied on it or causing autopkgtest failures if tests used it.
--
Balint Reczey
Ubuntu & Debian Developer
From e2ab5268c055e48fe56a55fb21ab30b78d51e1b0 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint.reczey@canonical.com>
Date: Mon, 26 Mar 2018 15:21:45 +0100
Subject: [PATCH] Emit warning if the source package contains empty dir
---
checks/cruft.desc | 15 +++++++++++++++
checks/cruft.pm | 3 +++
t/tests/cruft-general-test-suite/pre_upstream | 1 +
t/tests/cruft-general-test-suite/tags | 1 +
4 files changed, 20 insertions(+)
diff --git a/checks/cruft.desc b/checks/cruft.desc
index c469fdd59..6ce0d5664 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -61,6 +61,21 @@ Info: The Debian diff contains a CMake cache file. These files embed the
modify it in the Debian diff; instead, delete it before the build in
<tt>debian/rules</tt>.
+Tag: source-contains-empty-dir
+Severity: pedantic
+Certainty: certain
+Info: The source contains an empty directory
+ Having an empty directory in itself does not cause problems but empty
+ directories can't be stored in Git, which is a very popular version
+ control system for maintaining source packages.
+ .
+ Keeping the empty directory in the source package prevent others from
+ easily contributing to the package by importing it in full to a local
+ repository, making changes, then generating an updated source package
+ with tools like git-buildpackage. In that workflow the empty directory
+ would be lost potentially causing errors if the installed binary package
+ relied on it or causing autopkgtest failures if tests used it.
+
Tag: diff-contains-cvs-control-dir
Severity: normal
Certainty: certain
diff --git a/checks/cruft.pm b/checks/cruft.pm
index 9bdb20d2e..0ccde671a 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -615,6 +615,9 @@ sub find_cruft {
tag 'package-does-not-install-examples', $entry
if $basename eq 'examples' and not $ships_examples;
}
+ if (scalar($entry->children) == 0 and not $warned->{$name}) {
+ tag 'source-contains-empty-dir', $entry;
+ }
push(@worklist, $entry->children);
next ENTRY;
diff --git a/t/tests/cruft-general-test-suite/pre_upstream b/t/tests/cruft-general-test-suite/pre_upstream
index 8665c9269..58c8b58e2 100755
--- a/t/tests/cruft-general-test-suite/pre_upstream
+++ b/t/tests/cruft-general-test-suite/pre_upstream
@@ -7,6 +7,7 @@
set -e
dir="$1"
+mkdir -p "${dir}/empty-dir"
mkdir -p "${dir}/t/CVS"
echo 'source-contains-cvs-control-dir' > "${dir}/t/CVS/Entries"
mkdir -p "${dir}/foo/t/.svn"
diff --git a/t/tests/cruft-general-test-suite/tags b/t/tests/cruft-general-test-suite/tags
index fa40db641..385e53154 100644
--- a/t/tests/cruft-general-test-suite/tags
+++ b/t/tests/cruft-general-test-suite/tags
@@ -1 +1,2 @@
P: cruft-general-test-suite source: debian-watch-does-not-check-gpg-signature
+P: cruft-general-test-suite source: source-contains-empty-dir empty-dir/
--
2.15.1
Reply to: