neilcsmith-net commented on code in PR #102: URL: https://github.com/apache/netbeans-nbpackage/pull/102#discussion_r2177700819
########## 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: Agreed - it's actually what I had before. Need to look at fixes in the formatter! -- 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