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.

Should be harmless enough not to need a discussion about policy in
gentoo-dev. Patch included below.

Ulrich


From 871b92a32cf947d266d829dfe3e3095ba62c49b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <u...@gentoo.org>
Date: Sun, 12 Feb 2017 17:21:51 +0100
Subject: [PATCH] repoman: Check for empty files in filesdir.

---
 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",
-- 
2.11.1

Attachment: pgprqcddFggjd.pgp
Description: PGP signature

Reply via email to