예제 #1
0
    def postoptparse(self):
        if self.options.verbose:
            msger.set_loglevel('verbose')
        if self.options.debug:
            msger.set_loglevel('debug')

        if self.options.logfile:
            msger.set_interactive(False)
            msger.set_logfile(self.options.logfile)
            configmgr.create['logfile'] = self.options.logfile

        if self.options.config:
            configmgr.reset()
            configmgr._siteconf = self.options.config

        if self.options.outdir is not None:
            configmgr.create['outdir'] = self.options.outdir
        if self.options.cachedir is not None:
            configmgr.create['cachedir'] = self.options.cachedir
        os.environ['ZYPP_LOCKFILE_ROOT'] = configmgr.create['cachedir']
        if self.options.local_pkgs_path is not None:
            if not os.path.exists(self.options.local_pkgs_path):
                msger.error('Local pkgs directory: \'%s\' not exist' \
                              % self.options.local_pkgs_path)
            configmgr.create['local_pkgs_path'] = self.options.local_pkgs_path

        if self.options.release:
            configmgr.create['release'] = self.options.release

        if self.options.record_pkgs:
            configmgr.create['record_pkgs'] = []
            for infotype in self.options.record_pkgs.split(','):
                if infotype not in ('name', 'content', 'license'):
                    raise errors.Usage('Invalid pkg recording: %s, valid ones:'
                                       ' "name", "content", "license"' \
                                       % infotype)

                configmgr.create['record_pkgs'].append(infotype)

        if self.options.arch is not None:
            supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
            if self.options.arch in supported_arch:
                configmgr.create['arch'] = self.options.arch
            else:
                raise errors.Usage(
                    'Invalid architecture: "%s".\n'
                    '  Supported architectures are: \n'
                    '  %s\n' % (self.options.arch, ', '.join(supported_arch)))

        if self.options.pkgmgr is not None:
            configmgr.create['pkgmgr'] = self.options.pkgmgr

        if self.options.runtime:
            configmgr.create['runtime'] = self.options.runtime

        if self.options.compress_disk_image is not None:
            configmgr.create['compress_disk_image'] = \
                                                self.options.compress_disk_image
예제 #2
0
파일: creator.py 프로젝트: csdb/mic
    def postoptparse(self):
        if self.options.verbose:
            msger.set_loglevel('verbose')
        if self.options.debug:
            msger.set_loglevel('debug')

        if self.options.logfile:
            msger.set_interactive(False)
            msger.set_logfile(self.options.logfile)
            configmgr.create['logfile'] = self.options.logfile

        if self.options.config:
            configmgr.reset()
            configmgr._siteconf = self.options.config

        if self.options.outdir is not None:
            configmgr.create['outdir'] = self.options.outdir
        if self.options.cachedir is not None:
            configmgr.create['cachedir'] = self.options.cachedir
        os.environ['ZYPP_LOCKFILE_ROOT'] = configmgr.create['cachedir']
        if self.options.local_pkgs_path is not None:
            if not os.path.exists(self.options.local_pkgs_path):
                msger.error('Local pkgs directory: \'%s\' not exist' \
                              % self.options.local_pkgs_path)
            configmgr.create['local_pkgs_path'] = self.options.local_pkgs_path

        if self.options.release:
            configmgr.create['release'] = self.options.release

        if self.options.record_pkgs:
            configmgr.create['record_pkgs'] = []
            for infotype in self.options.record_pkgs.split(','):
                if infotype not in ('name', 'content', 'license'):
                    raise errors.Usage('Invalid pkg recording: %s, valid ones:'
                                       ' "name", "content", "license"' \
                                       % infotype)

                configmgr.create['record_pkgs'].append(infotype)

        if self.options.arch is not None:
            supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
            if self.options.arch in supported_arch:
                configmgr.create['arch'] = self.options.arch
            else:
                raise errors.Usage('Invalid architecture: "%s".\n'
                                   '  Supported architectures are: \n'
                                   '  %s\n' % (self.options.arch,
                                               ', '.join(supported_arch)))

        if self.options.pkgmgr is not None:
            configmgr.create['pkgmgr'] = self.options.pkgmgr

        if self.options.runtime:
            configmgr.create['runtime'] = self.options.runtime

        if self.options.compress_disk_image is not None:
            configmgr.create['compress_disk_image'] = \
                                                self.options.compress_disk_image
