aboutsummaryrefslogtreecommitdiffstats
path: root/meta-perl
AgeCommit message (Expand)Author
2016-04-12libtest-harness-perl: update to 3.36Derek Straka
2016-04-12libxml-sax-writer-perl: update to 0.56Derek Straka
2016-01-06mime-construct: Perform more mangling for perl pathRoy Li
2016-01-04mime-construct: move from meta-networking to meta-perlKai Kang
2015-12-18libproc-waitstat-perl: add recipeKai Kang
2015-12-18libipc-signal-perl: add recipeKai Kang
2015-12-18libnet-dns-perl: remove it from PNBLACKLISTLi xin
2015-12-18libnet-ssleay-perl: fix test failures with opensslHongxu Jia
2015-12-18libhtml-tree-perl: fix shebangHongxu Jia
2015-11-16libauthen-sasl-perl, libdigest-hmac-perl, libio-socket-ssl-perl: don't set PA...Martin Jansa
2015-11-11libhtml-tree-perl: add version 5.03Hongxu Jia
2015-11-11libmodule-build-perl: add 0.31Hongxu Jia
2015-10-13libnet-dns-perl: blacklist, fails to build with current perlMartin Jansa
2015-08-24librole-tiny-perl: add 2.000001 recipeTim Orling
2015-08-24libmoo-perl: add 2.000002 recipeTim Orling
2015-08-24librole-tiny-perl: add 2.000001 recipeTim Orling
2015-08-24libstrictures-perl: add 2.000001 recipeTim Orling
2015-08-24libio-stringy-perl: add 2.111 recipeTim Orling
2015-08-24libimport-into-perl: add 1.002004 recipeTim Orling
2015-08-24libextutils-parsexs-perl: add 3.24 recipeTim Orling
2015-08-24libencode-locale-perl: add 1.05 recipeTim Orling
2015-08-24libencode-perl: add 2.76 recipeTim Orling
2015-08-24libdevel-globaldestruction-perl: add 0.13 recipeTim Orling
2015-08-24libsub-exporter-progressive-perl: add 0.001011 recipeTim Orling
2015-08-24libclass-method-modifiers-perl: add 2.11 recipeTim Orling
2015-08-24libcapture-tiny-perl: update to 0.30Tim Orling
2015-08-18libmodule-runtime-perl: update to 0.015Tim Orling
2015-08-18libmodule-pluggable-perl: Update to 5.2Tim Orling
2015-08-18libextutils-cppguess-perl: update to 0.09Tim Orling
2015-07-30libxml-libxml-perl: update from 2.0116 to 2.0121Wenzong Fan
2015-05-13libnet-ssleay-perl: fix QA warningArmin Kuster
2015-01-15adduser: add new recipeJackie Huang
2014-12-19libnet-dns-perl: move package to mete-perl.Armin Kuster
2014-12-19libcurses-perl: move to meta-perlArmin Kuster
2014-12-19libhtml-parser-perl: move package from meta-security to meta-perlArmin Kuster
2014-12-09libnet-ssleay-perl: avoid host contaminationKang Kai
2014-11-28meta-perl: Add LAYERVERSION and LAYERDEPENDSJackie Huang
2014-09-26meta-perl: fix for eglibc-gconvsRobert Yang
2014-09-01libmodule-pluggable-perl: add 5.1Tim Orling
2014-08-21libmime-types-perl: add recipeKang Kai
2014-08-21libio-socket-ssl-perl: add recipeKang Kai
2014-08-21libnet-ssleay-perl: add recipeKang Kai
2014-08-21libauthen-sasl-perl: add recipeKang Kai
2014-08-21libdigest-hmac-perl: add recipeKang Kai
2014-08-21libdigest-sha1-perl: add recipeKang Kai
2014-08-11libmodule-build-tiny-perl: fix RDEPENDSTim Orling
2014-08-11libextutils-helpers-perl: fix RDEPENDSTim Orling
2014-08-01libxml-filter-buffertext-perl: add recipeRoy Li
2014-08-01libxml-sax-writer-perl: add recipeRoy Li
2014-07-22libxml-libxml-perl: add recipeRoy Li
'rpurdie/master-next'>rpurdie/master-next OpenEmbedded Core user contribution treesGrokmirror user
summaryrefslogtreecommitdiffstats
path: root/lib/bb/__init__.py
blob: 660fd5bf5a2ace505d375ee768063e556e463b92 (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Build System Python Library
#
# Copyright (C) 2003  Holger Schurig
# Copyright (C) 2003, 2004  Chris Larson
#
# Based on Gentoo's portage.py.
#
# 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.

__version__ = "1.17.0"

import sys
if sys.version_info < (2, 6, 0):
    raise RuntimeError("Sorry, python 2.6.0 or later is required for this version of bitbake")


class BBHandledException(Exception):
    """
    The big dilemma for generic bitbake code is what information to give the user
    when an exception occurs. Any exception inheriting this base exception class
    has already provided information to the user via some 'fired' message type such as
    an explicitly fired event using bb.fire, or a bb.error message. If bitbake 
    encounters an exception derived from this class, no backtrace or other information 
    will be given to the user, its assumed the earlier event provided the relevant information.
    """
    pass

import os
import logging


class NullHandler(logging.Handler):
    def emit(self, record):
        pass

Logger = logging.getLoggerClass()
class BBLogger(Logger):
    def __init__(self, name):
        if name.split(".")[0] == "BitBake":
            self.debug = self.bbdebug
        Logger.__init__(self, name)

    def bbdebug(self, level, msg, *args, **kwargs):
        return self.log(logging.DEBUG - level + 1, msg, *args, **kwargs)

    def plain(self, msg, *args, **kwargs):
        return self.log(logging.INFO + 1, msg, *args, **kwargs)

    def verbose(self, msg, *args, **kwargs):
        return self.log(logging.INFO - 1, msg, *args, **kwargs)

logging.raiseExceptions = False
logging.setLoggerClass(BBLogger)

logger = logging.getLogger("BitBake")
logger.addHandler(NullHandler())
logger.setLevel(logging.DEBUG - 2)

# This has to be imported after the setLoggerClass, as the import of bb.msg
# can result in construction of the various loggers.
import bb.msg

if "BBDEBUG" in os.environ:
    level = int(os.environ["BBDEBUG"])
    if level:
        bb.msg.set_debug_level(level)

from bb import fetch2 as fetch
sys.modules['bb.fetch'] = sys.modules['bb.fetch2']

# Messaging convenience functions
def plain(*args):
    logger.plain(''.join(args))

def debug(lvl, *args):
    if isinstance(lvl, basestring):
        logger.warn("Passed invalid debug level '%s' to bb.debug", lvl)
        args = (lvl,) + args
        lvl = 1
    logger.debug(lvl, ''.join(args))

def note(*args):
    logger.info(''.join(args))

def warn(*args):
    logger.warn(''.join(args))

def error(*args):
    logger.error(''.join(args))

def fatal(*args):
    logger.critical(''.join(args))
    sys.exit(1)


def deprecated(func, name=None, advice=""):
    """This is a decorator which can be used to mark functions
    as deprecated. It will result in a warning being emmitted
    when the function is used."""
    import warnings

    if advice:
        advice = ": %s" % advice
    if name is None:
        name = func.__name__

    def newFunc(*args, **kwargs):
        warnings.warn("Call to deprecated function %s%s." % (name,
                                                             advice),
                      category=DeprecationWarning,
                      stacklevel=2)
        return func(*args, **kwargs)
    newFunc.__name__ = func.__name__
    newFunc.__doc__ = func.__doc__
    newFunc.__dict__.update(func.__dict__)
    return newFunc

# For compatibility
def deprecate_import(current, modulename, fromlist, renames = None):
    """Import objects from one module into another, wrapping them with a DeprecationWarning"""
    import sys

    module = __import__(modulename, fromlist = fromlist)
    for position, objname in enumerate(fromlist):
        obj = getattr(module, objname)
        newobj = deprecated(obj, "{0}.{1}".format(current, objname),
                            "Please use {0}.{1} instead".format(modulename, objname))
        if renames:
            newname = renames[position]
        else:
            newname = objname

        setattr(sys.modules[current], newname, newobj)

deprecate_import(__name__, "bb.fetch", ("MalformedUrl", "encodeurl", "decodeurl"))
deprecate_import(__name__, "bb.utils", ("mkdirhier", "movefile", "copyfile", "which"))
deprecate_import(__name__, "bb.utils", ["vercmp_string"], ["vercmp"])