#406 Rebuild only affected pkgs by the CVE
Merged by jkaluza. Opened by gnaponie.
gnaponie/freshmaker get-only-affected-pkgs  into  master

Download 406.patch

An RHSA that addresses a specific advisory will contain RPM build(s)
for addressing a specific CVE. Freshmaker uses these RPM build(s) to
find out which images should be rebuilt. In some cases, additional
RPM build(s) are attached to RHSA. These are unrelated to the CVE.
With this change Freshmaker is going to rebuild only the affected
pkgs by the CVE, and not all the contained RPMs in the RHSA.

Signed-off-by: gnaponie gnaponie@redhat.com

I think the affected_pkgs here is the list of package names, while the srpm_nvrs is list of NVRs. For example, the values will be like this:

affected_pkgs = set(["httpd"])
srpm_nvrs = set(["httpd-2.4.6-11", "foo-1-1"])

See my comment below for more info.

The goal of this line should be to keep only "affected" NVRs in the srpm_nvrs - it means you should keep the srpm_nvr which has the same name as the one in affected_pkgs.

Maybe something like this:

if affected_pkgs:
    set([srpm_nvr for srpm_nvr in srpm_nvrs if kobo.rpmlib.parse_nvr(srpm_nvr)["name"] in affected_pkgs])

Can you also call self.log_info() with some message showing the list of removed SRPM NVRs, so we know that some NVRs were removed?

The pkg_name returned by Bugzilla is just httpd.

You will need to change the test to include more packages, not just httpd. But even in the current test, this should be httpd-2.4-11.el7, because that's the NVR affected by CVE.

You will need to change the test to include more packages, not just httpd. But even in the current test, this should be httpd-2.4-11.el7, because that's the NVR affected by CVE.

Yeah... actually I made the opposite. I shouldn't remove the affected pkgs, I should use them as a whitelist.

rebased onto 93a4f8add09edee81aa8710f85bde6ebe664871b

@jkaluza this is ready for another review.

Commit 241287d1 fixes this pull-request

Pull-Request has been merged by jkaluza

Pull-Request has been merged by jkaluza

Metadata