예제 #3
0
파일: conf.py 프로젝트: tizenorg/tools.mic
    def set_logfile(self, logfile = None):
        if not logfile:
            logfile = self.create['logfile']

        logfile_dir = os.path.dirname(self.create['logfile'])
        if not os.path.exists(logfile_dir):
            os.makedirs(logfile_dir)
        msger.set_interactive(False)
        if inbootstrap():
            mode = 'a'
        else:
            mode = 'w'
        msger.set_logfile(self.create['logfile'], mode)
예제 #4
0
    def set_logfile(self, logfile=None):
        if not logfile:
            logfile = self.create['logfile']

        logfile_dir = os.path.dirname(self.create['logfile'])
        if not os.path.exists(logfile_dir):
            os.makedirs(logfile_dir)
        msger.set_interactive(False)
        if inbootstrap():
            mode = 'a'
        else:
            mode = 'w'
        msger.set_logfile(self.create['logfile'], mode)
예제 #5
0
파일: creator.py 프로젝트: ronan22/mic
    def postoptparse(self):
        abspath = lambda pth: os.path.abspath(os.path.expanduser(pth))

        if self.options.verbose:
            msger.set_loglevel('verbose')
        if self.options.debug:
            msger.set_loglevel('debug')

        if self.options.logfile:
            logfile_abs_path = abspath(self.options.logfile)
            if os.path.isdir(logfile_abs_path):
                raise errors.Usage("logfile's path %s should be file"
                                   % self.options.logfile)
            if not os.path.exists(os.path.dirname(logfile_abs_path)):
                os.makedirs(os.path.dirname(logfile_abs_path))
            msger.set_interactive(False)
            msger.set_logfile(logfile_abs_path)
            configmgr.create['logfile'] = self.options.logfile

        if self.options.config:
            configmgr.reset()
            configmgr._siteconf = self.options.config

        if self.options.outdir is not None:
            configmgr.create['outdir'] = abspath(self.options.outdir)
        if self.options.cachedir is not None:
            configmgr.create['cachedir'] = abspath(self.options.cachedir)
        os.environ['ZYPP_LOCKFILE_ROOT'] = configmgr.create['cachedir']

        for cdir in ('outdir', 'cachedir'):
            if os.path.exists(configmgr.create[cdir]) \
              and not os.path.isdir(configmgr.create[cdir]):
                msger.error('Invalid directory specified: %s' \
                            % configmgr.create[cdir])

        if self.options.local_pkgs_path is not None:
            if not os.path.exists(self.options.local_pkgs_path):
                msger.error('Local pkgs directory: \'%s\' not exist' \
                              % self.options.local_pkgs_path)
            configmgr.create['local_pkgs_path'] = self.options.local_pkgs_path

        if self.options.release:
            configmgr.create['release'] = self.options.release.rstrip('/')

        if self.options.record_pkgs:
            configmgr.create['record_pkgs'] = []
            for infotype in self.options.record_pkgs.split(','):
                if infotype not in ('name', 'content', 'license', 'vcs'):
                    raise errors.Usage('Invalid pkg recording: %s, valid ones:'
                                       ' "name", "content", "license", "vcs"' \
                                       % infotype)

                configmgr.create['record_pkgs'].append(infotype)

        if self.options.arch is not None:
            supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
            if self.options.arch in supported_arch:
                configmgr.create['arch'] = self.options.arch
            else:
                raise errors.Usage('Invalid architecture: "%s".\n'
                                   '  Supported architectures are: \n'
                                   '  %s' % (self.options.arch,
                                               ', '.join(supported_arch)))

        if self.options.pkgmgr is not None:
            configmgr.create['pkgmgr'] = self.options.pkgmgr

        if self.options.runtime:
            configmgr.set_runtime(self.options.runtime)

        if self.options.pack_to is not None:
            configmgr.create['pack_to'] = self.options.pack_to

        if self.options.copy_kernel:
            configmgr.create['copy_kernel'] = self.options.copy_kernel

        if self.options.install_pkgs:
            configmgr.create['install_pkgs'] = []
            for pkgtype in self.options.install_pkgs.split(','):
                if pkgtype not in ('source', 'debuginfo', 'debugsource'):
                    raise errors.Usage('Invalid parameter specified: "%s", '
                                       'valid values: source, debuginfo, '
                                       'debusource' % pkgtype)

                configmgr.create['install_pkgs'].append(pkgtype)

        if self.options.enabletmpfs:
            configmgr.create['enabletmpfs'] = self.options.enabletmpfs

        if self.options.repourl:
            for item in self.options.repourl:
                try:
                    key, val = item.split('=')
                except:
                    continue
                configmgr.create['repourl'][key] = val
