commit:     04e5f8dee2130901386f4f1b65328bbf0b8104c1
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 12 16:21:51 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Feb 12 17:22:45 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=04e5f8de

repoman: Check for empty files in filesdir.

This checks for files with zero size in filesdir. The QA script at
https://qa-reports.gentoo.org/output/find-binary-files.txt reports a
couple of them which at least in part are blunders.

 repoman/man/repoman.1                             | 5 ++++-
 repoman/pym/repoman/modules/scan/fetch/fetches.py | 3 +++
 repoman/pym/repoman/qa_data.py                    | 3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1
index 3b3aec27e..9b106906f 100644
--- a/repoman/man/repoman.1
+++ b/repoman/man/repoman.1
@@ -1,4 +1,4 @@
-.TH "REPOMAN" "1" "Dec 2016" "Repoman VERSION" "Repoman"
+.TH "REPOMAN" "1" "Feb 2017" "Repoman VERSION" "Repoman"
 .SH NAME
 repoman \- Gentoo's program to enforce a minimal level of quality assurance in
 packages added to the portage tree
@@ -328,6 +328,9 @@ error or digest verification failure.
 .B file.UTF8
 File is not UTF8 compliant
 .TP
+.B file.empty
+Empty file in the files directory
+.TP
 .B file.executable
 Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need the
 executable bit

diff --git a/repoman/pym/repoman/modules/scan/fetch/fetches.py 
b/repoman/pym/repoman/modules/scan/fetch/fetches.py
index 9ee3c652a..241cfaa7b 100644
--- a/repoman/pym/repoman/modules/scan/fetch/fetches.py
+++ b/repoman/pym/repoman/modules/scan/fetch/fetches.py
@@ -130,6 +130,9 @@ class FetchChecks(ScanBase):
                                        self.qatracker.add_error(
                                                "file.size", "(%d KiB) 
%s/files/%s" % (
                                                        mystat.st_size // 1024, 
xpkg, y))
+                               elif mystat.st_size == 0:
+                                       self.qatracker.add_error(
+                                               "file.empty", "%s/files/%s" % 
(xpkg, y))
 
                                index = 
self.repo_settings.repo_config.find_invalid_path_char(y)
                                if index != -1:

diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index 29a95abf6..0dc32789f 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -67,6 +67,8 @@ qahelp = {
                "Files in the files directory must be under 20 KiB"),
        "file.size.fatal": (
                "Files in the files directory must be under 60 KiB"),
+       "file.empty": (
+               "Empty file in the files directory"),
        "file.name": (
                "File/dir name must be composed"
                " of only the following chars: %s " % allowed_filename_chars),
@@ -262,6 +264,7 @@ qawarnings = set((
        "ebuild.minorsyn",
        "ebuild.badheader",
        "ebuild.patches",
+       "file.empty",
        "file.size",
        "inherit.unused",
        "inherit.deprecated",

Reply via email to