#!/usr/bin/env python3 import tarfile import zipfile import subprocess import os from jarmanifest import log from jarmanifest.configuration import config logger = log.getLogger('util.archives') ignore_no_ext = False ignore_ext_list = [] if config.has_option('archives', 'ignore_no_ext'): ignore_no_ext = eval(config.get('archives', 'ignore_no_ext')) if config.has_option('archives', 'ignore_ext_list'): ignore_ext_list = config.get('archives', 'ignore_ext_list').split(',') # handler class for tars with invalid headers # Some .tgz patchs eg: JBPAPP-8049.zip/JBPAPP-8049-signed.tgz tend # to have things like '\x81' in its headers, raiseing a # UnicodeDecodeError # We fake the tarfile module using the sytems 'tar' binary class custom_tarfile: def __init__(self, filename): self.command = 'tar' self.filename = os.path.abspath(filename) self.filelist = self.get_filelist() self.extracted = False
#!/usr/bin/env python3 import logging from jarmanifest.configuration import config loggers = {} configured = False logginglevel = eval(config.get('logging','level')) def getLoggingLevel(): return logginglevel def configureLogging(): global configured logging.basicConfig(level=logginglevel,format='[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s') configured=True def setLoggingLevel(tovalue,logger=None): global logginglevel logginglevel = tovalue if logger is None: for logger in loggers: loggers[logger].setLevel(logginglevel) elif logger in loggers.keys(): loggers[logger].setLevel(logginglevel) def debugmode(): setLoggingLevel(logging.DEBUG) def quiet(): setLoggingLevel(logging.CRITICAL)
#!/usr/bin/env python3 import logging from jarmanifest.configuration import config loggers = {} configured = False logginglevel = eval(config.get('logging', 'level')) def getLoggingLevel(): return logginglevel def configureLogging(): global configured logging.basicConfig( level=logginglevel, format='[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s') configured = True def setLoggingLevel(tovalue, logger=None): global logginglevel logginglevel = tovalue if logger is None: for logger in loggers: loggers[logger].setLevel(logginglevel) elif logger in list(loggers.keys()): loggers[logger].setLevel(logginglevel)
#!/usr/bin/env python3 import tarfile import zipfile import subprocess import os from jarmanifest import log from jarmanifest.configuration import config logger = log.getLogger('util.archives') ignore_no_ext = False ignore_ext_list = [] if config.has_option('archives','ignore_no_ext'): ignore_no_ext = eval(config.get('archives','ignore_no_ext')) if config.has_option('archives','ignore_ext_list'): ignore_ext_list = config.get('archives','ignore_ext_list').split(',') # handler class for tars with invalid headers # Some .tgz patchs eg: JBPAPP-8049.zip/JBPAPP-8049-signed.tgz tend # to have things like '\x81' in its headers, raiseing a # UnicodeDecodeError # We fake the tarfile module using the sytems 'tar' binary class custom_tarfile: def __init__(self,filename): self.command = 'tar' self.filename = os.path.abspath(filename) self.filelist = self.get_filelist() self.extracted = False def get_filelist(self):