예제 #6
0
파일: creator.py 프로젝트: 117111302/poky
    def postoptparse(self):
        abspath = lambda pth: os.path.abspath(os.path.expanduser(pth))

        if self.options.verbose:
            msger.set_loglevel('verbose')
        if self.options.debug:
            msger.set_loglevel('debug')

        if self.options.logfile:
            logfile_abs_path = abspath(self.options.logfile)
            if os.path.isdir(logfile_abs_path):
                raise errors.Usage("logfile's path %s should be file"
                                   % self.options.logfile)
            if not os.path.exists(os.path.dirname(logfile_abs_path)):
                os.makedirs(os.path.dirname(logfile_abs_path))
            msger.set_interactive(False)
            msger.set_logfile(logfile_abs_path)
            configmgr.create['logfile'] = self.options.logfile

        if self.options.config:
            configmgr.reset()
            configmgr._siteconf = self.options.config

        if self.options.outdir is not None:
            configmgr.create['outdir'] = abspath(self.options.outdir)
        if self.options.cachedir is not None:
            configmgr.create['cachedir'] = abspath(self.options.cachedir)
        os.environ['ZYPP_LOCKFILE_ROOT'] = configmgr.create['cachedir']

        for cdir in ('outdir', 'cachedir'):
            if os.path.exists(configmgr.create[cdir]) \
              and not os.path.isdir(configmgr.create[cdir]):
                msger.error('Invalid directory specified: %s' \
                            % configmgr.create[cdir])

        if self.options.local_pkgs_path is not None:
            if not os.path.exists(self.options.local_pkgs_path):
                msger.error('Local pkgs directory: \'%s\' not exist' \
                              % self.options.local_pkgs_path)
            configmgr.create['local_pkgs_path'] = self.options.local_pkgs_path

        if self.options.release:
            configmgr.create['release'] = self.options.release.rstrip('/')

        if self.options.record_pkgs:
            configmgr.create['record_pkgs'] = []
            for infotype in self.options.record_pkgs.split(','):
                if infotype not in ('name', 'content', 'license', 'vcs'):
                    raise errors.Usage('Invalid pkg recording: %s, valid ones:'
                                       ' "name", "content", "license", "vcs"' \
                                       % infotype)

                configmgr.create['record_pkgs'].append(infotype)

        if self.options.arch is not None:
            supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
            if self.options.arch in supported_arch:
                configmgr.create['arch'] = self.options.arch
            else:
                raise errors.Usage('Invalid architecture: "%s".\n'
                                   '  Supported architectures are: \n'
                                   '  %s' % (self.options.arch,
                                               ', '.join(supported_arch)))

        if self.options.pkgmgr is not None:
            configmgr.create['pkgmgr'] = self.options.pkgmgr

        if self.options.runtime:
            configmgr.set_runtime(self.options.runtime)

        if self.options.pack_to is not None:
            configmgr.create['pack_to'] = self.options.pack_to

        if self.options.copy_kernel:
            configmgr.create['copy_kernel'] = self.options.copy_kernel

        if self.options.install_pkgs:
            configmgr.create['install_pkgs'] = []
            for pkgtype in self.options.install_pkgs.split(','):
                if pkgtype not in ('source', 'debuginfo', 'debugsource'):
                    raise errors.Usage('Invalid parameter specified: "%s", '
                                       'valid values: source, debuginfo, '
                                       'debusource' % pkgtype)

                configmgr.create['install_pkgs'].append(pkgtype)

        if self.options.enabletmpfs:
            configmgr.create['enabletmpfs'] = self.options.enabletmpfs

        if self.options.repourl:
            for item in self.options.repourl:
                try:
                    key, val = item.split('=')
                except:
                    continue
                configmgr.create['repourl'][key] = val
