[library-web/wip/centos7-compat] Try to skip tarballs failing with BUF error



commit 0ad3ffb982cafff75df06dce0d7db7b81c1f2083
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Jan 21 12:24:44 2020 +0100

    Try to skip tarballs failing with BUF error

 src/lgo.py | 188 +++++++++++++++++++++++++++++++------------------------------
 1 file changed, 96 insertions(+), 92 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index c7621a2..2ce57cd 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -700,109 +700,113 @@ class Lgo(App):
         found_meson = False
         found_cmake = False
         found_autotools = False
-        for tarinfo in tar:
-            doc = None
-            if os.path.split(tarinfo.name)[-1] in ('Makefile.am', 'GNUmakefile.am') and not found_meson:
-                fd = tar.extractfile(tarinfo)
-                makefile_am = fd.read()
-                # merge lines continued with \
-                makefile_am = re.sub(r'\\\s*\n', r' ', makefile_am)
-                if 'HELP_ID' in makefile_am and '@YELP_HELP_RULES@' in makefile_am:
-                    if '.page' in makefile_am:
-                        logging.debug('found usage of mallard (via YELP_HELP_RULES) in %s' % tarinfo.name)
+        
+        try:
+            for tarinfo in tar:
+                doc = None
+                if os.path.split(tarinfo.name)[-1] in ('Makefile.am', 'GNUmakefile.am') and not found_meson:
+                    fd = tar.extractfile(tarinfo)
+                    makefile_am = fd.read()
+                    # merge lines continued with \
+                    makefile_am = re.sub(r'\\\s*\n', r' ', makefile_am)
+                    if 'HELP_ID' in makefile_am and '@YELP_HELP_RULES@' in makefile_am:
+                        if '.page' in makefile_am:
+                            logging.debug('found usage of mallard (via YELP_HELP_RULES) in %s' % 
tarinfo.name)
+                            doc = MallardModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
+                        else:
+                            logging.debug('found usage of docbook (via YELP_HELP_RULES) in %s' % 
tarinfo.name)
+                            doc = GnomeDocbookModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
+                    elif 'DOC_ID' in makefile_am and regex_gdu.findall(makefile_am):
+                        logging.debug('found usage of mallard in %s' % tarinfo.name)
                         doc = MallardModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
-                    else:
-                        logging.debug('found usage of docbook (via YELP_HELP_RULES) in %s' % tarinfo.name)
+                    elif 'DOC_MODULE' in makefile_am and regex_gdu.findall(makefile_am):
+                        logging.debug('found usage of docbook in %s' % tarinfo.name)
+                        doc = GnomeDocbookModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
+                    elif 'gnumeric-doc.make' in makefile_am:
+                        # special case for gnumeric own docbook build variant
+                        if 'include $(top_srcdir)/doc/gnumeric-doc.make' in makefile_am:
+                            continue
+                        logging.debug('found usage of (gnumeric) docbook in %s' % tarinfo.name)
+                        # fake things
+                        makefile_am += '\nDOC_MODULE = gnumeric\n'
+                        doc = GnomeDocbookModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
+                    elif 'include $(top_srcdir)/gtk-doc.make' in makefile_am or \
+                            'include $(srcdir)/gtk-doc.make' in makefile_am or \
+                            'include gtk-doc.make' in makefile_am or \
+                            ('gtkdoc-scan' in makefile_am and not (
+                                'gtk-doc' in tarinfo.name
+                                or 'gtkdoc-scanner.vala' in makefile_am)):
+                        logging.debug('found usage of gtk-doc in %s' % tarinfo.name)
+                        doc = GtkDocModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
+                    elif 'SUBDIRS = C' in makefile_am and \
+                            os.path.basename(filename).startswith('gtk-doc-'):
+                        logging.debug('found gtk-doc almost gnome-doc-utils manual in %s' % tarinfo.name)
+                        makefile_am += '\nDOC_MODULE = gtk-doc-manual\n'
                         doc = GnomeDocbookModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
-                elif 'DOC_ID' in makefile_am and regex_gdu.findall(makefile_am):
-                    logging.debug('found usage of mallard in %s' % tarinfo.name)
-                    doc = MallardModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
-                elif 'DOC_MODULE' in makefile_am and regex_gdu.findall(makefile_am):
-                    logging.debug('found usage of docbook in %s' % tarinfo.name)
-                    doc = GnomeDocbookModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
-                elif 'gnumeric-doc.make' in makefile_am:
-                    # special case for gnumeric own docbook build variant
-                    if 'include $(top_srcdir)/doc/gnumeric-doc.make' in makefile_am:
+                    else:
                         continue
-                    logging.debug('found usage of (gnumeric) docbook in %s' % tarinfo.name)
-                    # fake things
-                    makefile_am += '\nDOC_MODULE = gnumeric\n'
-                    doc = GnomeDocbookModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
-                elif 'include $(top_srcdir)/gtk-doc.make' in makefile_am or \
-                        'include $(srcdir)/gtk-doc.make' in makefile_am or \
-                        'include gtk-doc.make' in makefile_am or \
-                        ('gtkdoc-scan' in makefile_am and not (
-                            'gtk-doc' in tarinfo.name
-                            or 'gtkdoc-scanner.vala' in makefile_am)):
-                    logging.debug('found usage of gtk-doc in %s' % tarinfo.name)
-                    doc = GtkDocModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
-                elif 'SUBDIRS = C' in makefile_am and \
-                        os.path.basename(filename).startswith('gtk-doc-'):
-                    logging.debug('found gtk-doc almost gnome-doc-utils manual in %s' % tarinfo.name)
-                    makefile_am += '\nDOC_MODULE = gtk-doc-manual\n'
-                    doc = GnomeDocbookModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
-                else:
-                    continue
-
-                if '$(' in doc.modulename:
-                    logging.debug('skipping because it has $( in its modulename')
-                    continue
-
-                found_autotools = True
 
