-
Notifications
You must be signed in to change notification settings - Fork 4
profiles: decouple "board_name" and "profile" from "platform" variable #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
map-b
wants to merge
1
commit into
efahl:main
Choose a base branch
from
map-b:profiles-decouple-device-platform
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1265,7 +1265,8 @@ function collect_device_info() | |
| } | ||
|
|
||
| let target = sysb.release.target; | ||
| let platform = replace(sysb.board_name, /,/, "_"); | ||
| let board_name = sysb.board_name; | ||
| let profile = replace(board_name, /,/, "_"); | ||
| let ver_from = sysb.release.version; | ||
| let sutype; // Sysupgrade type: combined, combined-efi, sdcard or sysupgrade (or trx or lxl or ???) | ||
|
|
||
|
|
@@ -1297,11 +1298,12 @@ function collect_device_info() | |
| } | ||
|
|
||
| device = { | ||
| arch: null, // "x86_64" or "mipsel_24kc" or "aarch64_cortex-a53", contained in platform_json | ||
| target: target, // "x86/64" or "ath79/generic" or "mediatek/mt7622", from system board | ||
| platform: platform, // "generic" (for x86) or "tplink,archer-c7-v4" or "linksys,e8450-ubi" | ||
| fstype: sysb.rootfs_type, // "ext4" or "squashfs", what is actually present now | ||
| sutype: sutype, // Sysupgrade type, combined, combined-efi or sysupgrade or sdcard | ||
| arch: null, // "x86_64" or "mipsel_24kc" or "aarch64_cortex-a53", contained in platform_json | ||
| target: target, // "x86/64" or "ath79/generic" or "mediatek/mt7622", from system board | ||
| board_name: board_name, // "generic" (for x86) or "tplink,archer-c7-v4" or "linksys,e8450-ubi" | ||
| profile: profile, // "generic", "tplink_archer-c7-v4" or "linksys_e8450-ubi", used to match profiles in profiles.json | ||
| fstype: sysb.rootfs_type, // "ext4" or "squashfs", what is actually present now | ||
| sutype: sutype, // Sysupgrade type, combined, combined-efi or sysupgrade or sdcard | ||
|
Comment on lines
+1301
to
+1306
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just aligned with spaces |
||
| }; | ||
|
|
||
| build = { | ||
|
|
@@ -1388,7 +1390,7 @@ function complete_build_info(profile, board) | |
| device.sutype = valid_sutypes[0]; | ||
| else | ||
| L.bug("%s:%s Sysupgrade type '%s' should be one of %s\n", | ||
| device.target, device.platform, device.sutype, valid_sutypes); | ||
| device.target, device.profile, device.sutype, valid_sutypes); | ||
| } | ||
|
|
||
| for (let img in images) { | ||
|
|
@@ -1485,34 +1487,37 @@ function collect_platform() | |
| L.die("Unsupported target '%s'\n", device.target); | ||
| } | ||
|
|
||
| if (! (device.platform in keys(platform.profiles))) { | ||
| if (! (device.profile in keys(platform.profiles))) { | ||
| // *Although in most cases the board_name (sysinfo:acpi name, dts compatible, custom name) is the | ||
| // "same" as the profile, and the "sanitization" would be enough to get the proper profile name. | ||
| // The common/general case is that devices sent any string from the SUPPORTED_DEVICES list and we | ||
| // need to translate to a proper profile name used by ImageBuilders. | ||
| // This is a mapped profile, e.g.: raspberrypi,model-b-plus -> rpi | ||
| let found = false; | ||
| for (let real_platform, data in platform.profiles) { | ||
| for (let alias in data.supported_devices) { | ||
| alias = replace(alias, ",", "_"); | ||
| if (device.platform == alias) { | ||
| for (let platform_profile, data in platform.profiles) { | ||
| for (let board_name in data.supported_devices) { | ||
| if (device.board_name == board_name) { | ||
| found = true; | ||
| L.log(2, "Mapping platform %s to %s\n", device.platform, real_platform); | ||
| device.platform = real_platform; | ||
| L.log(2, "Mapping platform, board_name to profile: %s to %s\n", device.board_name, platform_profile); | ||
| device.profile = platform_profile; | ||
| break; | ||
| } | ||
| } | ||
| if (found) break; | ||
| } | ||
| if (! found) { | ||
| if ("generic" in keys(platform.profiles)) | ||
| device.platform = "generic"; | ||
| device.profile = "generic"; | ||
| else | ||
| L.die("Unsupported profile: %s\n Valid profiles are %s\n", device.platform, keys(platform.profiles)); | ||
| L.die("Unsupported profile: %s\n Valid profiles are %s\n", device.profile, keys(platform.profiles)); | ||
| } | ||
| } | ||
|
|
||
| let profile = platform.profiles[device.platform]; | ||
| let platform_profile = platform.profiles[device.profile]; | ||
| device.arch = platform.arch_packages; | ||
|
|
||
| complete_build_info(profile, platform); | ||
| collect_defaults(platform.default_packages, profile.device_packages); | ||
| complete_build_info(platform_profile, platform); | ||
| collect_defaults(platform.default_packages, platform_profile.device_packages); | ||
|
|
||
| if ("linux_kernel" in platform) { | ||
| build.to.kernel = platform.linux_kernel.version; | ||
|
|
@@ -1616,7 +1621,8 @@ function show_config() | |
| `ASU-Server ${url.sysupgrade_root}\n` | ||
| `Upstream ${url.upstream}\n` | ||
| `Target ${device.target}\n` | ||
| `Profile ${device.platform}\n` | ||
| `Profile ${device.profile}\n` | ||
| `Board ${device.board_name}\n` | ||
| `Package-arch ${device.arch}\n` | ||
| ); | ||
| L.log(1, | ||
|
|
@@ -1922,7 +1928,7 @@ function blob(report) | |
| let blob = { | ||
| client: PROG, | ||
| target: device.target, | ||
| profile: device.platform, // sanitized board name | ||
| profile: device.profile, // sanitized board name | ||
|
|
||
| version: build.to.version, | ||
| version_code: rc, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe now do you see a bit clear that this is a shortcut for the mapping/translation, it works in most cases and avoid the bit compute of the translation but the canonical/correctness is doing the translation/mapping. Is not this reasonable? Can not we even talk?
This was my whole point with those reverts in ASU side about the "sanitization" vs "translation".