예제 #7
0
파일: creator.py 프로젝트: d0b3rm4n/mic
    def postoptparse(self):
        abspath = lambda pth: os.path.abspath(os.path.expanduser(pth))

        if self.options.verbose:
            msger.set_loglevel('verbose')
        if self.options.debug:
            msger.set_loglevel('debug')

        if self.options.logfile:
            msger.set_interactive(False)
            msger.set_logfile(self.options.logfile)
            configmgr.create['logfile'] = self.options.logfile

        if self.options.config:
            configmgr.reset()
            configmgr._siteconf = self.options.config

        if self.options.outdir is not None:
            configmgr.create['outdir'] = abspath(self.options.outdir)
        if self.options.cachedir is not None:
            configmgr.create['cachedir'] = abspath(self.options.cachedir)
        os.environ['ZYPP_LOCKFILE_ROOT'] = configmgr.create['cachedir']

        if self.options.local_pkgs_path is not None:
            if not os.path.exists(self.options.local_pkgs_path):
                msger.error('Local pkgs directory: \'%s\' not exist' \
                              % self.options.local_pkgs_path)
            configmgr.create['local_pkgs_path'] = self.options.local_pkgs_path

        if self.options.release:
            configmgr.create['release'] = self.options.release

        if self.options.record_pkgs:
            configmgr.create['record_pkgs'] = []
            for infotype in self.options.record_pkgs.split(','):
                if infotype not in ('name', 'url', 'content', 'license'):
                    raise errors.Usage('Invalid pkg recording: %s, valid ones:'
                                       ' "name", "url", "content", "license"' \
                                       % infotype)

                configmgr.create['record_pkgs'].append(infotype)

        if self.options.arch is not None:
            supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
            if self.options.arch in supported_arch:
                configmgr.create['arch'] = self.options.arch
            else:
                raise errors.Usage('Invalid architecture: "%s".\n'
                                   '  Supported architectures are: \n'
                                   '  %s' % (self.options.arch,
                                               ', '.join(supported_arch)))

        if self.options.pkgmgr is not None:
            configmgr.create['pkgmgr'] = self.options.pkgmgr

        if self.options.runtime:
            configmgr.create['runtime'] = self.options.runtime

        if self.options.pack_to is not None:
            configmgr.create['pack_to'] = self.options.pack_to

        if self.options.copy_kernel:
            configmgr.create['copy_kernel'] = self.options.copy_kernel

        if self.options.tokenmap:
            tokenmap = {}
            for pair in self.options.tokenmap.split(","):
                token, value = pair.split(":",1)
                tokenmap[token] = value

            if not "RELEASE" in tokenmap and self.options.release:
                tokenmap["RELEASE"] = self.options.release
            if not "BUILD_ID" in tokenmap and "RELEASE" in tokenmap:
                tokenmap["BUILD_ID"] = tokenmap["RELEASE"]

            configmgr.create['tokenmap'] = tokenmap