Exemplo n.º 1
0
def php(b, r):
    logging.info('searching for PEAR/PECL packages')

    # Precompile a pattern for parsing the output of `{pear,pecl} list`.
    pattern = re.compile(r'^([0-9a-zA-Z_]+)\s+([0-9][0-9a-zA-Z\.-]*)\s')

    # PEAR packages are managed by `php-pear` (obviously).  PECL packages
    # are managed by `php5-dev` because they require development headers
    # (less obvious but still makes sense).
    if util.lsb_release_codename() is None:
        pecl_manager = 'php-devel'
    else:
        pecl_manager = 'php5-dev'
    for manager, progname in (('php-pear', 'pear'),
                              (pecl_manager, 'pecl')):

        try:
            p = subprocess.Popen([progname, 'list', '-a'],
                                 close_fds=True, stdout=subprocess.PIPE)
        except OSError:
            continue
        for line in p.stdout:
            match = pattern.match(line)
            if match is None:
                continue
            package, version = match.group(1), match.group(2)
            if not r.ignore_package(manager, package):
                b.add_package(manager, package, version)
Exemplo n.º 2
0
def php(b):
    logging.info('searching for PEAR/PECL packages')

    # Precompile a pattern for parsing the output of `{pear,pecl} list`.
    pattern = re.compile(r'^([0-9a-zA-Z_]+)\s+([0-9][0-9a-zA-Z\.-]*)\s')

    # PEAR packages are managed by `php-pear` (obviously).  PECL packages
    # are managed by `php5-dev` because they require development headers
    # (less obvious but still makes sense).
    if util.lsb_release_codename() is None:
        pecl_manager = 'php-devel'
    else:
        pecl_manager = 'php5-dev'
    for manager, progname in (('php-pear', 'pear'), (pecl_manager, 'pecl')):

        try:
            p = subprocess.Popen([progname, 'list'],
                                 close_fds=True,
                                 stdout=subprocess.PIPE)
        except OSError:
            continue
        for line in p.stdout:
            match = pattern.match(line)
            if match is None:
                continue
            package, version = match.group(1), match.group(2)
            if not ignore.package(manager, package):
                b.add_package(manager, package, version)
Exemplo n.º 3
0
def gem(b):
    logging.info('searching for Ruby gems')

    # Precompile a pattern for extracting the version of Ruby that was used
    # to install the gem.
    pattern = re.compile(r'gems/([^/]+)/gems')

    # Look for gems in all the typical places.  This is easier than looking
    # for `gem` commands, which may or may not be on `PATH`.
    for globname in ('/usr/lib/ruby/gems/*/gems',
                     '/usr/local/lib/ruby/gems/*/gems',
                     '/var/lib/gems/*/gems'):
        for dirname in glob.glob(globname):

            # The `ruby1.9.1` (really 1.9.2) package on Maverick begins
            # including RubyGems in the `ruby1.9.1` package and marks the
            # `rubygems1.9.1` package as virtual.  So for Maverick and
            # newer, the manager is actually `ruby1.9.1`.
            match = pattern.search(dirname)
            if '1.9.1' == match.group(1) and util.rubygems_virtual():
                manager = 'ruby{0}'.format(match.group(1))

            # RPM-based distros just have one RubyGems package.
            elif util.lsb_release_codename() is None:
                manager = 'rubygems'

            # Debian-based distros qualify the package name with the version
            # of Ruby it will use.
            else:
                manager = 'rubygems{0}'.format(match.group(1))

            for entry in os.listdir(dirname):
                try:
                    package, version = entry.rsplit('-', 1)
                except ValueError:
                    logging.warning(
                        'skipping questionably named gem {0}'.format(entry))
                    continue
                if not ignore.package(manager, package):
                    b.add_package(manager, package, version)
Exemplo n.º 4
0
def gem(b):
    logging.info('searching for Ruby gems')

    # Precompile a pattern for extracting the version of Ruby that was used
    # to install the gem.
    pattern = re.compile(r'gems/([^/]+)/gems')

    # Look for gems in all the typical places.  This is easier than looking
    # for `gem` commands, which may or may not be on `PATH`.
    for globname in ('/usr/lib/ruby/gems/*/gems',
                     '/usr/local/lib/ruby/gems/*/gems',
                     '/var/lib/gems/*/gems'):
        for dirname in glob.glob(globname):

            # The `ruby1.9.1` (really 1.9.2) package on Maverick begins
            # including RubyGems in the `ruby1.9.1` package and marks the
            # `rubygems1.9.1` package as virtual.  So for Maverick and
            # newer, the manager is actually `ruby1.9.1`.
            match = pattern.search(dirname)
            if '1.9.1' == match.group(1) and util.rubygems_virtual():
                manager = 'ruby{0}'.format(match.group(1))

            # RPM-based distros just have one RubyGems package.
            elif util.lsb_release_codename() is None:
                manager = 'rubygems'

            # Debian-based distros qualify the package name with the version
            # of Ruby it will use.
            else:
                manager = 'rubygems{0}'.format(match.group(1))

            for entry in os.listdir(dirname):
                try:
                    package, version = entry.rsplit('-', 1)
                except ValueError:
                    logging.warning('skipping questionably named gem {0}'.
                                    format(entry))
                    continue
                if not ignore.package(manager, package):
                    b.add_package(manager, package, version)