-            elif os.path.split(tarinfo.name)[-1] == 'CMakeLists.txt':
-                fd = tar.extractfile(tarinfo)
-                cmakelists = fd.read()
-                if 'add_gtkdoc' in cmakelists:
-                    logging.debug('found usage of gtk-doc in %s' % tarinfo.name)
-                    doc = GtkDocModule.create_from_tar(tar, tarinfo,
-                            cmakelists=cmakelists, nightly=nightly)
-                else:
-                    continue
-                found_cmake = True
-
-            elif os.path.split(tarinfo.name)[-1] == 'meson.build' and not found_autotools:
-                fd = tar.extractfile(tarinfo)
-                meson_build = fd.read()
-                if re.findall(r"gnome.gtkdoc\s*\(\s*'([\w-]+)'", meson_build, re.DOTALL):
-                    logging.debug('found usage of gtk-doc in %s' % tarinfo.name)
-                    doc = GtkDocModule.create_from_tar(tar, tarinfo,
-                            meson_build=meson_build, nightly=nightly)
-                else:
-                    continue
+                    if '$(' in doc.modulename:
+                        logging.debug('skipping because it has $( in its modulename')
+                        continue
 
-                found_meson = True
+                    found_autotools = True
 
-            else:
-                for more_doc in more_tarball_docs[:]:
-                    if not tarinfo.isdir():
+                elif os.path.split(tarinfo.name)[-1] == 'CMakeLists.txt':
+                    fd = tar.extractfile(tarinfo)
+                    cmakelists = fd.read()
+                    if 'add_gtkdoc' in cmakelists:
+                        logging.debug('found usage of gtk-doc in %s' % tarinfo.name)
+                        doc = GtkDocModule.create_from_tar(tar, tarinfo,
+                                cmakelists=cmakelists, nightly=nightly)
+                    else:
                         continue
-                    directory_name = tarinfo.name
-                    if not directory_name[-1] == '/':
-                        directory_name += '/'
-                    if directory_name.endswith(more_doc.attrib.get('dir')):
-                        doc = HtmlFilesModule.create_from_tar(tar, tarinfo, more_doc)
-                        more_tarball_docs.remove(more_doc)
+                    found_cmake = True
+
+                elif os.path.split(tarinfo.name)[-1] == 'meson.build' and not found_autotools:
+                    fd = tar.extractfile(tarinfo)
+                    meson_build = fd.read()
+                    if re.findall(r"gnome.gtkdoc\s*\(\s*'([\w-]+)'", meson_build, re.DOTALL):
+                        logging.debug('found usage of gtk-doc in %s' % tarinfo.name)
+                        doc = GtkDocModule.create_from_tar(tar, tarinfo,
+                                meson_build=meson_build, nightly=nightly)
+                    else:
                         continue
 
-            if doc and (not doc.modulename or doc.modulename in self.config.blacklist):
-                logging.debug('skipping because in blacklist')
-                continue
-
+                    found_meson = True
 
-            if doc:
-                doc.filename = filename
-                doc.mtime_tarball = mtime
-                if extraction_happened:
-                    doc.extract(force=True)
                 else:
-                    extraction_happened = doc.extract()
-                doc.setup_channel()
-                doc.path = self.get_module_web_path(doc)
-                if self.config.channels is None or doc.channel in self.config.channels:
-                    doc_modules.append(doc)
-                else:
-                    logging.debug('ignoring %s, not in an appropriate channel' % doc.modulename)
+                    for more_doc in more_tarball_docs[:]:
+                        if not tarinfo.isdir():
+                            continue
+                        directory_name = tarinfo.name
+                        if not directory_name[-1] == '/':
+                            directory_name += '/'
+                        if directory_name.endswith(more_doc.attrib.get('dir')):
+                            doc = HtmlFilesModule.create_from_tar(tar, tarinfo, more_doc)
+                            more_tarball_docs.remove(more_doc)
+                            continue
+
+                if doc and (not doc.modulename or doc.modulename in self.config.blacklist):
+                    logging.debug('skipping because in blacklist')
+                    continue
+
+
+                if doc:
+                    doc.filename = filename
+                    doc.mtime_tarball = mtime
+                    if extraction_happened:
+                        doc.extract(force=True)
+                    else:
+                        extraction_happened = doc.extract()
+                    doc.setup_channel()
+                    doc.path = self.get_module_web_path(doc)
+                    if self.config.channels is None or doc.channel in self.config.channels:
+                        doc_modules.append(doc)
+                    else:
+                        logging.debug('ignoring %s, not in an appropriate channel' % doc.modulename)
+        except IOError:
+            pass
 
         if more_tarball_docs:
             for more_doc in more_tarball_docs:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]