From d8a2e56b8885d4a4ddf80925f1b891d5e896a1aa Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 7 Feb 2025 18:23:05 -0600 Subject: [PATCH] updated proto files to conform with autogenpb --- Makefile | 2 +- apt.go | 11 ++++------- apt_linux.go | 1 + machine.proto | 28 ++++++++++++++-------------- package.proto | 20 ++++++++++---------- 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index f867ef2..2413c56 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # go install -all: package.pb.go machine.pb.go vet +all: package.pb.go machine.pb.go goimports vet vet: @GO111MODULE=off go vet diff --git a/apt.go b/apt.go index 782c148..38157a7 100644 --- a/apt.go +++ b/apt.go @@ -24,17 +24,14 @@ func (me *Machine) initPackages() { new1 := new(Package) new1.Name = pkg new1.Version = version - if me.Packages.Append(new1) { - // log.Info("added", new1.Name, "ok") - } else { - log.Info("added", new1.Name, "failed") - } + me.Packages.Append(new1) + log.Info("added", new1.Name, "failed") } } -func (me *Machine) addNew(name string, version string) bool { +func (me *Machine) addNew(name string, version string) { new1 := new(Package) new1.Name = name new1.Version = version - return me.Packages.Append(new1) + me.Packages.Append(new1) } diff --git a/apt_linux.go b/apt_linux.go index 540908b..6a1a800 100644 --- a/apt_linux.go +++ b/apt_linux.go @@ -75,6 +75,7 @@ func (me *Machine) UpdatePackages() string { log.Info("fixme. broken after move to autogenpb") return "" } + /* func (me *Machine) UpdatePackages() string { // Get the list of installed packages for the detected distro diff --git a/machine.proto b/machine.proto index b0bf5aa..7ce8c34 100644 --- a/machine.proto +++ b/machine.proto @@ -7,20 +7,20 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time // global settings for autogenpb `autogenpb:mutex` -message Machine { // `autogenpb:marshal` - string hostname = 1; // `autogenpb:unique` - int64 memory = 2; - int64 cpus = 3; - string distro = 4; - Packages packages = 5; - google.protobuf.Timestamp laststamp = 6; // the last time we heard anything from this machine - Packages installed = 7; // packages that are installed - Packages available = 8; // packages that are available - Packages wit = 9; // packages that are available from mirrors.wit.com +message Machine { // `autogenpb:marshal` + string hostname = 1; // `autogenpb:unique` + int64 memory = 2; + int64 cpus = 3; + string distro = 4; + Packages packages = 5; + google.protobuf.Timestamp laststamp = 6; // the last time we heard anything from this machine + Packages installed = 7; // packages that are installed + Packages available = 8; // packages that are available + Packages wit = 9; // packages that are available from mirrors.wit.com } -message Machines { // `autogenpb:marshal` - string uuid = 1; // I guess why not just have this on each file - string version = 2; // maybe can be used for protobuf schema change violations - repeated Machine machines = 3; +message Machines { // `autogenpb:marshal` + string uuid = 1; // `autogenpb:uuid:b57e7fac-a8fc-4949-9d50-fa38312dec87` + string version = 2; // `autogenpb:version:v0.0.1` + repeated Machine machines = 3; } diff --git a/package.proto b/package.proto index 9dc301b..fdf81a3 100644 --- a/package.proto +++ b/package.proto @@ -8,16 +8,16 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time // global settings for autogenpb `autogenpb:mutex` message Package { - string name = 1; // `autogenpb:unique` // name: zookeeper-go - string version = 2; // version: 0.0.3 - google.protobuf.Timestamp laststamp = 3; // the last time this package was seen (used to timeout entries) - string srcPath = 4; // path to the sources (go.wit.com/apps/zookeeper) - bool installed = 5; // if installed on your machine, this should be set to true - string pkgName = 6; // the apt filename pool/main/f/foo/foo_2.2.2_riscv64.deb + string name = 1; // `autogenpb:unique` `autogenpb:sort` + string version = 2; // version: 0.0.3 + google.protobuf.Timestamp laststamp = 3; // the last time this package was seen (used to timeout entries) + string srcPath = 4; // path to the sources (go.wit.com/apps/zookeeper) + bool installed = 5; // if installed on your machine, this should be set to true + string pkgName = 6; // the apt filename pool/main/f/foo/foo_2.2.2_riscv64.deb } -message Packages { // `autogenpb:marshal` - string uuid = 1; // I guess why not just have this on each file - string version = 2; // maybe can be used for protobuf schema change violations - repeated Package packages = 3; +message Packages { // `autogenpb:marshal` + string uuid = 1; // `autogenpb:uuid:2f26cc03-ea30-4481-a333-ad0acc86e1d3` + string version = 2; // `autogenpb:version:v0.0.1` + repeated Package packages = 3; }