From 2f20cb88266380f9da7e68a005b609267e49164a Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Jun 13 2019 15:24:18 +0000 Subject: coreos-koji-tagger: add function for parsing lockfile Since the lockfile format will be more complex than just a list of rpms in json we'll need to parse it. Added a new function to handle this logic. --- diff --git a/coreos_koji_tagger.py b/coreos_koji_tagger.py index ba11b95..5c46ad1 100755 --- a/coreos_koji_tagger.py +++ b/coreos_koji_tagger.py @@ -168,8 +168,8 @@ class Consumer(object): # koji builds that aren't in the tag we can add the koji pkg to the # tag (if needed) and then tag the koji build into the tag. - # Grab the list of desired rpms - desiredrpms = set(data) + # parse the lockfile and get a set of rpm NEVRAs + desiredrpms = set(parse_lockfile_data(data)) # convert the rpm NEVRAs into a list of srpm NVRA (format of koji # build name) @@ -247,6 +247,12 @@ def runcmd(cmd: list, **kwargs: int) -> subprocess.CompletedProcess: raise return cp # subprocess.CompletedProcess +def parse_lockfile_data(data: str) -> list: + # Parse the rpm lockfile format and return a list of rpms in + # NEVRA form. + # TODO add link to docs on lockfile format when they exist + return list(data) + def grab_first_column(text: str) -> list: # The output is split by newlines (split \n) and contains an # extra newline at the end (rstrip). We only care about the 1st