mbien commented on code in PR #102: URL: https://github.com/apache/netbeans-nbpackage/pull/102#discussion_r2177380027
########## src/main/java/org/apache/netbeans/nbpackage/deb/DebTask.java: ########## @@ -150,15 +148,29 @@ private String packageVersion() { return packageVersion; } - private String packageArch() throws Exception { + private String packageArch() { if (packageArch == null) { - if (context().getValue(NBPackage.PACKAGE_RUNTIME).isPresent()) { - packageArch = context() - .execAndGetOutput(DPKG, "--print-architecture") - .strip(); - } else { - packageArch = "all"; - } + packageArch = context().getValue(NBPackage.PACKAGE_ARCH) + .orElseGet(() -> { + Optional<Path> runtime = context().getValue(NBPackage.PACKAGE_RUNTIME); + if (runtime.isPresent()) { + return Architecture.detectFromPath( + runtime.get()).map(a -> { + return switch (a) { + case AARCH64 -> + ARCH_ARM64; + case X86_64 -> + ARCH_AMD64; + }; + }).orElseGet(() -> { + context().warningHandler().accept( + DebPackager.MESSAGES.getString("message.unknownarch")); + return ARCH_ALL; + }); + } else { + return ARCH_ALL; + } + }); Review Comment: unfortunately the NB formatter isn't doing a good job here, something like that would be better but the formatter doesn't like that: ```java .orElseGet(() -> { Optional<Path> runtime = context().getValue(NBPackage.PACKAGE_RUNTIME); if (runtime.isPresent()) { return Architecture.detectFromPath(runtime.get()) .map(a -> switch (a) { case AARCH64 -> ARCH_ARM64; case X86_64 -> ARCH_AMD64; }).orElseGet(() -> { context().warningHandler().accept( DebPackager.MESSAGES.getString("message.unknownarch")); return ARCH_ALL; }); } else { return ARCH_ALL; } }); ``` (not saying that you should change it, it is what it is I guess) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists