Updating existing inheritance instead of removing and adding
Before this fix, We remove the old inheritance no matter it's same
as the new module build or not, and add it with new attributions in
the same one koji call. For example, if there is a go-toolset module
build exists in inhertiance of tag 'rhel-8-go-toolset-build', like:
rhel-8-go-toolset-buildroot (12001)
└─ module-go-toolset-rhel8-20190501-123456 (20020)
then when we re-add module-go-toolset-rhel8-20190501-123456 to tag's
inheritance data, we update the inheritance with:
[
{
"pkg_filter": "",
"name": "module-go-toolset-rhel8-20190501-123456",
"delete link": true,
"intransitive": false,
"parent_id": 20020,
"maxdepth": null,
"noconfig": false,
"child_id": 12001,
"priority": 10
},
{
"pkg_filter": "",
"intransitive": false,
"priority": 10,
"parent_id": 20020,
"maxdepth": null,
"noconfig": false
}
]
the 2 tags in inheritance data are just the same tag, one is for
removing (with "delete link" is true), and another is for adding.
This worked before, but now koji only removes the tag from inheritance
data.
In this fix, when the new module build is already in inheritance,
and we're going to add it with different attributions as exsiting
(priorities and etc), we update old inheritance with new attributions.
If new attributions are same as before, we just skip and not update
inheritance data.