Gentoo Archives: gentoo-portage-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] repoman: Check for empty files in filesdir.
Date: Sun, 12 Feb 2017 16:49:21
Message-Id: 22688.37365.404389.866145@a1i15.kph.uni-mainz.de
1 This checks for files with zero size in filesdir. The QA script at
2 https://qa-reports.gentoo.org/output/find-binary-files.txt reports a
3 couple of them which at least in part are blunders.
4
5 Should be harmless enough not to need a discussion about policy in
6 gentoo-dev. Patch included below.
7
8 Ulrich
9
10
11 From 871b92a32cf947d266d829dfe3e3095ba62c49b0 Mon Sep 17 00:00:00 2001
12 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@g.o>
13 Date: Sun, 12 Feb 2017 17:21:51 +0100
14 Subject: [PATCH] repoman: Check for empty files in filesdir.
15
16 ---
17 repoman/man/repoman.1 | 5 ++++-
18 repoman/pym/repoman/modules/scan/fetch/fetches.py | 3 +++
19 repoman/pym/repoman/qa_data.py | 3 +++
20 3 files changed, 10 insertions(+), 1 deletion(-)
21
22 diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1
23 index 3b3aec27e..9b106906f 100644
24 --- a/repoman/man/repoman.1
25 +++ b/repoman/man/repoman.1
26 @@ -1,4 +1,4 @@
27 -.TH "REPOMAN" "1" "Dec 2016" "Repoman VERSION" "Repoman"
28 +.TH "REPOMAN" "1" "Feb 2017" "Repoman VERSION" "Repoman"
29 .SH NAME
30 repoman \- Gentoo's program to enforce a minimal level of quality assurance in
31 packages added to the portage tree
32 @@ -328,6 +328,9 @@ error or digest verification failure.
33 .B file.UTF8
34 File is not UTF8 compliant
35 .TP
36 +.B file.empty
37 +Empty file in the files directory
38 +.TP
39 .B file.executable
40 Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need the
41 executable bit
42 diff --git a/repoman/pym/repoman/modules/scan/fetch/fetches.py b/repoman/pym/repoman/modules/scan/fetch/fetches.py
43 index 9ee3c652a..241cfaa7b 100644
44 --- a/repoman/pym/repoman/modules/scan/fetch/fetches.py
45 +++ b/repoman/pym/repoman/modules/scan/fetch/fetches.py
46 @@ -130,6 +130,9 @@ class FetchChecks(ScanBase):
47 self.qatracker.add_error(
48 "file.size", "(%d KiB) %s/files/%s" % (
49 mystat.st_size // 1024, xpkg, y))
50 + elif mystat.st_size == 0:
51 + self.qatracker.add_error(
52 + "file.empty", "%s/files/%s" % (xpkg, y))
53
54 index = self.repo_settings.repo_config.find_invalid_path_char(y)
55 if index != -1:
56 diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
57 index 29a95abf6..0dc32789f 100644
58 --- a/repoman/pym/repoman/qa_data.py
59 +++ b/repoman/pym/repoman/qa_data.py
60 @@ -67,6 +67,8 @@ qahelp = {
61 "Files in the files directory must be under 20 KiB"),
62 "file.size.fatal": (
63 "Files in the files directory must be under 60 KiB"),
64 + "file.empty": (
65 + "Empty file in the files directory"),
66 "file.name": (
67 "File/dir name must be composed"
68 " of only the following chars: %s " % allowed_filename_chars),
69 @@ -262,6 +264,7 @@ qawarnings = set((
70 "ebuild.minorsyn",
71 "ebuild.badheader",
72 "ebuild.patches",
73 + "file.empty",
74 "file.size",
75 "inherit.unused",
76 "inherit.deprecated",
77 --
78 2.11.1

Replies