patman: Move library functions into a library directory
The patman directory has a number of modules which are used by other tools in U-Boot. This makes it hard to package the tools using pypi since the common files must be copied along with the tool that uses them. To address this, move these files into a new u_boot_pylib library. This can be packaged separately and listed as a dependency of each tool. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
00290d6a5b
commit
4583c00236
87 changed files with 182 additions and 151 deletions
|
@ -15,7 +15,7 @@ src_path = os.path.dirname(our_path)
|
|||
sys.path.insert(1, os.path.join(our_path, '../tools'))
|
||||
|
||||
from binman import elf
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# A typical symbol looks like this:
|
||||
# _u_boot_list_2_evspy_info_2_EVT_MISC_INIT_F_3_sandbox_misc_init_f
|
||||
|
|
1
test/run
1
test/run
|
@ -76,6 +76,7 @@ TOOLS_DIR=build-sandbox_spl/tools
|
|||
|
||||
run_test "binman" ./tools/binman/binman --toolpath ${TOOLS_DIR} test
|
||||
run_test "patman" ./tools/patman/patman test
|
||||
run_test "u_boot_pylib" ./tools/u_boot_pylib/u_boot_pylib
|
||||
|
||||
run_test "buildman" ./tools/buildman/buildman -t ${skip}
|
||||
run_test "fdt" ./tools/dtoc/test_fdt -t
|
||||
|
|
|
@ -18,10 +18,10 @@ import shutil
|
|||
import tempfile
|
||||
import urllib.error
|
||||
|
||||
from patman import command
|
||||
from patman import terminal
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
BINMAN_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ import urllib.error
|
|||
from binman import bintool
|
||||
from binman.bintool import Bintool
|
||||
|
||||
from patman import command
|
||||
from patman import terminal
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# pylint: disable=R0904
|
||||
class TestBintool(unittest.TestCase):
|
||||
|
|
|
@ -60,7 +60,7 @@ import re
|
|||
import tempfile
|
||||
|
||||
from binman import bintool
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# pylint: disable=C0103
|
||||
class Bintoollz4(bintool.Bintool):
|
||||
|
|
|
@ -37,7 +37,7 @@ import re
|
|||
import tempfile
|
||||
|
||||
from binman import bintool
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# pylint: disable=C0103
|
||||
class Bintoollzma_alone(bintool.Bintool):
|
||||
|
|
|
@ -22,8 +22,8 @@ import sys
|
|||
|
||||
from binman import bintool
|
||||
from binman import elf
|
||||
from patman import command
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# Set to True to enable printing output while working
|
||||
DEBUG = False
|
||||
|
|
|
@ -20,8 +20,8 @@ from binman import bintool
|
|||
from binman import cbfs_util
|
||||
from binman.cbfs_util import CbfsWriter
|
||||
from binman import elf
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
U_BOOT_DATA = b'1234'
|
||||
U_BOOT_DTB_DATA = b'udtb'
|
||||
|
|
|
@ -12,14 +12,14 @@ import pkg_resources
|
|||
import re
|
||||
|
||||
import sys
|
||||
from patman import tools
|
||||
|
||||
from binman import bintool
|
||||
from binman import cbfs_util
|
||||
from patman import command
|
||||
from binman import elf
|
||||
from binman import entry
|
||||
from patman import tout
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
# These are imported if needed since they import libfdt
|
||||
state = None
|
||||
|
|
|
@ -13,9 +13,9 @@ import shutil
|
|||
import struct
|
||||
import tempfile
|
||||
|
||||
from patman import command
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
ELF_TOOLS = True
|
||||
try:
|
||||
|
|
|
@ -12,10 +12,10 @@ import tempfile
|
|||
import unittest
|
||||
|
||||
from binman import elf
|
||||
from patman import command
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ import time
|
|||
from binman import bintool
|
||||
from binman import elf
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from patman.tools import to_hex, to_hex_size
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib.tools import to_hex, to_hex_size
|
||||
from u_boot_pylib import tout
|
||||
|
||||
modules = {}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from binman import entry
|
|||
from binman.etype.blob import Entry_blob
|
||||
from dtoc import fdt
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class TestEntry(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
@ -9,7 +9,7 @@ from collections import OrderedDict
|
|||
|
||||
from binman.entry import Entry, EntryArg
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
|
||||
class Entry__testing(Entry):
|
||||
|
|
|
@ -11,7 +11,7 @@ from binman.entry import Entry
|
|||
from binman.etype.section import Entry_section
|
||||
from binman.fip_util import FIP_TYPES, FipReader, FipWriter, UUID_LEN
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_atf_fip(Entry_section):
|
||||
"""ARM Trusted Firmware's Firmware Image Package (FIP)
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
from binman.entry import Entry
|
||||
from binman import state
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
class Entry_blob(Entry):
|
||||
"""Arbitrary binary blob
|
||||
|
|
|
@ -9,8 +9,8 @@ import os
|
|||
|
||||
from binman.etype.blob import Entry_blob
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
class Entry_blob_ext(Entry_blob):
|
||||
"""Externally built binary blob
|
||||
|
|
|
@ -9,8 +9,8 @@ import os
|
|||
|
||||
from binman.etype.blob import Entry_blob
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
class Entry_blob_ext_list(Entry_blob):
|
||||
"""List of externally built binary blobs
|
||||
|
|
|
@ -9,8 +9,8 @@ image.
|
|||
"""
|
||||
|
||||
from binman.entry import Entry
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
FDTMAP_MAGIC = b'_FDTMAP_'
|
||||
FDTMAP_HDR_LEN = 16
|
||||
|
|
|
@ -11,7 +11,7 @@ import os
|
|||
|
||||
from binman.etype.section import Entry_section
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# This is imported if needed
|
||||
state = None
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
from binman.entry import Entry
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_fill(Entry):
|
||||
"""An entry which is filled to a particular byte value
|
||||
|
|
|
@ -12,7 +12,7 @@ from binman.etype.section import Entry_section
|
|||
from binman import elf
|
||||
from dtoc import fdt_util
|
||||
from dtoc.fdt import Fdt
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# Supported operations, with the fit,operation property
|
||||
OP_GEN_FDT_NODES, OP_SPLIT_ELF = range(2)
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
from binman.entry import Entry
|
||||
from binman import fmap_util
|
||||
from patman import tools
|
||||
from patman.tools import to_hex_size
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib.tools import to_hex_size
|
||||
from u_boot_pylib import tout
|
||||
|
||||
|
||||
class Entry_fmap(Entry):
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
from collections import OrderedDict
|
||||
|
||||
from patman import command
|
||||
from u_boot_pylib import command
|
||||
from binman.entry import Entry, EntryArg
|
||||
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# Build GBB flags.
|
||||
# (src/platform/vboot_reference/firmware/include/gbb_header.h)
|
||||
|
|
|
@ -10,7 +10,7 @@ from collections import OrderedDict
|
|||
from binman.entry import Entry
|
||||
from binman.etype.blob_ext import Entry_blob_ext
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_intel_ifwi(Entry_blob_ext):
|
||||
"""Intel Integrated Firmware Image (IFWI) file
|
||||
|
|
|
@ -9,7 +9,7 @@ from collections import OrderedDict
|
|||
|
||||
from binman.entry import Entry
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_mkimage(Entry):
|
||||
"""Binary produced by mkimage
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
from binman.entry import Entry
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_null(Entry):
|
||||
"""An entry which has no contents of its own
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import os
|
||||
import struct
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
from binman.entry import Entry
|
||||
from binman.etype.collection import Entry_collection
|
||||
|
|
|
@ -16,9 +16,9 @@ import sys
|
|||
from binman.entry import Entry
|
||||
from binman import state
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from patman.tools import to_hex_size
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
from u_boot_pylib.tools import to_hex_size
|
||||
|
||||
|
||||
class Entry_section(Entry):
|
||||
|
|
|
@ -7,7 +7,7 @@ from collections import OrderedDict
|
|||
|
||||
from binman.entry import Entry, EntryArg
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
|
||||
class Entry_text(Entry):
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
from binman.entry import Entry
|
||||
from binman.etype.blob_dtb import Entry_blob_dtb
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# This is imported if needed
|
||||
state = None
|
||||
|
|
|
@ -9,7 +9,7 @@ from binman.entry import Entry
|
|||
from binman.etype.blob import Entry_blob
|
||||
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_u_boot_elf(Entry_blob):
|
||||
"""U-Boot ELF image
|
||||
|
|
|
@ -8,7 +8,7 @@ import zlib
|
|||
|
||||
from binman.etype.blob import Entry_blob
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_u_boot_env(Entry_blob):
|
||||
"""An entry which contains a U-Boot environment
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
from binman import elf
|
||||
from binman.entry import Entry
|
||||
from binman.etype.blob import Entry_blob
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_u_boot_spl_bss_pad(Entry_blob):
|
||||
"""U-Boot SPL binary padded with a BSS region
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Entry-type module for expanded U-Boot SPL binary
|
||||
#
|
||||
|
||||
from patman import tout
|
||||
from u_boot_pylib import tout
|
||||
|
||||
from binman import state
|
||||
from binman.etype.blob_phase import Entry_blob_phase
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
from binman import elf
|
||||
from binman.entry import Entry
|
||||
from binman.etype.blob import Entry_blob
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_u_boot_tpl_bss_pad(Entry_blob):
|
||||
"""U-Boot TPL binary padded with a BSS region
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Entry-type module for expanded U-Boot TPL binary
|
||||
#
|
||||
|
||||
from patman import tout
|
||||
from u_boot_pylib import tout
|
||||
|
||||
from binman import state
|
||||
from binman.etype.blob_phase import Entry_blob_phase
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
import struct
|
||||
|
||||
from patman import command
|
||||
from binman.entry import Entry
|
||||
from binman.etype.blob import Entry_blob
|
||||
from binman.etype.u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
|
||||
"""U-Boot TPL with embedded microcode pointer
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
from binman.entry import Entry
|
||||
from binman.etype.blob import Entry_blob
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_u_boot_ucode(Entry_blob):
|
||||
"""U-Boot microcode block
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
from binman import elf
|
||||
from binman.entry import Entry
|
||||
from binman.etype.blob import Entry_blob
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_u_boot_vpl_bss_pad(Entry_blob):
|
||||
"""U-Boot VPL binary padded with a BSS region
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Entry-type module for expanded U-Boot VPL binary
|
||||
#
|
||||
|
||||
from patman import tout
|
||||
from u_boot_pylib import tout
|
||||
|
||||
from binman import state
|
||||
from binman.etype.blob_phase import Entry_blob_phase
|
||||
|
|
|
@ -11,8 +11,8 @@ from binman import elf
|
|||
from binman.entry import Entry
|
||||
from binman.etype.blob import Entry_blob
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from patman import command
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import command
|
||||
|
||||
class Entry_u_boot_with_ucode_ptr(Entry_blob):
|
||||
"""U-Boot with embedded microcode pointer
|
||||
|
|
|
@ -13,7 +13,7 @@ from binman.entry import EntryArg
|
|||
from binman.etype.collection import Entry_collection
|
||||
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class Entry_vblock(Entry_collection):
|
||||
"""An entry which contains a Chromium OS verified boot block
|
||||
|
|
|
@ -12,7 +12,7 @@ import unittest
|
|||
from dtoc import fdt
|
||||
from dtoc import fdt_util
|
||||
from dtoc.fdt import FdtScan
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
class TestFdt(unittest.TestCase):
|
||||
@classmethod
|
||||
|
|
|
@ -37,8 +37,8 @@ OUR_PATH = os.path.dirname(OUR_FILE)
|
|||
sys.path.insert(2, os.path.join(OUR_PATH, '..'))
|
||||
|
||||
# pylint: disable=C0413
|
||||
from patman import command
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# The TOC header, at the start of the FIP
|
||||
HEADER_FORMAT = '<IIQ'
|
||||
|
|
|
@ -20,10 +20,10 @@ OUR_PATH = os.path.dirname(os.path.realpath(__file__))
|
|||
sys.path.insert(2, os.path.join(OUR_PATH, '..'))
|
||||
|
||||
# pylint: disable=C0413
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from binman import bintool
|
||||
from binman import fip_util
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
FIPTOOL = bintool.Bintool.create('fiptool')
|
||||
HAVE_FIPTOOL = FIPTOOL.is_present()
|
||||
|
|
|
@ -10,7 +10,7 @@ import collections
|
|||
import struct
|
||||
import sys
|
||||
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# constants imported from lib/fmap.h
|
||||
FMAP_SIGNATURE = b'__FMAP__'
|
||||
|
|
|
@ -34,10 +34,10 @@ from dtoc import fdt_util
|
|||
from binman.etype import fdtmap
|
||||
from binman.etype import image_header
|
||||
from binman.image import Image
|
||||
from patman import command
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
# Contents of test files, corresponding to different entry types
|
||||
U_BOOT_DATA = b'1234'
|
||||
|
|
|
@ -18,8 +18,8 @@ from binman.etype import image_header
|
|||
from binman.etype import section
|
||||
from dtoc import fdt
|
||||
from dtoc import fdt_util
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
class Image(section.Entry_section):
|
||||
"""A Image, representing an output from binman
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import unittest
|
||||
|
||||
from binman.image import Image
|
||||
from patman.test_util import capture_sys_output
|
||||
from u_boot_pylib.test_util import capture_sys_output
|
||||
|
||||
class TestImage(unittest.TestCase):
|
||||
def testInvalidFormat(self):
|
||||
|
|
|
@ -34,7 +34,7 @@ sys.pycache_prefix = os.path.relpath(our_path, srctree)
|
|||
sys.path.insert(2, our1_path)
|
||||
|
||||
from binman import bintool
|
||||
from patman import test_util
|
||||
from u_boot_pylib import test_util
|
||||
|
||||
# Bring in the libfdt module
|
||||
sys.path.insert(2, 'scripts/dtc/pylibfdt')
|
||||
|
@ -44,7 +44,7 @@ sys.path.insert(2, os.path.join(srctree, 'build-sandbox_spl/scripts/dtc/pylibfdt
|
|||
|
||||
from binman import cmdline
|
||||
from binman import control
|
||||
from patman import test_util
|
||||
from u_boot_pylib import test_util
|
||||
|
||||
def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath):
|
||||
"""Run the functional tests and any embedded doctests
|
||||
|
@ -95,7 +95,8 @@ def RunTestCoverage(toolpath):
|
|||
for path in toolpath:
|
||||
extra_args += ' --toolpath %s' % path
|
||||
test_util.run_test_coverage('tools/binman/binman', None,
|
||||
['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*'],
|
||||
['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*',
|
||||
'tools/u_boot_pylib/*'],
|
||||
args.build_dir, all_set, extra_args or None)
|
||||
|
||||
def RunBinman(args):
|
||||
|
|
|
@ -13,8 +13,8 @@ import threading
|
|||
|
||||
from dtoc import fdt
|
||||
import os
|
||||
from patman import tools
|
||||
from patman import tout
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
|
||||
OUR_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@ import time
|
|||
|
||||
from buildman import builderthread
|
||||
from buildman import toolchain
|
||||
from patman import command
|
||||
from patman import gitutil
|
||||
from patman import terminal
|
||||
from patman.terminal import tprint
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib.terminal import tprint
|
||||
|
||||
# This indicates an new int or hex Kconfig property with no default
|
||||
# It hangs the build since the 'conf' tool cannot proceed without valid input.
|
||||
|
|
|
@ -10,8 +10,8 @@ import sys
|
|||
import threading
|
||||
|
||||
from buildman import cfgutil
|
||||
from patman import command
|
||||
from patman import gitutil
|
||||
from u_boot_pylib import command
|
||||
|
||||
RETURN_CODE_RETRY = -1
|
||||
BASE_ELF_FILENAMES = ['u-boot', 'spl/u-boot-spl', 'tpl/u-boot-tpl']
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import re
|
||||
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
RE_LINE = re.compile(r'(# )?CONFIG_([A-Z0-9_]+)(=(.*)| is not set)')
|
||||
RE_CFG = re.compile(r'(~?)(CONFIG_)?([A-Z0-9_]+)(=.*)?')
|
||||
|
|
|
@ -13,12 +13,12 @@ from buildman import bsettings
|
|||
from buildman import cfgutil
|
||||
from buildman import toolchain
|
||||
from buildman.builder import Builder
|
||||
from patman import command
|
||||
from patman import gitutil
|
||||
from patman import patchstream
|
||||
from patman import terminal
|
||||
from patman import tools
|
||||
from patman.terminal import tprint
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib.terminal import tprint
|
||||
|
||||
def GetPlural(count):
|
||||
"""Returns a plural 's' if count is not 1"""
|
||||
|
|
|
@ -14,11 +14,11 @@ from buildman import bsettings
|
|||
from buildman import cmdline
|
||||
from buildman import control
|
||||
from buildman import toolchain
|
||||
from patman import command
|
||||
from patman import gitutil
|
||||
from patman import terminal
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
settings_data = '''
|
||||
# Buildman settings file
|
||||
|
|
|
@ -25,8 +25,8 @@ from buildman import control
|
|||
from buildman import toolchain
|
||||
from patman import patchstream
|
||||
from patman import gitutil
|
||||
from patman import terminal
|
||||
from patman import test_util
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import test_util
|
||||
|
||||
def RunTests(skip_net_tests, verboose, args):
|
||||
from buildman import func_test
|
||||
|
|
|
@ -17,10 +17,10 @@ from buildman import cfgutil
|
|||
from buildman import control
|
||||
from buildman import toolchain
|
||||
from patman import commit
|
||||
from patman import command
|
||||
from patman import terminal
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
use_network = True
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import tempfile
|
|||
import urllib.request, urllib.error, urllib.parse
|
||||
|
||||
from buildman import bsettings
|
||||
from patman import command
|
||||
from patman import terminal
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import tools
|
||||
|
||||
(PRIORITY_FULL_PREFIX, PRIORITY_PREFIX_GCC, PRIORITY_PREFIX_GCC_PATH,
|
||||
PRIORITY_CALC) = list(range(4))
|
||||
|
|
|
@ -12,7 +12,7 @@ import sys
|
|||
from dtoc import fdt_util
|
||||
import libfdt
|
||||
from libfdt import QUIET_NOTFOUND
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# This deals with a device tree, presenting it as an assortment of Node and
|
||||
# Prop objects, representing nodes and properties, respectively. This file
|
||||
|
|
|
@ -13,8 +13,8 @@ import struct
|
|||
import sys
|
||||
import tempfile
|
||||
|
||||
from patman import command
|
||||
from patman import tools
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import tools
|
||||
|
||||
def fdt32_to_cpu(val):
|
||||
"""Convert a device tree cell to an integer
|
||||
|
|
|
@ -35,7 +35,7 @@ sys.path.insert(0, os.path.join(our_path,
|
|||
'../../build-sandbox_spl/scripts/dtc/pylibfdt'))
|
||||
|
||||
from dtoc import dtb_platdata
|
||||
from patman import test_util
|
||||
from u_boot_pylib import test_util
|
||||
|
||||
def run_tests(processes, args):
|
||||
"""Run all the test we have for dtoc
|
||||
|
@ -65,7 +65,8 @@ def RunTestCoverage():
|
|||
"""Run the tests and check that we get 100% coverage"""
|
||||
sys.argv = [sys.argv[0]]
|
||||
test_util.run_test_coverage('tools/dtoc/dtoc', '/main.py',
|
||||
['tools/patman/*.py', '*/fdt*', '*test*'], args.build_dir)
|
||||
['tools/patman/*.py', 'tools/u_boot_pylib/*','*/fdt*', '*test*'],
|
||||
args.build_dir)
|
||||
|
||||
|
||||
if __name__ != '__main__':
|
||||
|
|
|
@ -25,8 +25,8 @@ from dtoc.dtb_platdata import get_value
|
|||
from dtoc.dtb_platdata import tab_to
|
||||
from dtoc.src_scan import conv_name_to_c
|
||||
from dtoc.src_scan import get_compat_name
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
OUR_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ from dtoc import fdt_util
|
|||
from dtoc.fdt_util import fdt32_to_cpu, fdt64_to_cpu
|
||||
from dtoc.fdt import Type, BytesToValue
|
||||
import libfdt
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
#pylint: disable=protected-access
|
||||
|
||||
|
@ -814,7 +814,8 @@ def run_test_coverage(build_dir):
|
|||
build_dir (str): Directory containing the build output
|
||||
"""
|
||||
test_util.run_test_coverage('tools/dtoc/test_fdt.py', None,
|
||||
['tools/patman/*.py', '*test_fdt.py'], build_dir)
|
||||
['tools/patman/*.py', 'tools/u_boot_pylib/*', '*test_fdt.py'],
|
||||
build_dir)
|
||||
|
||||
|
||||
def run_tests(names, processes):
|
||||
|
|
|
@ -15,8 +15,8 @@ import unittest
|
|||
from unittest import mock
|
||||
|
||||
from dtoc import src_scan
|
||||
from patman import test_util
|
||||
from patman import tools
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
OUR_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
__all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
|
||||
'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
|
||||
'project', 'series', 'setup', 'settings', 'terminal',
|
||||
'test_checkpatch', 'test_util', 'tools', 'tout']
|
||||
__all__ = ['checkpatch', 'commit', 'control', 'func_test', 'get_maintainer',
|
||||
'gitutil', '__main__', 'patchstream', 'project', 'series',
|
||||
'settings','setup', 'status', 'test_checkpatch', 'test_settings']
|
||||
|
|
|
@ -24,10 +24,10 @@ from patman import func_test
|
|||
from patman import gitutil
|
||||
from patman import project
|
||||
from patman import settings
|
||||
from patman import terminal
|
||||
from patman import test_util
|
||||
from patman import test_checkpatch
|
||||
from patman import tools
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import test_util
|
||||
from u_boot_pylib import tools
|
||||
|
||||
epilog = '''Create patches from commits in a branch, check them and email them
|
||||
as specified by tags you place in the commits. Use -n to do a dry run first.'''
|
||||
|
@ -150,7 +150,7 @@ if args.cmd == 'test':
|
|||
result = test_util.run_test_suites(
|
||||
'patman', False, False, False, None, None, None,
|
||||
[test_checkpatch.TestPatch, func_test.TestFunctional,
|
||||
'gitutil', 'settings', 'terminal'])
|
||||
'gitutil', 'settings'])
|
||||
|
||||
sys.exit(0 if result.wasSuccessful() else 1)
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import os
|
|||
import re
|
||||
import sys
|
||||
|
||||
from patman import command
|
||||
from patman import gitutil
|
||||
from patman import terminal
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
|
||||
EMACS_PREFIX = r'(?:[0-9]{4}.*\.patch:[0-9]+: )?'
|
||||
TYPE_NAME = r'([A-Z_]+:)?'
|
||||
|
|
|
@ -14,7 +14,7 @@ import sys
|
|||
from patman import checkpatch
|
||||
from patman import gitutil
|
||||
from patman import patchstream
|
||||
from patman import terminal
|
||||
from u_boot_pylib import terminal
|
||||
|
||||
def setup():
|
||||
"""Do required setup before doing anything"""
|
||||
|
|
|
@ -23,9 +23,9 @@ from patman import patchstream
|
|||
from patman.patchstream import PatchStream
|
||||
from patman.series import Series
|
||||
from patman import settings
|
||||
from patman import terminal
|
||||
from patman import tools
|
||||
from patman.test_util import capture_sys_output
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import tools
|
||||
from u_boot_pylib.test_util import capture_sys_output
|
||||
|
||||
import pygit2
|
||||
from patman import status
|
||||
|
|
|
@ -7,8 +7,8 @@ import os
|
|||
import shlex
|
||||
import shutil
|
||||
|
||||
from patman import command
|
||||
from patman import gitutil
|
||||
from u_boot_pylib import command
|
||||
|
||||
|
||||
def find_get_maintainer(script_file_name):
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
from patman import command
|
||||
from patman import settings
|
||||
from patman import terminal
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import terminal
|
||||
|
||||
# True to use --no-decorate - we check this in setup()
|
||||
use_no_decorate = True
|
||||
|
|
|
@ -14,10 +14,10 @@ import queue
|
|||
import shutil
|
||||
import tempfile
|
||||
|
||||
from patman import command
|
||||
from patman import commit
|
||||
from patman import gitutil
|
||||
from patman.series import Series
|
||||
from u_boot_pylib import command
|
||||
|
||||
# Tags that we detect and remove
|
||||
RE_REMOVE = re.compile(r'^BUG=|^TEST=|^BRANCH=|^Review URL:'
|
||||
|
|
|
@ -11,8 +11,8 @@ import os
|
|||
from patman import get_maintainer
|
||||
from patman import gitutil
|
||||
from patman import settings
|
||||
from patman import terminal
|
||||
from patman import tools
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import tools
|
||||
|
||||
# Series-xxx tags that we understand
|
||||
valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
|
||||
|
|
|
@ -18,8 +18,8 @@ import requests
|
|||
|
||||
from patman import patchstream
|
||||
from patman.patchstream import PatchStream
|
||||
from patman import terminal
|
||||
from patman import tout
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import tout
|
||||
|
||||
# Patches which are part of a multi-patch series are shown with a prefix like
|
||||
# [prefix, version, sequence], for example '[RFC, v2, 3/5]'. All but the last
|
||||
|
|
|
@ -10,7 +10,7 @@ import sys
|
|||
import tempfile
|
||||
|
||||
from patman import settings
|
||||
from patman import tools
|
||||
from u_boot_pylib import tools
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
|
@ -28,7 +28,7 @@ import os
|
|||
import re
|
||||
import sys
|
||||
|
||||
from patman import command
|
||||
from u_boot_pylib import command
|
||||
|
||||
def rm_kconfig_include(path):
|
||||
"""Remove a path from Kconfig files
|
||||
|
|
4
tools/u_boot_pylib/__init__.py
Normal file
4
tools/u_boot_pylib/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
__all__ = ['command', 'cros_subprocess','terminal', 'test_util', 'tools',
|
||||
'tout']
|
23
tools/u_boot_pylib/__main__.py
Executable file
23
tools/u_boot_pylib/__main__.py
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Allow 'from u_boot_pylib import xxx to work'
|
||||
our_path = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.append(os.path.join(our_path, '..'))
|
||||
|
||||
# Run tests
|
||||
from u_boot_pylib import terminal
|
||||
from u_boot_pylib import test_util
|
||||
|
||||
result = test_util.run_test_suites(
|
||||
'u_boot_pylib', False, False, False, None, None, None,
|
||||
['terminal'])
|
||||
|
||||
sys.exit(0 if result.wasSuccessful() else 1)
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import os
|
||||
|
||||
from patman import cros_subprocess
|
||||
from u_boot_pylib import cros_subprocess
|
||||
|
||||
"""Shell command ease-ups for Python."""
|
||||
|
|
@ -11,7 +11,7 @@ import os
|
|||
import sys
|
||||
import unittest
|
||||
|
||||
from patman import command
|
||||
from u_boot_pylib import command
|
||||
|
||||
from io import StringIO
|
||||
|
|
@ -11,8 +11,8 @@ import sys
|
|||
import tempfile
|
||||
import urllib.request
|
||||
|
||||
from patman import command
|
||||
from patman import tout
|
||||
from u_boot_pylib import command
|
||||
from u_boot_pylib import tout
|
||||
|
||||
# Output directly (generally this is temporary)
|
||||
outdir = None
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import sys
|
||||
|
||||
from patman import terminal
|
||||
from u_boot_pylib import terminal
|
||||
|
||||
# Output verbosity levels that we support
|
||||
ERROR, WARNING, NOTICE, INFO, DETAIL, DEBUG = range(6)
|
1
tools/u_boot_pylib/u_boot_pylib
Symbolic link
1
tools/u_boot_pylib/u_boot_pylib
Symbolic link
|
@ -0,0 +1 @@
|
|||
__main__.py
|
Loading…
Reference in a new issue