distro/rhel85: don't copy architecture when adding it to a distro
Originally, a copy of an architecture instance was always created when it was added to a distro definition using the `addArches()` method. However in reality, only a subset of structure members were copied, which could create unexpected behavior and issues. This behavior is identical to the behavior when image types are added to an architecture. However the situation with image types differs in one aspect, specifically that a single image type definition is usually reused by multiple architecture definitions, while an architecture definition is always used only by a single distribution definition. Due to the fact that the image type contains a reference to the architecture to which it has been added, the creation of a copy can not be reasonably avoided. On the other hand, adding a copy of an architecture to a distribution definition is not necessary. Downside of creating copies of the architecture is that the image types associated with it referred always to the original architecture definition instance and not to the copy. So while references in the direction of Distro -> Arch -> Image Type were correct and working, the other direction was broken. Image Type -> (original) Arch -> (nil) Distro. Modify `distribution.AddArches()` method to directly add the passed architecture instances to the distribution definition, instead of adding their copies. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
025403ad34
commit
e45e117a0b
1 changed files with 5 additions and 6 deletions
|
|
@ -88,12 +88,11 @@ func (d *distribution) addArches(arches ...architecture) {
|
|||
d.arches = map[string]distro.Arch{}
|
||||
}
|
||||
|
||||
for _, a := range arches {
|
||||
d.arches[a.name] = &architecture{
|
||||
distro: d,
|
||||
name: a.name,
|
||||
imageTypes: a.imageTypes,
|
||||
}
|
||||
// Do not make copies of architectures, as opposed to image types,
|
||||
// because architecture definitions are not used by more than a single
|
||||
// distro definition.
|
||||
for idx := range arches {
|
||||
d.arches[arches[idx].name] = &arches[idx]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue