kevinlu1248 / armbian-build

The Armbian Linux Build Framework under Kreyren's Management
GNU General Public License v2.0
0 stars 0 forks source link

Sweep: Replace 'x-hack' in extensions and lib/functions/artifacts files. #96

Open sweep-nightly[bot] opened 1 year ago

sweep-nightly[bot] commented 1 year ago

x-hack is a shell/bash conditional using any letter (often 'x' thus the 'x-hack' name) followed by variable declaration ${var} and checking against the same letter followed by value such as:

# bash
[[ “x$var” == “xval” ]]

# POSIX shell
[ “x$var” = “xval” ]

This was done to ensure compatibility across different shells and systems many years ago, but today it's obsolete as the shells evolved enough to be more reliable.

That said the armbian codebase is still using them for some reason and it was agreed that these should be replaced so i want you to look through the codebase and fix all x-hacks.

Note that the declaration can also be written without quotes:

[ x$var = xval ]

Or even checking for a directory:

[ x$var = xval/ ]

Parent issue: #91

Checklist - [X] `extensions/nvidia.sh` ❌ Failed
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
- [X] `extensions/v4l2loopback-dkms.sh` ❌ Failed
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
- [X] `extensions/grub.sh` ❌ Failed
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
- [X] `extensions/nomod.sh` ❌ Failed
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
- [X] `extensions/zfs.sh` ❌ Failed
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
- [X] `lib/functions/artifacts/artifact-armbian-bsp-cli.sh` ❌ Failed
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
- [X] `lib/functions/artifacts/artifact-firmware.sh` ❌ Failed
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
- [X] `lib/functions/artifacts/artifacts-obtain.sh` ✅ Commit [`5eeccc2`](https://github.com/kevinlu1248/armbian-build/commit/5eeccc2cbc425060d39bdc9cfd338abda6bb1ea2)
• Replace all instances of 'x-hack' with a modern approach. For example, change `[[ "x${VAR}" == "xVALUE" ]]` to `[[ "${VAR}" == "VALUE" ]]`.
Sandbox Execution Logs
sweep-nightly[bot] commented 1 year ago

Here's the PR! https://github.com/kevinlu1248/armbian-build/pull/98.

💎 Sweep Pro: I'm creating this ticket using GPT-4. You have unlimited GPT-4 tickets.

Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/kevinlu1248/armbian-build/blob/99739036af474f625072a7cd57cfbbc24843c561/extensions/nvidia.sh#L1-L19 https://github.com/kevinlu1248/armbian-build/blob/99739036af474f625072a7cd57cfbbc24843c561/extensions/zfs.sh#L1-L15 https://github.com/kevinlu1248/armbian-build/blob/99739036af474f625072a7cd57cfbbc24843c561/extensions/v4l2loopback-dkms.sh#L1-L15 https://github.com/kevinlu1248/armbian-build/blob/99739036af474f625072a7cd57cfbbc24843c561/extensions/nomod.sh#L1-L9 https://github.com/kevinlu1248/armbian-build/blob/99739036af474f625072a7cd57cfbbc24843c561/extensions/grub.sh#L1-L285

Step 2: ⌨️ Coding


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/replace-x-hack_22.

.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord