How to use the pkgbuilder.DS.log.debug function in pkgbuilder

To help you get started, we’ve selected a few pkgbuilder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
args.debug, args.nodebug):
            DS.debugmode(nochange=True)
            DS.log.info('*** PKGBUILDer v{0}'.format(__version__))
            DS.log.debug('*** debug output on.')

        DS.log.info('Arguments parsed.  {0}'.format(args.__dict__))

        if 'VIRTUAL_ENV' in os.environ:
            DS.log.error("virtualenv detected, exiting.")
            DS.fancy_error(_("PKGBUILDer cannot work in a virtualenv, "
                             "exiting."))
            exit(83)

        if not DS.colors_status:
            DS.colorsoff()
            DS.log.debug('Colors turned off.')

        if args.info:
            DS.log.debug('Showing info...')

            pkgs = pkgbuilder.utils.info(pkgnames)
            foundnames = [i.name for i in pkgs]
            if pkgs:
                pkgbuilder.utils.print_package_info(pkgs)
                qs = 0
            elif not pkgnames:
                qs = 0
            else:
                for i in pkgnames:
                    if i not in foundnames:
                        print(_("error: package '{0}' was not "
                                "found").format(i))
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
pkg, False, True) + '\n'
                else:
                    output = output + pkgbuilder.utils.print_package_search(
                        pkg, True, True) + '\n'
            if output != '':
                print(output.rstrip())
            if quit:
                exit(0)

        if args.finst:
            pkgbuilder.build.install(pkgnames, [], False)
            if quit:
                exit(0)

        if args.pac:
            DS.log.debug('-S passed, building in /tmp/.')
            path = '/tmp/pkgbuilder-{0}'.format(str(DS.uid))
            if not os.path.exists(path):
                os.mkdir(path)
            os.chdir(path)

        if args.upgrade > 0:
            DS.root_crash()
            DS.log.info('Starting upgrade...')
            dodowngrade = args.upgrade > 1
            upnames = pkgbuilder.upgrade.auto_upgrade(dodowngrade, args.vcsup)
            pkgnames = upnames + pkgnames

        if args.fetch:
            pkgbuilder.build.fetch_runner(pkgnames)
            if quit:
                exit(0)
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
tx = pkgbuilder.transaction.Transaction.load(fname)
                tx.delete = DS.clean
                tx.run()
                if quit and tx.exitcode != 0:
                    exit(tx.exitcode)
            if quit:
                exit(0)

        user_chdir = DS.config.get('extras', 'chdir').strip()

        if user_chdir:
            DS.log.debug('Changing directory to %s (via config)', user_chdir)
            os.makedirs(user_chdir, exist_ok=True)
            os.chdir(user_chdir)
        elif DS.pacman:
            DS.log.debug('-S passed, building in /tmp/.')
            path = '/tmp/pkgbuilder-{0}'.format(str(DS.uid))
            if not os.path.exists(path):
                os.mkdir(path)
            os.chdir(path)

        if args.upgrade:
            DS.root_crash()
            DS.log.info('Starting upgrade...')
            dodowngrade = args.upgrade > 1
            ignorelist = []
            for i in (args.ignorelist or []):
                # `pacman -Syu --ignore a,b --ignore c` → ignores a, b, c
                ignorelist.extend(i.split(','))
            upnames = pkgbuilder.upgrade.auto_upgrade(
                dodowngrade, DS.vcsupgrade, DS.fetch, ignorelist)
            pkgnames = upnames + pkgnames
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
args.pgpcheck, args.nopgpcheck)
        DS.confirm = DS.get_setting('--confirm', 'options', 'confirm',
                                    args.confirm, args.noconfirm)
        DS.deepclone = DS.get_setting('--deep', 'options', 'deepclone',
                                      args.deepclone, args.shallowclone)
        DS.colors_status = DS.get_setting('--colors', 'options', 'colors',
                                          args.colors, args.nocolors)
        DS.edit_pkgbuild = DS.get_setting('--edit-pkgbuild', 'options', 'edit_pkgbuild',
                                          args.edit_pkgbuild, args.noedit_pkgbuild)
        pkgnames = args.pkgnames

        if DS.get_setting('--debug', 'options', 'debug',
                          args.debug, args.nodebug):
            DS.debugmode(nochange=True)
            DS.log.info('*** PKGBUILDer v{0}'.format(__version__))
            DS.log.debug('*** debug output on.')

        DS.log.info('Arguments parsed.  {0}'.format(args.__dict__))

        if 'VIRTUAL_ENV' in os.environ:
            DS.log.error("virtualenv detected, exiting.")
            DS.fancy_error(_("PKGBUILDer cannot work in a virtualenv, "
                             "exiting."))
            exit(83)

        if not DS.colors_status:
            DS.colorsoff()
            DS.log.debug('Colors turned off.')

        if args.info:
            DS.log.debug('Showing info...')
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
if args.debug:
            DS.debugmode(nochange=True)
            DS.log.info('*** PKGBUILDer v{0}'.format(__version__))
            DS.log.debug('*** debug output on.')

        DS.log.info('Arguments parsed.  {0}'.format(args.__dict__))

        if 'VIRTUAL_ENV' in os.environ:
            DS.log.error("virtualenv detected, exiting.")
            DS.fancy_error(_("PKGBUILDer cannot work in a virtualenv, "
                             "exiting."))
            exit(83)

        if not args.color:
            DS.colorsoff()
            DS.log.debug('Colors turned off.')

        if args.info:
            DS.log.debug('Showing info...')

            pkgs = pkgbuilder.utils.info(pkgnames)
            foundnames = [i.name for i in pkgs]
            if pkgs:
                pkgbuilder.utils.print_package_info(pkgs)
                qs = 0
            else:
                for i in pkgnames:
                    if i not in foundnames:
                        print(_("error: package '{0}' was not "
                                "found").format(i))
                        qs = 1
            if quit:
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
DS.log.debug('*** debug output on.')

        DS.log.info('Arguments parsed.  {0}'.format(args.__dict__))

        if 'VIRTUAL_ENV' in os.environ:
            DS.log.error("virtualenv detected, exiting.")
            DS.fancy_error(_("PKGBUILDer cannot work in a virtualenv, "
                             "exiting."))
            exit(83)

        if not DS.colors_status:
            DS.colorsoff()
            DS.log.debug('Colors turned off.')

        if args.info:
            DS.log.debug('Showing info...')

            pkgs = pkgbuilder.utils.info(pkgnames)
            foundnames = [i.name for i in pkgs]
            if pkgs:
                pkgbuilder.utils.print_package_info(pkgs)
                qs = 0
            elif not pkgnames:
                qs = 0
            else:
                for i in pkgnames:
                    if i not in foundnames:
                        print(_("error: package '{0}' was not "
                                "found").format(i))
                        qs = 1
            if quit:
                exit(qs)
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
DS.log.warning("Not moving signature file {0} -- "
                               "already in pacman cache".format(s))
            elif os.path.exists(s):
                sigpaths.append(s)
            elif os.path.exists(pacs):
                DS.log.warning("Not moving signature file {0} -- "
                               "found in pacman cache".format(s))
            else:
                DS.log.error("Not moving signature file {0} -- "
                             "not found".format(s))
                if not quiet:
                    DS.fancy_warning2(_("Signature file {0} not found").format(
                        s))
                failed_files += 1

        DS.log.debug('mv {0} {1} /var/cache/pacman/pkg/'.format(
            pkgpaths, sigpaths))
        ret = -failed_files
        if pkgpaths or sigpaths:
            ret = DS.sudo(['mv'] + pkgpaths + sigpaths +
                          ['/var/cache/pacman/pkg/'])
        self._set_status_from_return(ret, TransactionStatus.moved,
                                     TransactionStatus.move_failed)
        return ret
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
if not pkginstall:
                existing = ([], [])
            return [RES_EXISTING, existing]
        try:
            os.chdir('./{0}'.format(pkg.name))
        except FileNotFoundError:
            raise pkgbuilder.exceptions.PBException(
                'The package download failed.\n    This package might '
                'be generated from a split PKGBUILD.  Please find out the '
                'name of the “main” package (eg. python- instead of python2-) '
                'and try again.', pkg.name, exit=False)

        if not os.path.exists('.SRCINFO'):
            # Create a .SRCINFO file for ASP/repo packages.
            # Slightly hacky, but saves us work on parsing bash.
            DS.log.debug("Creating .SRCINFO for repository package")
            srcinfo = subprocess.check_output(["makepkg", "--printsrcinfo"])
            with open(".SRCINFO", "wb") as fh:
                fh.write(srcinfo)
    else:
        existing = find_packagefile(pkg.packagebase)
        if any(pkg.name in i for i in existing[0]):
            DS.fancy_msg(_('Found an existing package for '
                           '{0}').format(pkgname))
            if not pkginstall:
                existing = ([], [])
            return [RES_EXISTING, existing]
        DS.fancy_msg(_('Cloning the git repository...'))
        clone(pkg.packagebase)
        os.chdir('./{0}/'.format(pkg.packagebase))
        if not os.path.exists('.SRCINFO'):
            raise pkgbuilder.exceptions.EmptyRepoError(pkg.packagebase)