Repository: rpm-software-management/rpmlint (language: python)

Issue:
Support gem.build_complete file
Each rubygem-patckage with binary extension ship empty `gem.build_complete` file which is required by RubyGems to detect that binary extension was built, therefore it would be nice if rpmlint have not complained about this file.

~~~
$ rpmlint rubygem-puma-4.3.6-1.fc34.x86_64.rpm 
rubygem-puma.x86_64: E: zero-length /usr/lib64/gems/ruby/puma-4.3.6/gem.build_complete
rubygem-puma.x86_64: W: no-manual-page-for-binary pumactl
1 packages and 0 specfiles checked; 1 errors, 1 warnings.
~~~


Discussion / hints:
This should be fairly trivial, we can have list of known zero files that need to be on fs, like py.typed is empty and expected as another alternative.

Fix patch:
diff --git a/rpmlint/checks/FilesCheck.py b/rpmlint/checks/FilesCheck.py
index 0da9ac629..b6a6153f3 100644
--- a/rpmlint/checks/FilesCheck.py
+++ b/rpmlint/checks/FilesCheck.py
@@ -178,7 +178,7 @@
 logrotate_regex = re.compile(r'^/etc/logrotate\.d/(.*)')
 kernel_modules_regex = re.compile(r'^(?:/usr)/lib/modules/([0-9]+\.[0-9]+\.[0-9]+[^/]*?)/')
 kernel_package_regex = re.compile(r'^kernel(22)?(-)?(smp|enterprise|bigmem|secure|BOOT|i686-up-4GB|p3-smp-64GB)?')
-normal_zero_length_regex = re.compile(r'^/etc/security/console\.apps/|/\.nosearch$|/__init__\.py$')
+normal_zero_length_regex = re.compile(r'^/etc/security/console\.apps/|/\.nosearch$|/__init__\.py$|/py\.typed$|/gem\.build_complete$')
 perl_regex = re.compile(r'^/usr/lib/perl5/(?:vendor_perl/)?([0-9]+\.[0-9]+)\.([0-9]+)/')
 python_regex = re.compile(r'^/usr/lib(?:64)?/python([.0-9]+)/')
 python_bytecode_regex_pep3147 = re.compile(r'^(.*)/__pycache__/(.*?)\.([^.]+)(\.opt-[12])?\.py[oc]$')


Test patch:
diff --git a/test/binary/file-zero-length-1.0-0.noarch.rpm b/test/binary/file-zero-length-1.0-0.noarch.rpm
new file mode 100644
index 000000000..5ba6a1586
Binary files /dev/null and b/test/binary/file-zero-length-1.0-0.noarch.rpm differ
diff --git a/test/test_files.py b/test/test_files.py
index 850a7b855..3f7d4f2d8 100644
--- a/test/test_files.py
+++ b/test/test_files.py
@@ -204,3 +204,17 @@ def test_shlib2_devel(tmpdir, package, filescheck):
     assert 'library-without-ldconfig-postin' in out
     assert 'library-without-ldconfig-postun' in out
     assert 'non-devel-file-in-devel-package' in out
+
+
+@pytest.mark.parametrize('package', ['binary/file-zero-length'])
+def test_zero_length(tmpdir, package, filescheck):
+    output, test = filescheck
+    test.check(get_tested_package(package, tmpdir))
+    out = output.print_results(output.results)
+    assert 'zero-length /usr/lib/emptyfile' in out
+    assert 'zero-length /usr/lib/nonemptyfile' not in out
+    assert 'zero-length /etc/security/console.apps' not in out
+    assert 'zero-length /usr/lib/.nosearch' not in out
+    assert 'zero-length /usr/lib/python/__init__.py' not in out
+    assert 'zero-length /usr/lib/python/py.typed' not in out
+    assert 'zero-length /usr/lib/ruby/gem.build_complete' not in out