-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[V3 Linux] aarch64 compilation #3854
base: v3-alpha
Are you sure you want to change the base?
Conversation
base quick refacto
WalkthroughThe changes in this pull request enhance the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
v3/internal/commands/appimage.go (2)
Line range hint
138-158
: Correct the target directory path when copying GTK files.The current method of constructing
targetDir
may lead to incorrect paths, causing files to be copied to unintended locations. Stripping the leading slash and then usingfilepath.Abs
can result in paths outside the AppDir.Modify the path construction to ensure files are copied relative to
appDir
:s.CD(appDir) for _, file := range files { targetDir := filepath.Dir(file) if targetDir[0] == '/' { targetDir = targetDir[1:] } - targetDir, err = filepath.Abs(targetDir) + targetDir = filepath.Join(appDir, targetDir) if err != nil { return err } s.MKDIR(targetDir) s.COPY(file, targetDir) }
Line range hint
187-198
: Update log message to reflect the final AppImage location.After moving the AppImage to the output directory, the log message references
targetFile
, which still points to the original location. Adjust the log to show the correct output path.Apply this change to fix the log message:
s.MOVE(targetFile, options.OutputDir) - log(p, "AppImage created: "+targetFile) + finalAppImagePath := filepath.Join(options.OutputDir, filepath.Base(targetFile)) + log(p, "AppImage created: "+finalAppImagePath) return nil }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- v3/internal/commands/appimage.go (5 hunks)
🧰 Additional context used
🔇 Additional comments (2)
v3/internal/commands/appimage.go (2)
9-9
: Good inclusion of the "runtime" package for architecture detection.The addition of the
runtime
package is necessary for determining the current architecture, which is essential for the changes implemented.
174-184
: Simplified GTK version detection is appropriate.The use of a
switch
statement enhances readability and efficiently determines the GTK version required for deployment.
// Download necessary files concurrently | ||
log(p, "Downloading AppImage tooling") | ||
var wg sync.WaitGroup | ||
wg.Add(2) | ||
|
||
go func() { | ||
if !s.EXISTS(filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage")) { | ||
s.DOWNLOAD("https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage", filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage")) | ||
linuxdeployPath := filepath.Join(options.BuildDir, filepath.Base(urls["linuxdeploy"])) | ||
if !s.EXISTS(linuxdeployPath) { | ||
s.DOWNLOAD(urls["linuxdeploy"], linuxdeployPath) | ||
} | ||
s.CHMOD(filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage"), 0755) | ||
s.CHMOD(linuxdeployPath, 0755) | ||
wg.Done() | ||
}() | ||
|
||
go func() { | ||
target := filepath.Join(appDir, "AppRun") | ||
if !s.EXISTS(target) { | ||
s.DOWNLOAD("https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64", target) | ||
s.DOWNLOAD(urls["AppRun"], target) | ||
} | ||
s.CHMOD(target, 0755) | ||
wg.Done() | ||
}() | ||
|
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.
Add error handling in the concurrent download goroutines.
Currently, errors from s.DOWNLOAD
and s.CHMOD
within the goroutines are not being captured. If a download fails or permission changes fail, the program may proceed without the necessary tools, leading to runtime errors. Consider handling these errors to ensure robustness.
One way to handle this is to collect errors via a channel:
var wg sync.WaitGroup
+ errCh := make(chan error, 2)
wg.Add(2)
go func() {
linuxdeployPath := filepath.Join(options.BuildDir, filepath.Base(urls["linuxdeploy"]))
if !s.EXISTS(linuxdeployPath) {
- s.DOWNLOAD(urls["linuxdeploy"], linuxdeployPath)
+ if err := s.DOWNLOAD(urls["linuxdeploy"], linuxdeployPath); err != nil {
+ errCh <- err
+ return
+ }
}
- s.CHMOD(linuxdeployPath, 0755)
+ if err := s.CHMOD(linuxdeployPath, 0755); err != nil {
+ errCh <- err
+ return
+ }
wg.Done()
}()
go func() {
target := filepath.Join(appDir, "AppRun")
if !s.EXISTS(target) {
- s.DOWNLOAD(urls["AppRun"], target)
+ if err := s.DOWNLOAD(urls["AppRun"], target); err != nil {
+ errCh <- err
+ return
+ }
}
- s.CHMOD(target, 0755)
+ if err := s.CHMOD(target, 0755); err != nil {
+ errCh <- err
+ return
+ }
wg.Done()
}()
wg.Wait()
+ close(errCh)
+ for err := range errCh {
+ return err
+ }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// Download necessary files concurrently | |
log(p, "Downloading AppImage tooling") | |
var wg sync.WaitGroup | |
wg.Add(2) | |
go func() { | |
if !s.EXISTS(filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage")) { | |
s.DOWNLOAD("https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage", filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage")) | |
linuxdeployPath := filepath.Join(options.BuildDir, filepath.Base(urls["linuxdeploy"])) | |
if !s.EXISTS(linuxdeployPath) { | |
s.DOWNLOAD(urls["linuxdeploy"], linuxdeployPath) | |
} | |
s.CHMOD(filepath.Join(options.BuildDir, "linuxdeploy-x86_64.AppImage"), 0755) | |
s.CHMOD(linuxdeployPath, 0755) | |
wg.Done() | |
}() | |
go func() { | |
target := filepath.Join(appDir, "AppRun") | |
if !s.EXISTS(target) { | |
s.DOWNLOAD("https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64", target) | |
s.DOWNLOAD(urls["AppRun"], target) | |
} | |
s.CHMOD(target, 0755) | |
wg.Done() | |
}() | |
// Download necessary files concurrently | |
log(p, "Downloading AppImage tooling") | |
var wg sync.WaitGroup | |
errCh := make(chan error, 2) | |
wg.Add(2) | |
go func() { | |
linuxdeployPath := filepath.Join(options.BuildDir, filepath.Base(urls["linuxdeploy"])) | |
if !s.EXISTS(linuxdeployPath) { | |
if err := s.DOWNLOAD(urls["linuxdeploy"], linuxdeployPath); err != nil { | |
errCh <- err | |
return | |
} | |
} | |
if err := s.CHMOD(linuxdeployPath, 0755); err != nil { | |
errCh <- err | |
return | |
} | |
wg.Done() | |
}() | |
go func() { | |
target := filepath.Join(appDir, "AppRun") | |
if !s.EXISTS(target) { | |
if err := s.DOWNLOAD(urls["AppRun"], target); err != nil { | |
errCh <- err | |
return | |
} | |
} | |
if err := s.CHMOD(target, 0755); err != nil { | |
errCh <- err | |
return | |
} | |
wg.Done() | |
}() | |
wg.Wait() | |
close(errCh) | |
for err := range errCh { | |
return err | |
} |
Quality Gate passedIssues Measures |
Description
This pull request addresses an issue in the
v3/internal/commands/appimage.go
file, where the logic to generate AppImages was not functioning correctly on certain platforms. The modification ensures that theappimage.go
command correctly handles the generation of AppImages for Linux environments by updating the build process.Fixes #3840
Type of change
How Has This Been Tested?
The fix was tested by building the project on different Linux distributions and verifying that the AppImage generation now works correctly. Additional logging was added to confirm that all steps in the process are successfully executed.
Summary by CodeRabbit
New Features
arm64
andx86_64
.Bug Fixes
Refactor