pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
arduino-cli: Add core packages support
Module Name: pkgsrc-wip
Committed By: Rui-Xiang Guo <rxg%lavabit.com@localhost>
Pushed By: rxg
Date: Thu Mar 14 19:13:54 2024 +0800
Changeset: 84455f459da9284bfa28dd9fe7a3570e0ba3fdf1
Modified Files:
arduino-cli/Makefile
arduino-cli/distinfo
arduino-cli/patches/patch-commands_instances.go
Added Files:
arduino-cli/patches/patch-arduino_cores_packagemanager_install__uninstall.go
Removed Files:
arduino-cli/TODO
Log Message:
arduino-cli: Add core packages support
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=84455f459da9284bfa28dd9fe7a3570e0ba3fdf1
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
arduino-cli/Makefile | 5 ++-
arduino-cli/TODO | 1 -
arduino-cli/distinfo | 3 +-
...uino_cores_packagemanager_install__uninstall.go | 43 ++++++++++++++++++++++
arduino-cli/patches/patch-commands_instances.go | 22 ++++-------
5 files changed, 56 insertions(+), 18 deletions(-)
diffs:
diff --git a/arduino-cli/Makefile b/arduino-cli/Makefile
index e8f2b1f851..a678d857ad 100644
--- a/arduino-cli/Makefile
+++ b/arduino-cli/Makefile
@@ -13,7 +13,7 @@ LICENSE= gnu-gpl-v3
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "NetBSD"
-DEPENDS+= arduino-ctags>=5.8:../../wip/arduino-ctags
+DEPENDS+= arduino-ctags>=5.8.arduino11:../../wip/arduino-ctags
DEPENDS+= arduino-dfu-discovery>=0.1.2:../../wip/arduino-dfu-discovery
DEPENDS+= arduino-mdns-discovery>=1.0.9:../../wip/arduino-mdns-discovery
DEPENDS+= arduino-serial-discovery>=1.4.0:../../wip/arduino-serial-discovery
@@ -21,7 +21,8 @@ DEPENDS+= arduino-serial-monitor>=0.13.0:../../wip/arduino-serial-monitor
.endif
pre-build:
- ${SED} -i 's|/usr/pkg|${PREFIX}|g' ${WRKSRC}/commands/instances.go
+ ${SED} -i 's|/usr/pkg|${LOCALBASE}|g' ${WRKSRC}/arduino/cores/packagemanager/install_uninstall.go
+ ${SED} -i 's|/usr/pkg|${LOCALBASE}|g' ${WRKSRC}/commands/instances.go
.include "go-modules.mk"
.include "../../lang/go/go-module.mk"
diff --git a/arduino-cli/TODO b/arduino-cli/TODO
deleted file mode 100644
index 26a4750cc3..0000000000
--- a/arduino-cli/TODO
+++ /dev/null
@@ -1 +0,0 @@
-functional testing
diff --git a/arduino-cli/distinfo b/arduino-cli/distinfo
index 74ecd4a97b..db7784879d 100644
--- a/arduino-cli/distinfo
+++ b/arduino-cli/distinfo
@@ -2121,7 +2121,8 @@ Size (rsc.io_quote_v3_@v_v3.1.0.mod) = 55 bytes
BLAKE2s (rsc.io_sampler_@v_v1.3.0.mod) = 6d4d3ba7c381b9a923679a73562a7cf3d6b7d49f94f585f274c8955bb1b932b4
SHA512 (rsc.io_sampler_@v_v1.3.0.mod) = 2137507eb25fbae419605e0cd6bca4cfa584110eebc276cd759a4dcb6f97e52928e5b2d9b276e76bcabcec3bbfc2c42f97fa29f54695d27fb00f9423e1638863
Size (rsc.io_sampler_@v_v1.3.0.mod) = 88 bytes
-SHA1 (patch-commands_instances.go) = 622524ad142f34007dce9bd5edc7a43e19f7a3f5
+SHA1 (patch-arduino_cores_packagemanager_install__uninstall.go) = 541341b556a49832379b3718b171b6a8e741ae3b
+SHA1 (patch-commands_instances.go) = e6f9c0315a0d63c458d577aa71a0df6275349984
SHA1 (patch-configuration_configuration.go) = fb7dd8e323668336f7c26b20b9252c4df5e73e68
SHA1 (patch-executils_executils__netbsd.go) = 95ab98ab2c10fb4140a7477871331821e9e529ab
SHA1 (patch-go.mod) = 00c02d207a282ac5253d8ccd98f5f88458e9e0f3
diff --git a/arduino-cli/patches/patch-arduino_cores_packagemanager_install__uninstall.go b/arduino-cli/patches/patch-arduino_cores_packagemanager_install__uninstall.go
new file mode 100644
index 0000000000..d32016b402
--- /dev/null
+++ b/arduino-cli/patches/patch-arduino_cores_packagemanager_install__uninstall.go
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- arduino/cores/packagemanager/install_uninstall.go.orig 2024-03-09 06:51:20.561238937 +0000
++++ arduino/cores/packagemanager/install_uninstall.go
+@@ -19,11 +19,13 @@ import (
+ "bytes"
+ "encoding/json"
+ "fmt"
++ "path/filepath"
+ "runtime"
+
+ "github.com/arduino/arduino-cli/arduino"
+ "github.com/arduino/arduino-cli/arduino/cores"
+ "github.com/arduino/arduino-cli/arduino/cores/packageindex"
++ "github.com/arduino/arduino-cli/configuration"
+ "github.com/arduino/arduino-cli/executils"
+ rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
+ "github.com/arduino/go-paths-helper"
+@@ -79,6 +81,24 @@ func (pme *Explorer) DownloadAndInstallP
+ skipPostInstall bool, skipPreUninstall bool) error {
+ log := pme.log.WithField("platform", platformRelease)
+
++ // Search for third-party packages
++ if runtime.GOOS == "netbsd" {
++ prefixDir := paths.New("/usr/pkg")
++ platformDir := filepath.Join("packages", platformRelease.Platform.Package.Name, "hardware", platformRelease.Platform.Name, platformRelease.Version.String())
++ packageDir := prefixDir.Join("arduino15", platformDir)
++ _, err := packageDir.IsDirCheck()
++ if err != nil {
++ return fmt.Errorf("%w", err)
++ }
++
++ dataDir := configuration.Settings.GetString("directories.Data")
++ destDir := paths.New(filepath.Join(dataDir, platformDir))
++ if err := packageDir.CopyDirTo(destDir); err != nil {
++ return fmt.Errorf("%w", err)
++ }
++ return nil
++ }
++
+ // Prerequisite checks before install
+ toolsToInstall := []*cores.ToolRelease{}
+ for _, tool := range requiredTools {
diff --git a/arduino-cli/patches/patch-commands_instances.go b/arduino-cli/patches/patch-commands_instances.go
index 3dff6cfecc..89a41432ca 100644
--- a/arduino-cli/patches/patch-commands_instances.go
+++ b/arduino-cli/patches/patch-commands_instances.go
@@ -1,38 +1,32 @@
$NetBSD$
---- commands/instances.go.orig 2024-02-13 11:40:35.243625117 +0000
+--- commands/instances.go.orig 2024-02-19 13:15:51.000000000 +0000
+++ commands/instances.go
-@@ -19,7 +19,9 @@ import (
- "context"
+@@ -20,6 +20,7 @@ import (
"fmt"
"net/url"
-+ "os"
"path/filepath"
+ "runtime"
"strings"
"github.com/arduino/arduino-cli/arduino"
-@@ -48,6 +50,28 @@ var tr = i18n.Tr
+@@ -48,6 +49,24 @@ var tr = i18n.Tr
func installTool(pm *packagemanager.PackageManager, tool *cores.ToolRelease, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error {
pme, release := pm.NewExplorer()
defer release()
+ // Search for third-party packages
+ if runtime.GOOS == "netbsd" {
+ prefixDir := paths.New("/usr/pkg")
-+ subDir := filepath.Join("packages", tool.Tool.Package.Name, "tools", tool.Tool.Name)
-+ packageDir := prefixDir.Join("arduino15", subDir)
++ toolDir := filepath.Join("packages", tool.Tool.Package.Name, "tools", tool.Tool.Name, tool.Version.String())
++ packageDir := prefixDir.Join("arduino15", toolDir)
+ _, err := packageDir.IsDirCheck()
+ if err != nil {
+ return fmt.Errorf("%w", err)
+ }
+
-+ userHomeDir, err := os.UserHomeDir()
-+ if err != nil {
-+ return fmt.Errorf("%w", err)
-+ }
-+
-+ userDataDir := paths.New(filepath.Join(userHomeDir, ".arduino15", subDir))
-+ if err := packageDir.CopyDirTo(userDataDir); err != nil {
++ dataDir := configuration.Settings.GetString("directories.Data")
++ destDir := paths.New(filepath.Join(dataDir, toolDir))
++ if err := packageDir.CopyDirTo(destDir); err != nil {
+ return fmt.Errorf("%w", err)
+ }
+ return nil
Home |
Main Index |
Thread Index |
Old Index