AOSC-Archive / autobuild3

AOSC OS package maintenance toolkit (version 3)
https://aosc.io
GNU General Public License v2.0
24 stars 17 forks source link

lib/arch, lib/base: Enforce type checking during copy-assigning (#140) #141

Closed cthbleachbit closed 1 year ago

cthbleachbit commented 1 year ago

autobuild3 allows maintainers to specify one or more VARIABLE__AMD64 (by archtecture) and VARIABLE__RETRO (by arch group). These variables will override VARIABLE if the current building arch matches the more specific flags.

Earlier in #130 support is added to allow variables (e.g. CMAKE_AFTER) to be defined as a bash indexed array. However, at this point overriding CMAKE_AFTER-as-an-array with a literal CMAKE_AFTER__ARM64 or the other way around is messed up and let's say undefined behavior.

This PR adds a short hand abcopyvar that enforces identical types for source and destination variables when copy-assigning, and causes build to fail if types don't match, i.e. when VAR_AMD64 is an array but VAR is a string literal, or when VAR_AMD64 is a string literal but VAR is an array. Existing copy-assignment should be changed to use this function instead.