Merge git://git.denx.de/u-boot-dm

This commit is contained in:
Tom Rini 2017-09-12 09:32:51 -04:00
commit de2ad2c40d
26 changed files with 191 additions and 56 deletions

View file

@ -224,9 +224,7 @@ tegra_xusb_padctl_config_parse_dt(struct tegra_xusb_padctl *padctl,
config->name = ofnode_get_name(node); config->name = ofnode_get_name(node);
for (subnode = ofnode_first_subnode(node); ofnode_for_each_subnode(subnode, node) {
ofnode_valid(subnode);
subnode = ofnode_next_subnode(subnode)) {
struct tegra_xusb_padctl_group *group; struct tegra_xusb_padctl_group *group;
int err; int err;
@ -256,9 +254,7 @@ static int tegra_xusb_padctl_parse_dt(struct tegra_xusb_padctl *padctl,
return err; return err;
} }
for (subnode = ofnode_first_subnode(node); ofnode_for_each_subnode(subnode, node) {
ofnode_valid(subnode);
subnode = ofnode_next_subnode(subnode)) {
struct tegra_xusb_padctl_config *config = &padctl->config; struct tegra_xusb_padctl_config *config = &padctl->config;
debug("%s: subnode=%s\n", __func__, ofnode_get_name(subnode)); debug("%s: subnode=%s\n", __func__, ofnode_get_name(subnode));

View file

@ -18,4 +18,26 @@ config SYS_CONFIG_NAME
default "sandbox_spl" if SANDBOX_SPL default "sandbox_spl" if SANDBOX_SPL
default "sandbox" if !SANDBOX_SPL default "sandbox" if !SANDBOX_SPL
choice
prompt "Run sandbox on 32/64-bit host"
default SANDBOX_64BIT
help
Sandbox can be built on 32-bit and 64-bit hosts.
The default is to build on a 64-bit host and run
on a 64-bit host. If you want to run sandbox on
a 32-bit host, change it here.
config SANDBOX_32BIT
bool "32-bit host"
config SANDBOX_64BIT
bool "64-bit host"
endchoice
config SANDBOX_BITS_PER_LONG
int
default 32 if SANDBOX_32BIT
default 64 if SANDBOX_64BIT
endmenu endmenu

View file

@ -127,11 +127,13 @@
compatible = "denx,u-boot-fdt-test"; compatible = "denx,u-boot-fdt-test";
}; };
clocks {
clk_fixed: clk-fixed { clk_fixed: clk-fixed {
compatible = "fixed-clock"; compatible = "fixed-clock";
#clock-cells = <0>; #clock-cells = <0>;
clock-frequency = <1234>; clock-frequency = <1234>;
}; };
};
clk_sandbox: clk-sbox { clk_sandbox: clk-sbox {
compatible = "sandbox,clk"; compatible = "sandbox,clk";

View file

@ -24,6 +24,9 @@ single board in board/sandbox.
CONFIG_SANDBOX_BIG_ENDIAN should be defined when running on big-endian CONFIG_SANDBOX_BIG_ENDIAN should be defined when running on big-endian
machines. machines.
By default sandbox builds and runs on 64-bit hosts. If you are going to build
and run sandbox on a 32-bit host, select CONFIG_SANDBOX_32BIT.
Note that standalone/API support is not available at present. Note that standalone/API support is not available at present.
@ -44,10 +47,6 @@ Note:
make sandbox_defconfig all NO_SDL=1 make sandbox_defconfig all NO_SDL=1
./u-boot ./u-boot
If you are building on a 32-bit machine you may get errors from __ffs.h
about shifting more than the machine word size. Edit the config file
include/configs/sandbox.h and change CONFIG_SANDBOX_BITS_PER_LONG to 32.
U-Boot will start on your computer, showing a sandbox emulation of the serial U-Boot will start on your computer, showing a sandbox emulation of the serial
console: console:

3
doc/bounces Normal file
View file

@ -0,0 +1,3 @@
# List of addresses picked up by patman/get_maintainer.pl that are known to
# bounce. Addresses are listed one per line and need to match the author
# information recorded in git.

View file

@ -546,7 +546,7 @@ static int blk_claim_devnum(enum if_type if_type, int devnum)
int blk_create_device(struct udevice *parent, const char *drv_name, int blk_create_device(struct udevice *parent, const char *drv_name,
const char *name, int if_type, int devnum, int blksz, const char *name, int if_type, int devnum, int blksz,
lbaint_t size, struct udevice **devp) lbaint_t lba, struct udevice **devp)
{ {
struct blk_desc *desc; struct blk_desc *desc;
struct udevice *dev; struct udevice *dev;
@ -567,7 +567,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name,
desc = dev_get_uclass_platdata(dev); desc = dev_get_uclass_platdata(dev);
desc->if_type = if_type; desc->if_type = if_type;
desc->blksz = blksz; desc->blksz = blksz;
desc->lba = size / blksz; desc->lba = lba;
desc->part_type = PART_TYPE_UNKNOWN; desc->part_type = PART_TYPE_UNKNOWN;
desc->bdev = dev; desc->bdev = dev;
desc->devnum = devnum; desc->devnum = devnum;
@ -578,7 +578,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name,
int blk_create_devicef(struct udevice *parent, const char *drv_name, int blk_create_devicef(struct udevice *parent, const char *drv_name,
const char *name, int if_type, int devnum, int blksz, const char *name, int if_type, int devnum, int blksz,
lbaint_t size, struct udevice **devp) lbaint_t lba, struct udevice **devp)
{ {
char dev_name[30], *str; char dev_name[30], *str;
int ret; int ret;
@ -589,7 +589,7 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name,
return -ENOMEM; return -ENOMEM;
ret = blk_create_device(parent, drv_name, str, if_type, devnum, ret = blk_create_device(parent, drv_name, str, if_type, devnum,
blksz, size, devp); blksz, lba, devp);
if (ret) { if (ret) {
free(str); free(str);
return ret; return ret;

View file

@ -129,7 +129,7 @@ int host_dev_bind(int devnum, char *filename)
} }
ret = blk_create_device(gd->dm_root, "sandbox_host_blk", str, ret = blk_create_device(gd->dm_root, "sandbox_host_blk", str,
IF_TYPE_HOST, devnum, 512, IF_TYPE_HOST, devnum, 512,
os_lseek(fd, 0, OS_SEEK_END), &dev); os_lseek(fd, 0, OS_SEEK_END) / 512, &dev);
if (ret) if (ret)
goto err_file; goto err_file;
ret = device_probe(dev); ret = device_probe(dev);

View file

@ -14,12 +14,10 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
{ {
int i, is_last; int i, is_last;
struct udevice *child; struct udevice *child;
char class_name[12];
/* print the first 11 characters to not break the tree-format. */ /* print the first 11 characters to not break the tree-format. */
strlcpy(class_name, dev->uclass->uc_drv->name, sizeof(class_name)); printf(" %-10.10s [ %c ] %-10.10s ", dev->uclass->uc_drv->name,
printf(" %-11s [ %c ] ", class_name, dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ');
for (i = depth; i >= 0; i--) { for (i = depth; i >= 0; i--) {
is_last = (last_flag >> i) & 1; is_last = (last_flag >> i) & 1;
@ -50,7 +48,7 @@ void dm_dump_all(void)
root = dm_root(); root = dm_root();
if (root) { if (root) {
printf(" Class Probed Name\n"); printf(" Class Probed Driver Name\n");
printf("----------------------------------------\n"); printf("----------------------------------------\n");
show_devices(root, -1, 0); show_devices(root, -1, 0);
} }

View file

@ -390,10 +390,11 @@ int ofnode_decode_display_timing(ofnode parent, int index,
if (!ofnode_valid(timings)) if (!ofnode_valid(timings))
return -EINVAL; return -EINVAL;
for (i = 0, node = ofnode_first_subnode(timings); i = 0;
ofnode_valid(node) && i != index; ofnode_for_each_subnode(node, timings) {
node = ofnode_first_subnode(node)) if (i++ == index)
i++; break;
}
if (!ofnode_valid(node)) if (!ofnode_valid(node))
return -EINVAL; return -EINVAL;

View file

@ -312,8 +312,38 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
#endif #endif
return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only); return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
} }
#else
static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
int offset, bool pre_reloc_only)
{
return 0;
}
#endif #endif
int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
{
int node, ret;
ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
if (ret) {
debug("dm_scan_fdt() failed: %d\n", ret);
return ret;
}
/* bind fixed-clock */
node = ofnode_to_offset(ofnode_path("/clocks"));
/* if no DT "clocks" node, no need to go further */
if (node < 0)
return ret;
ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
pre_reloc_only);
if (ret)
debug("dm_scan_fdt_node() failed: %d\n", ret);
return ret;
}
__weak int dm_scan_other(bool pre_reloc_only) __weak int dm_scan_other(bool pre_reloc_only)
{ {
return 0; return 0;
@ -335,9 +365,9 @@ int dm_init_and_scan(bool pre_reloc_only)
} }
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only); ret = dm_extended_scan_fdt(gd->fdt_blob, pre_reloc_only);
if (ret) { if (ret) {
debug("dm_scan_fdt() failed: %d\n", ret); debug("dm_extended_scan_dt() failed: %d\n", ret);
return ret; return ret;
} }
} }

View file

@ -1038,8 +1038,7 @@ int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config)
config->flash_erase_value = ofnode_read_s32_default(flash_node, config->flash_erase_value = ofnode_read_s32_default(flash_node,
"erase-value", -1); "erase-value", -1);
for (node = ofnode_first_subnode(flash_node); ofnode_valid(node); ofnode_for_each_subnode(node, flash_node) {
node = ofnode_next_subnode(node)) {
const char *name = ofnode_get_name(node); const char *name = ofnode_get_name(node);
enum ec_flash_region region; enum ec_flash_region region;

View file

@ -34,9 +34,7 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
debug("%s for '%s' at node offset: %d\n", __func__, pmic->name, debug("%s for '%s' at node offset: %d\n", __func__, pmic->name,
dev_of_offset(pmic)); dev_of_offset(pmic));
for (node = ofnode_first_subnode(parent); ofnode_for_each_subnode(node, parent) {
ofnode_valid(node);
node = ofnode_next_subnode(node)) {
node_name = ofnode_get_name(node); node_name = ofnode_get_name(node);
debug("* Found child node: '%s'\n", node_name); debug("* Found child node: '%s'\n", node_name);

View file

@ -580,7 +580,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
*/ */
snprintf(str, sizeof(str), "id%dlun%d", id, lun); snprintf(str, sizeof(str), "id%dlun%d", id, lun);
ret = blk_create_devicef(dev, "scsi_blk", str, IF_TYPE_SCSI, -1, ret = blk_create_devicef(dev, "scsi_blk", str, IF_TYPE_SCSI, -1,
bd.blksz, bd.blksz * bd.lba, &bdev); bd.blksz, bd.lba, &bdev);
if (ret) { if (ret) {
debug("Can't create device\n"); debug("Can't create device\n");
return ret; return ret;

View file

@ -315,12 +315,12 @@ int blk_next_device(struct udevice **devp);
* @devnum: Device number, specific to the interface type, or -1 to * @devnum: Device number, specific to the interface type, or -1 to
* allocate the next available number * allocate the next available number
* @blksz: Block size of the device in bytes (typically 512) * @blksz: Block size of the device in bytes (typically 512)
* @size: Total size of the device in bytes * @lba: Total number of blocks of the device
* @devp: the new device (which has not been probed) * @devp: the new device (which has not been probed)
*/ */
int blk_create_device(struct udevice *parent, const char *drv_name, int blk_create_device(struct udevice *parent, const char *drv_name,
const char *name, int if_type, int devnum, int blksz, const char *name, int if_type, int devnum, int blksz,
lbaint_t size, struct udevice **devp); lbaint_t lba, struct udevice **devp);
/** /**
* blk_create_devicef() - Create a new named block device * blk_create_devicef() - Create a new named block device
@ -332,12 +332,12 @@ int blk_create_device(struct udevice *parent, const char *drv_name,
* @devnum: Device number, specific to the interface type, or -1 to * @devnum: Device number, specific to the interface type, or -1 to
* allocate the next available number * allocate the next available number
* @blksz: Block size of the device in bytes (typically 512) * @blksz: Block size of the device in bytes (typically 512)
* @size: Total size of the device in bytes * @lba: Total number of blocks of the device
* @devp: the new device (which has not been probed) * @devp: the new device (which has not been probed)
*/ */
int blk_create_devicef(struct udevice *parent, const char *drv_name, int blk_create_devicef(struct udevice *parent, const char *drv_name,
const char *name, int if_type, int devnum, int blksz, const char *name, int if_type, int devnum, int blksz,
lbaint_t size, struct udevice **devp); lbaint_t lba, struct udevice **devp);
/** /**
* blk_prepare_device() - Prepare a block device for use * blk_prepare_device() - Prepare a block device for use

View file

@ -628,4 +628,28 @@ int ofnode_read_resource(ofnode node, uint index, struct resource *res);
int ofnode_read_resource_byname(ofnode node, const char *name, int ofnode_read_resource_byname(ofnode node, const char *name,
struct resource *res); struct resource *res);
/**
* ofnode_for_each_subnode() - iterate over all subnodes of a parent
*
* @node: child node (ofnode, lvalue)
* @parent: parent node (ofnode)
*
* This is a wrapper around a for loop and is used like so:
*
* ofnode node;
*
* ofnode_for_each_subnode(node, parent) {
* Use node
* ...
* }
*
* Note that this is implemented as a macro and @node is used as
* iterator in the loop. The parent variable can be a constant or even a
* literal.
*/
#define ofnode_for_each_subnode(node, parent) \
for (node = ofnode_first_subnode(parent); \
ofnode_valid(node); \
node = ofnode_next_subnode(node))
#endif #endif

View file

@ -55,6 +55,20 @@ int dm_scan_platdata(bool pre_reloc_only);
*/ */
int dm_scan_fdt(const void *blob, bool pre_reloc_only); int dm_scan_fdt(const void *blob, bool pre_reloc_only);
/**
* dm_extended_scan_fdt() - Scan the device tree and bind drivers
*
* This calls dm_scna_dft() which scans the device tree and creates a driver
* for each node. the top-level subnodes are examined and also all sub-nodes
* of "clocks" node.
*
* @blob: Pointer to device tree blob
* @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
* flag. If false bind all drivers.
* @return 0 if OK, -ve on error
*/
int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only);
/** /**
* dm_scan_other() - Scan for other devices * dm_scan_other() - Scan for other devices
* *

View file

@ -8,6 +8,8 @@
%module libfdt %module libfdt
%include <stdint.i>
%{ %{
#define SWIG_FILE_WITH_INIT #define SWIG_FILE_WITH_INIT
#include "libfdt.h" #include "libfdt.h"

View file

@ -1950,7 +1950,6 @@ CONFIG_SAMSUNG
CONFIG_SAMSUNG_ONENAND CONFIG_SAMSUNG_ONENAND
CONFIG_SANDBOX_ARCH CONFIG_SANDBOX_ARCH
CONFIG_SANDBOX_BIG_ENDIAN CONFIG_SANDBOX_BIG_ENDIAN
CONFIG_SANDBOX_BITS_PER_LONG
CONFIG_SANDBOX_SDL CONFIG_SANDBOX_SDL
CONFIG_SANDBOX_SPI_MAX_BUS CONFIG_SANDBOX_SPI_MAX_BUS
CONFIG_SANDBOX_SPI_MAX_CS CONFIG_SANDBOX_SPI_MAX_CS

View file

@ -23,9 +23,9 @@ static int dm_test_blk_base(struct unit_test_state *uts)
/* Create two, one the parent of the other */ /* Create two, one the parent of the other */
ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test", ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test",
IF_TYPE_HOST, 1, 512, 1024, &blk)); IF_TYPE_HOST, 1, 512, 2, &blk));
ut_assertok(blk_create_device(blk, "usb_storage_blk", "test", ut_assertok(blk_create_device(blk, "usb_storage_blk", "test",
IF_TYPE_USB, 3, 512, 1024, &usb_blk)); IF_TYPE_USB, 3, 512, 2, &usb_blk));
/* Check we can find them */ /* Check we can find them */
ut_asserteq(-ENODEV, blk_get_device(IF_TYPE_HOST, 0, &dev)); ut_asserteq(-ENODEV, blk_get_device(IF_TYPE_HOST, 0, &dev));
@ -101,7 +101,7 @@ static int dm_test_blk_find(struct unit_test_state *uts)
struct udevice *blk, *dev; struct udevice *blk, *dev;
ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test", ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test",
IF_TYPE_HOST, 1, 512, 1024, &blk)); IF_TYPE_HOST, 1, 512, 2, &blk));
ut_asserteq(-ENODEV, blk_find_device(IF_TYPE_HOST, 0, &dev)); ut_asserteq(-ENODEV, blk_find_device(IF_TYPE_HOST, 0, &dev));
ut_assertok(blk_find_device(IF_TYPE_HOST, 1, &dev)); ut_assertok(blk_find_device(IF_TYPE_HOST, 1, &dev));
ut_asserteq_ptr(blk, dev); ut_asserteq_ptr(blk, dev);

View file

@ -92,7 +92,7 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test,
if (test->flags & DM_TESTF_PROBE_TEST) if (test->flags & DM_TESTF_PROBE_TEST)
ut_assertok(do_autoprobe(uts)); ut_assertok(do_autoprobe(uts));
if (test->flags & DM_TESTF_SCAN_FDT) if (test->flags & DM_TESTF_SCAN_FDT)
ut_assertok(dm_scan_fdt(gd->fdt_blob, false)); ut_assertok(dm_extended_scan_fdt(gd->fdt_blob, false));
/* /*
* Silence the console and rely on console reocrding to get * Silence the console and rely on console reocrding to get

View file

@ -204,6 +204,7 @@ class Config(object):
self.print_warnings = print_warnings self.print_warnings = print_warnings
self.print_undef_assign = print_undef_assign self.print_undef_assign = print_undef_assign
self._warnings = []
# For parsing routines that stop when finding a line belonging to a # For parsing routines that stop when finding a line belonging to a
# different construct, these holds that line and the tokenized version # different construct, these holds that line and the tokenized version
@ -398,8 +399,12 @@ class Config(object):
need to refer to the top-level kernel directory with "$srctree". need to refer to the top-level kernel directory with "$srctree".
replace (default: True): True if the configuration should replace the replace (default: True): True if the configuration should replace the
old configuration; False if it should add to it.""" old configuration; False if it should add to it.
Returns a list or warnings (hopefully empty)
"""
self._warnings = []
# Put this first so that a missing file doesn't screw up our state # Put this first so that a missing file doesn't screw up our state
filename = os.path.expandvars(filename) filename = os.path.expandvars(filename)
line_feeder = _FileFeed(filename) line_feeder = _FileFeed(filename)
@ -449,7 +454,7 @@ class Config(object):
while 1: while 1:
line = line_feeder.get_next() line = line_feeder.get_next()
if line is None: if line is None:
return return self._warnings
line = line.rstrip() line = line.rstrip()
@ -1763,8 +1768,10 @@ class Config(object):
def _warn(self, msg, filename=None, linenr=None): def _warn(self, msg, filename=None, linenr=None):
"""For printing warnings to stderr.""" """For printing warnings to stderr."""
msg = _build_msg("warning: " + msg, filename, linenr)
if self.print_warnings: if self.print_warnings:
_stderr_msg("warning: " + msg, filename, linenr) sys.stderr.write(msg + "\n")
self._warnings.append(msg)
class Item(object): class Item(object):
@ -3369,10 +3376,13 @@ def _clean_up_path(path):
path = path[2:] path = path[2:]
return path.rstrip("/") return path.rstrip("/")
def _stderr_msg(msg, filename, linenr): def _build_msg(msg, filename, linenr):
if filename is not None: if filename is not None:
sys.stderr.write("{0}:{1}: ".format(_clean_up_path(filename), linenr)) msg = "{0}:{1}: ".format(_clean_up_path(filename), linenr) + msg
sys.stderr.write(msg + "\n") return msg
def _stderr_msg(msg, filename, linenr):
sys.stderr.write(_build_msg(msg, filename, linenr) + "\n")
def _tokenization_error(s, filename, linenr): def _tokenization_error(s, filename, linenr):
loc = "" if filename is None else "{0}:{1}: ".format(filename, linenr) loc = "" if filename is None else "{0}:{1}: ".format(filename, linenr)

View file

@ -124,7 +124,7 @@ class KconfigScanner:
os.environ['srctree'] = os.getcwd() os.environ['srctree'] = os.getcwd()
os.environ['UBOOTVERSION'] = 'dummy' os.environ['UBOOTVERSION'] = 'dummy'
os.environ['KCONFIG_OBJDIR'] = '' os.environ['KCONFIG_OBJDIR'] = ''
self._conf = kconfiglib.Config() self._conf = kconfiglib.Config(print_warnings=False)
def __del__(self): def __del__(self):
"""Delete a leftover temporary file before exit. """Delete a leftover temporary file before exit.
@ -166,7 +166,10 @@ class KconfigScanner:
else: else:
f.write(line[colon + 1:]) f.write(line[colon + 1:])
self._conf.load_config(self._tmpfile) warnings = self._conf.load_config(self._tmpfile)
if warnings:
for warning in warnings:
print '%s: %s' % (defconfig, warning)
try_remove(self._tmpfile) try_remove(self._tmpfile)
self._tmpfile = None self._tmpfile = None

View file

@ -1877,10 +1877,10 @@ def main():
if options.build_db: if options.build_db:
with open(CONFIG_DATABASE, 'w') as fd: with open(CONFIG_DATABASE, 'w') as fd:
for defconfig, configs in config_db.iteritems(): for defconfig, configs in config_db.iteritems():
print >>fd, '%s' % defconfig fd.write('%s\n' % defconfig)
for config in sorted(configs.keys()): for config in sorted(configs.keys()):
print >>fd, ' %s=%s' % (config, configs[config]) fd.write(' %s=%s\n' % (config, configs[config]))
print >>fd fd.write('\n')
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -84,6 +84,18 @@ Aliases are recursive.
The checkpatch.pl in the U-Boot tools/ subdirectory will be located and The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
used. Failing that you can put it into your path or ~/bin/checkpatch.pl used. Failing that you can put it into your path or ~/bin/checkpatch.pl
If you want to avoid sending patches to email addresses that are picked up
by patman but are known to bounce you can add a [bounces] section to your
.patman file. Unlike the [alias] section these are simple key: value pairs
that are not recursive.
>>>
[bounces]
gonefishing: Fred Bloggs <f.bloggs@napier.net>
<<<
If you want to change the defaults for patman's command-line arguments, If you want to change the defaults for patman's command-line arguments,
you can add a [settings] section to your .patman file. This can be used you can add a [settings] section to your .patman file. This can be used

View file

@ -10,6 +10,7 @@ import os
import get_maintainer import get_maintainer
import gitutil import gitutil
import settings
import terminal import terminal
# Series-xxx tags that we understand # Series-xxx tags that we understand
@ -218,6 +219,7 @@ class Series(dict):
Return: Return:
Filename of temp file created Filename of temp file created
""" """
col = terminal.Color()
# Look for commit tags (of the form 'xxx:' at the start of the subject) # Look for commit tags (of the form 'xxx:' at the start of the subject)
fname = '/tmp/patman.%d' % os.getpid() fname = '/tmp/patman.%d' % os.getpid()
fd = open(fname, 'w') fd = open(fname, 'w')
@ -233,6 +235,9 @@ class Series(dict):
cc += add_maintainers cc += add_maintainers
elif add_maintainers: elif add_maintainers:
cc += get_maintainer.GetMaintainer(commit.patch) cc += get_maintainer.GetMaintainer(commit.patch)
for x in set(cc) & set(settings.bounces):
print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
cc = set(cc) - set(settings.bounces)
cc = [m.encode('utf-8') if type(m) != str else m for m in cc] cc = [m.encode('utf-8') if type(m) != str else m for m in cc]
all_ccs += cc all_ccs += cc
print(commit.patch, ', '.join(set(cc)), file=fd) print(commit.patch, ', '.join(set(cc)), file=fd)

View file

@ -269,6 +269,19 @@ def _ReadAliasFile(fname):
if bad_line: if bad_line:
print(bad_line) print(bad_line)
def _ReadBouncesFile(fname):
"""Read in the bounces file if it exists
Args:
fname: Filename to read.
"""
if os.path.exists(fname):
with open(fname) as fd:
for line in fd:
if line.startswith('#'):
continue
bounces.add(line.strip())
def Setup(parser, project_name, config_fname=''): def Setup(parser, project_name, config_fname=''):
"""Set up the settings module by reading config files. """Set up the settings module by reading config files.
@ -293,10 +306,15 @@ def Setup(parser, project_name, config_fname=''):
for name, value in config.items('alias'): for name, value in config.items('alias'):
alias[name] = value.split(',') alias[name] = value.split(',')
_ReadBouncesFile('doc/bounces')
for name, value in config.items('bounces'):
bounces.add(value)
_UpdateDefaults(parser, config) _UpdateDefaults(parser, config)
# These are the aliases we understand, indexed by alias. Each member is a list. # These are the aliases we understand, indexed by alias. Each member is a list.
alias = {} alias = {}
bounces = set()
if __name__ == "__main__": if __name__ == "__main__":
import doctest import doctest