Commit 91d753b5 authored by Arno Töll's avatar Arno Töll
Browse files

Accept native packages. Those have erroneously rejected as they don't contain a orig.tar.gz

parent 6b32857d
...@@ -87,6 +87,22 @@ class CheckFiles(object): ...@@ -87,6 +87,22 @@ class CheckFiles(object):
return True return True
def is_native_package(self, changes_file):
"""
Guess based on the changes file and files being uploaded, whether a package
is considered native of not
```changes_file```
The changes file to parse for the orig.tar (note the dsc file referenced must exist)
"""
for file in changes_file['Files']:
if file['name'].endswith('.diff.gz'):
return False
if file['name'].endswith(('.debian.tar.gz','.debian.tar.bz2','.debian.tar.xz')):
return False
return True
def find_orig_tarball(self, changes_file): def find_orig_tarball(self, changes_file):
""" """
Look to see whether there is an orig tarball present, if the dsc refers to one. Look to see whether there is an orig tarball present, if the dsc refers to one.
......
...@@ -37,7 +37,7 @@ __license__ = 'MIT' ...@@ -37,7 +37,7 @@ __license__ = 'MIT'
import logging import logging
from debexpo.lib import constants from debexpo.lib import constants, filesystem
from debexpo.plugins import BasePlugin from debexpo.plugins import BasePlugin
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -49,13 +49,9 @@ class NativePlugin(BasePlugin): ...@@ -49,13 +49,9 @@ class NativePlugin(BasePlugin):
Test to see whether the package is a native package. Test to see whether the package is a native package.
""" """
log.debug('Checking whether the package is native or not') log.debug('Checking whether the package is native or not')
filecheck = filesystem.CheckFiles()
native = True native = filecheck.is_native_package(self.changes)
for file in self.changes['Files']:
if file['name'].endswith('.diff.gz'):
native = False
if file['name'].endswith(('.debian.tar.gz','.debian.tar.bz2','.debian.tar.xz')):
native = False
if native: if native:
# Most uploads will not be native, and especially on mentors, a native # Most uploads will not be native, and especially on mentors, a native
......
...@@ -445,11 +445,11 @@ class Importer(object): ...@@ -445,11 +445,11 @@ class Importer(object):
sys.exit(1) sys.exit(1)
# Check whether a post-upload plugin has got the orig tarball from somewhere. # Check whether a post-upload plugin has got the orig tarball from somewhere.
if not orig_file_found: if not orig_file_found and not filecheck.is_native_package(self.changes):
(orig, orig_file_found) = filecheck.find_orig_tarball(self.changes) (orig, orig_file_found) = filecheck.find_orig_tarball(self.changes)
if not orig_file_found: if not orig_file_found:
# When coming here it means: # When coming here it means:
# a) The uploaded did not include a orig.tar.gz in his upload # a) The uploader did not include a orig.tar.gz in his upload
# b) We couldn't find a orig.tar.gz in our repository # b) We couldn't find a orig.tar.gz in our repository
# c) No plugin could get the orig.tar.gz # c) No plugin could get the orig.tar.gz
# ... time to give up # ... time to give up
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment