How to use the pkgbuilder.DS.fancy_msg2 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 / transaction.py View on Github external
def install(self, sudo_tested=False, quiet=False):
        """Install packages through ``pacman -U``.

        :param bool sudo_tested: if sudo was tested (password prompt)
        :param bool quiet: suppress messages
        :return: pacman return code
        :rtype: int
        """
        if not sudo_tested:
            self._test_sudo()
        if not quiet:
            DS.fancy_msg2(_('Installing with pacman -U...'))

        npkgpaths = self.pacman_pkgpaths
        uopt = self.uopt.strip()

        if self.asdeps:
            uopt = uopt + ' --asdeps'

        if not DS.confirm:
            uopt = uopt + ' --noconfirm'

        uopt = uopt.strip()

        if uopt:
            DS.log.debug('$PACMAN -U {0} {1}'.format(uopt, npkgpaths))
            ret = DS.sudo([DS.paccommand, '-U'] + uopt.split(' ') + npkgpaths)
        else:
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
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)
    subpackages = find_subpackages(os.path.abspath('./.SRCINFO'))

    if performdepcheck:
        DS.fancy_msg(_('Checking dependencies...'))
        depends = prepare_deps(os.path.abspath('./.SRCINFO'))
        deps = depcheck(depends, pkg)
        pkgtypes = [_('found in system'), _('found in repos'),
                    _('found in the AUR')]
        aurbuild = []
        if not deps:
            DS.fancy_msg2(_('none found'))

        for dpkg, pkgtype in deps.items():
            if pkgtype == 2 and dpkg not in subpackages:
                # If we didn’t check for subpackages, we would get an infinite
                # loop if subpackages depended on each other
                aurbuild.append(dpkg)
            elif dpkg in subpackages:
                DS.log.debug("Package depends on itself, ignoring")

            DS.fancy_msg2(': '.join((dpkg, pkgtypes[pkgtype])))
        if aurbuild != []:
            os.chdir('../')
            return [RES_AURDEPS, aurbuild]

    # Edit the pkgbuild
    if pkgbuild_edit:
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
'without -w, --buildonly or install dependencies '
                      'manually and try again.'),
                    'auto_build deps')

            toinstall2 = []
            sigs2 = []
            for pkgname2 in build_result[1]:
                toinstall = []
                if pkgname2 in completelist:
                    if (completelist.index(pkgname2) <
                            completelist.index(pkgname)):
                        # Already built the package.
                        toinstall, sigs = find_packagefile(
                            os.path.join(os.getcwd(), pkgname2))
                        if toinstall:
                            DS.fancy_msg2(_('found an existing package for '
                                            '{0}').format(pkgname2))
                        # Note that the package will be reinstalled later.
                        # This, however, isn’t a problem.
                    else:
                        # We won’t rebuild it and reinstall it later.  Doing
                        # that solely because I can and because this won’t
                        # introduce hacks.
                        completelist.remove(pkgname2)

                if not toinstall:
                    try:
                        br = auto_build(
                            pkgname2, performdepcheck, pkginstall,
                            build_result[1])
                        toinstall, sigs = br[1]
                    except IndexError:
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
deps = depcheck(depends, pkg)
        pkgtypes = [_('found in system'), _('found in repos'),
                    _('found in the AUR')]
        aurbuild = []
        if not deps:
            DS.fancy_msg2(_('none found'))

        for dpkg, pkgtype in deps.items():
            if pkgtype == 2 and dpkg not in subpackages:
                # If we didn’t check for subpackages, we would get an infinite
                # loop if subpackages depended on each other
                aurbuild.append(dpkg)
            elif dpkg in subpackages:
                DS.log.debug("Package depends on itself, ignoring")

            DS.fancy_msg2(': '.join((dpkg, pkgtypes[pkgtype])))
        if aurbuild != []:
            os.chdir('../')
            return [RES_AURDEPS, aurbuild]

    # Edit the pkgbuild
    if pkgbuild_edit:
        continue_install = edit_pkgbuild(pkg.packagebase)
        if not continue_install:
            return [RES_ABORT, ([], [])]

    mpparams = ['makepkg', '-sf']

    if DS.clean:
        mpparams.append('-c')

    if not DS.pgpcheck:
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
def move(self, sudo_tested=False, quiet=False):
        """Move package and signature files to pacman cache.

        :param bool sudo_tested: if sudo was tested (password prompt)
        :param bool quiet: suppress messages
        :return: 0 on success, +mv return, -failed files
        :rtype: int
        """
        if not sudo_tested:
            self._test_sudo()
        if not quiet:
            DS.fancy_msg2(_('Moving to /var/cache/pacman/pkg/...'))

        pkgpaths = []
        sigpaths = []
        failed_files = 0
        for p in self.pkgpaths:
            pacp = self._pacman_pkgpath(p)
            if p == pacp:
                DS.log.warning("Not moving package file {0} -- "
                               "already in pacman cache".format(p))
            elif os.path.exists(p):
                pkgpaths.append(p)
            elif os.path.exists(pacp):
                DS.log.warning("Not moving package file {0} -- "
                               "found in pacman cache".format(p))
            else:
                DS.log.error("Not moving package file {0} -- "
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
else:
            wrong = 0

        for pkgname in self.pkgnames:
            lpkg = localdb.get_pkg(pkgname)
            try:
                aurversion = aurpkgs[pkgname]
            except KeyError:
                if not lpkg:
                    if not quiet:
                        DS.fancy_error2(_('{0}: not an AUR package').format(
                                        pkgname))
                else:
                    wrong -= 1
                    if not quiet:
                        DS.fancy_msg2(_('{0}: installed {1}').format(
                                      pkgname, lpkg.version))
            else:
                if not lpkg:
                    if not quiet:
                        DS.fancy_error2(_('{0}: NOT installed').format(
                            pkgname))
                else:
                    if pyalpm.vercmp(aurversion, lpkg.version) > 0:
                        if not quiet:
                            DS.fancy_error2(_('{0}: outdated {1}').format(
                                pkgname, lpkg.version))
                    else:
                        wrong -= 1
                        if not quiet:
                            DS.fancy_msg2(_('{0}: installed {1}').format(
                                pkgname, lpkg.version))