summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/perl
AgeCommit message (Expand)Author
2020-07-17perl: fix CVE-2020-10543 & CVE-2020-10878Lee Chee Yang
2020-07-17perl: Fix host specific modules problemsRichard Purdie
2020-02-23liberror-perl: upgrade 0.17028 -> 0.17029Tim Orling
2020-02-23perl: Fix makefile race causing configuration differencesRichard Purdie
2020-02-23perl: Fix encode module reproducibility issuesRichard Purdie
2020-02-23perl: fix failing ptestsAlexander Kanavin
2020-02-23perl: improve reproducibilityRoss Burton
2020-02-23libmodule-build-perl: fix ptestsAlexander Kanavin
2020-02-23perl: install typemap and other extutils metadata as part of perl-coreAlexander Kanavin
2020-02-23perl: package Config.pm from arch directory into the main perl packageAlexander Kanavin
2020-02-23perl: update to 5.30.1Alexander Kanavin
2020-02-11perl: Fix various reproducibile build issuesRichard Purdie
2020-02-11perl: do not install files that contain build host specific dataAlexander Kanavin
2020-01-08liberror-perl: update 0.17027 -> 0.17028Tim Orling
2019-10-08perl: Handle PACKAGES_DYNAMIC for perl-nativeKhem Raj
2019-07-31perl: add PACKAGECONFIG for dbRoss Burton
2019-07-31perl: fix whitespaceRoss Burton
2019-07-02perl: fix Upstream-Status tagsRoss Burton
2019-06-21perl: Reproducible build fixesJoshua Watt
2019-06-21perl: Improve ptest package reproducibilityJoshua Watt
2019-06-18libmodule-build-perl: upgrade 0.4224 -> 0.4229; enable ptestTim Orling
2019-06-18libmodule-build-perl: move from meta-perlTim Orling
2019-06-18perl-rdepends.txt: more ptest dependencies fixesTim Orling
2019-06-18perl: Move perl-sanity -> perlRichard Purdie
2019-06-01libxml-perl: Fix module and ptest dependenciesRichard Purdie
2019-06-01liburi-perl: Fix module ptest dependenciesRichard Purdie
2019-06-01libtest-needs-perl: Fix ptest dependenciesRichard Purdie
2019-06-01libxml-parser-perl: fix ptest dependenciesTim Orling
2019-05-22perl/modules: Add various missing ptest perl module dependenciesRichard Purdie
2019-05-16libtest-needs-perl: upgrade 0.002005 -> 0.002006Tim Orling
2019-01-26perl: drop lost patchRuslan Bilovol
2019-01-11perl: remove the previous version of the recipeAlexander Kanavin
2019-01-03perl: Fix race issue for cpan/Pod-SimpleRobert Yang
2018-12-13liberror-perl: upgrade 0.17026 -> 0.17027Tim Orling
2018-10-16perl: skip tests that are not usefulAnuj Mittal
2018-09-25perl: fix race issues for MakeMakerRobert Yang
2018-08-28cpan.bbclass: make RPATH fix more generalJens Rehsack
2018-08-23perl: CVE-2018-12015Jagadeesh Krishnanjanappa
2018-08-23perl: avoid using += with an over-rideAndre McCurdy
2018-08-23libxml-parser-perl: fix "...contains bad RPATH"Jens Rehsack
2018-07-18perl: update to 5.24.4Andrej Valek
2018-06-15liberror-perl: upgrade 0.17025 -> 0.17026Tim Orling
2018-05-22perl-ptest: drop runtime dependency on libsspMartin Jansa
2018-05-15liburi-perl: upgrade 1.73 -> 1.74Tim Orling
2018-05-11perl: native modules will not trigger build perl for target.Krzysztof Taborski
2018-05-11perl: fix CVE-2017-12837Hongxu Jia
2018-05-09perl: Account for libnsl being dropped from glibcKhem Raj
2018-05-04libxml-simple-perl: upgrade 2.24 -> 2.25Tim Orling
2018-04-23perl: Security fix CVE-2017-12883Armin Kuster
2018-04-13meta: add missing Signed-off-by and Upstream-Status tagsRoss Burton
on> OpenEmbedded Core user contribution treesGrokmirror user
aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/scriptutils.py
blob: 5ccc0279685e78ce364e4c24630fc896ad79a976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Script utility functions
#
# Copyright (C) 2014 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import sys
import os
import logging
import glob
import argparse
import subprocess

