From bc7f5a8b513283b74fda0ca06aa0ae6b59007adf Mon Sep 17 00:00:00 2001 From: Gabi Beyer Date: Fri, 27 Oct 2017 12:49:04 -0700 Subject: [PATCH] Update dependencies in specfile from infile The specfile dependencies are a set, so create a set from the deps scraped from the bb file, union the two sets, and write it to the specfile. Signed-off-by: Gabi Beyer --- autospec/infile_parser.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autospec/infile_parser.py b/autospec/infile_parser.py index df32b8a..8b7cf26 100644 --- a/autospec/infile_parser.py +++ b/autospec/infile_parser.py @@ -202,11 +202,26 @@ def update_summary(bb_dict, specfile): break +def update_build_deps(bb_dict, specfile): + deps = set() + for dep in bb_dict.get('DEPENDS').split(): + dep = re.match(r"(\$\{PYTHON_PN\}\-)?([a-zA-Z0-9\-]+)", dep).group(2) + if dep.endswith('-native'): + dep = dep[:-7] + deps.add(dep) + + spec_deps = getattr(specfile, 'buildreqs') + setattr(specfile, 'buildreqs', spec_deps.union(deps)) + + def update_specfile(specfile, bb_dict): # update the package summary if one does not exist update_summary(bb_dict, specfile) + # union the current set of buildreqs in the specfile to the bb ones + update_build_deps(bb_dict, specfile) + def parse_bb(bb, specfile):