def logger_create(name):
    logger = logging.getLogger(name)
    loggerhandler = logging.StreamHandler()
    loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
    logger.addHandler(loggerhandler)
    logger.setLevel(logging.INFO)
    return logger

def logger_setup_color(logger, color='auto'):
    from bb.msg import BBLogFormatter
    console = logging.StreamHandler(sys.stdout)
    formatter = BBLogFormatter("%(levelname)s: %(message)s")
    console.setFormatter(formatter)
    logger.handlers = [console]
    if color == 'always' or (color=='auto' and console.stream.isatty()):
        formatter.enable_color()


def load_plugins(logger, plugins, pluginpath):
    import imp

    def load_plugin(name):
        logger.debug('Loading plugin %s' % name)
        fp, pathname, description = imp.find_module(name, [pluginpath])
        try:
            return imp.load_module(name, fp, pathname, description)
        finally:
            if fp:
                fp.close()

    logger.debug('Loading plugins from %s...' % pluginpath)
    for fn in glob.glob(os.path.join(pluginpath, '*.py')):
        name = os.path.splitext(os.path.basename(fn))[0]
        if name != '__init__':
            plugin = load_plugin(name)
            if hasattr(plugin, 'plugin_init'):
                plugin.plugin_init(plugins)
            plugins.append(plugin)

def git_convert_standalone_clone(repodir):
    """If specified directory is a git repository, ensure it's a standalone clone"""
    import bb.process
    if os.path.exists(os.path.join(repodir, '.git')):
        alternatesfile = os.path.join(repodir, '.git', 'objects', 'info', 'alternates')
        if os.path.exists(alternatesfile):
            # This will have been cloned with -s, so we need to convert it so none
            # of the contents is shared
            bb.process.run('git repack -a', cwd=repodir)
            os.remove(alternatesfile)

def fetch_uri(d, uri, destdir, srcrev=None):
    """Fetch a URI to a local directory"""
    import bb.data
    bb.utils.mkdirhier(destdir)
    localdata = bb.data.createCopy(d)
    localdata.setVar('BB_STRICT_CHECKSUM', '')
    localdata.setVar('SRCREV', srcrev)
    ret = (None, None)
    olddir = os.getcwd()
    try:
        fetcher = bb.fetch2.Fetch([uri], localdata)
        for u in fetcher.ud:
            ud = fetcher.ud[u]
            ud.ignore_checksums = True
        fetcher.download()
        for u in fetcher.ud:
            ud = fetcher.ud[u]
            if ud.localpath.rstrip(os.sep) == localdata.getVar('DL_DIR', True).rstrip(os.sep):
                raise Exception('Local path is download directory - please check that the URI "%s" is correct' % uri)
        fetcher.unpack(destdir)
        for u in fetcher.ud:
            ud = fetcher.ud[u]
            if ud.method.recommends_checksum(ud):
                md5value = bb.utils.md5_file(ud.localpath)
                sha256value = bb.utils.sha256_file(ud.localpath)
                ret = (md5value, sha256value)
    finally:
        os.chdir(olddir)
    return ret

def run_editor(fn):
    if isinstance(fn, str):
        params = '"%s"' % fn
    else:
        params = ''
        for fnitem in fn:
            params += ' "%s"' % fnitem

    editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi'))
    try:
        return subprocess.check_call('%s %s' % (editor, params), shell=True)
    except OSError as exc:
        logger.error("Execution of editor '%s' failed: %s", editor, exc)
        return 1

def is_src_url(param):
    """
    Check if a parameter is a URL and return True if so
    NOTE: be careful about changing this as it will influence how devtool/recipetool command line handling works
    """
    if not param:
        return False
    elif '://' in param:
        return True
    elif param.startswith('git@') or ('@' in param and param.endswith('.git')):
        return True
    return False