Merge pull request #344 from bnema/chore/upstream-foundations
chore(deps): integrate approved upstream foundations
921 files · +28709 -25527
M docs/first-presentation.md +5 -2
| @@ -46,5 +46,8 @@ labels. Set `DUMBER_MACHINE_GPU_PROFILE` to one of `generic-gpu`, | |||
| 46 | 46 | `integrated-gpu`, `discrete-gpu`, `hybrid-gpu`, `virtual-gpu`, or `unknown-gpu`; | |
| 47 | 47 | do not use a device model or other identifier. Publish only the seven reviewed | |
| 48 | 48 | JSON files to an external Gist. Raw logs and temporary XDG homes are removed and | |
| 49 | - | must not be published. A missing or incomplete timeline, non-DMABUF backend, or | |
| 50 | - | invalid run fails collection. | |
| 49 | + | must not be published. `metadata.json` derives the selected | |
| 50 | + | `github.com/bnema/purego-cef2gtk` pseudo-version and its full immutable Git | |
| 51 | + | origin hash from Go module metadata; branch selectors or missing origin metadata | |
| 52 | + | fail collection. A missing or incomplete timeline, non-DMABUF backend, or invalid | |
| 53 | + | run also fails collection. | |
| @@ -46,5 +46,8 @@ labels. Set `DUMBER_MACHINE_GPU_PROFILE` to one of `generic-gpu`, | |||||
| 46 | `integrated-gpu`, `discrete-gpu`, `hybrid-gpu`, `virtual-gpu`, or `unknown-gpu`; | 46 | `integrated-gpu`, `discrete-gpu`, `hybrid-gpu`, `virtual-gpu`, or `unknown-gpu`; | ||
| 47 | do not use a device model or other identifier. Publish only the seven reviewed | 47 | do not use a device model or other identifier. Publish only the seven reviewed | ||
| 48 | JSON files to an external Gist. Raw logs and temporary XDG homes are removed and | 48 | JSON files to an external Gist. Raw logs and temporary XDG homes are removed and | ||
| 49 | - | must not be published. A missing or incomplete timeline, non-DMABUF backend, or | 49 | + | must not be published. `metadata.json` derives the selected |
| 50 | - | invalid run fails collection. | 50 | + | `github.com/bnema/purego-cef2gtk` pseudo-version and its full immutable Git |
| 51 | + | origin hash from Go module metadata; branch selectors or missing origin metadata | |||
| 52 | + | fail collection. A missing or incomplete timeline, non-DMABUF backend, or invalid | |||
| 53 | + | run also fails collection. | |||
M go.mod +5 -5
| @@ -6,11 +6,11 @@ require ( | |||
| 6 | 6 | github.com/a-h/templ v0.3.1020 | |
| 7 | 7 | github.com/andybalholm/brotli v1.2.2 | |
| 8 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | |
| 9 | - | github.com/bnema/purego-cef v0.13.3 | |
| 10 | - | github.com/bnema/purego-cef2gtk v0.8.4 | |
| 11 | - | github.com/bnema/purego-pipewire v0.1.4 | |
| 12 | - | github.com/bnema/purego-sqlite v0.1.3 | |
| 13 | - | github.com/bnema/puregotk v0.7.0 | |
| 9 | + | github.com/bnema/purego-cef v0.13.4-0.20260714140305-f0b7414af67e | |
| 10 | + | github.com/bnema/purego-cef2gtk v0.8.4-0.20260714160309-bbd397409ebe | |
| 11 | + | github.com/bnema/purego-pipewire v0.1.5-0.20260714124450-6504b9cdf02a | |
| 12 | + | github.com/bnema/purego-sqlite v0.1.4-0.20260714131321-3614fe683b9c | |
| 13 | + | github.com/bnema/puregotk v0.7.1-0.20260714170452-0b6b9b901234 | |
| 14 | 14 | github.com/charmbracelet/bubbles v1.0.0 | |
| 15 | 15 | github.com/charmbracelet/bubbletea v1.3.10 | |
| 16 | 16 | github.com/charmbracelet/lipgloss v1.1.0 | |
| @@ -6,11 +6,11 @@ require ( | |||||
| 6 | github.com/a-h/templ v0.3.1020 | 6 | github.com/a-h/templ v0.3.1020 | ||
| 7 | github.com/andybalholm/brotli v1.2.2 | 7 | github.com/andybalholm/brotli v1.2.2 | ||
| 8 | github.com/bnema/purego v0.11.0-bnema.4 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | ||
| 9 | - | github.com/bnema/purego-cef v0.13.3 | 9 | + | github.com/bnema/purego-cef v0.13.4-0.20260714140305-f0b7414af67e |
| 10 | - | github.com/bnema/purego-cef2gtk v0.8.4 | 10 | + | github.com/bnema/purego-cef2gtk v0.8.4-0.20260714160309-bbd397409ebe |
| 11 | - | github.com/bnema/purego-pipewire v0.1.4 | 11 | + | github.com/bnema/purego-pipewire v0.1.5-0.20260714124450-6504b9cdf02a |
| 12 | - | github.com/bnema/purego-sqlite v0.1.3 | 12 | + | github.com/bnema/purego-sqlite v0.1.4-0.20260714131321-3614fe683b9c |
| 13 | - | github.com/bnema/puregotk v0.7.0 | 13 | + | github.com/bnema/puregotk v0.7.1-0.20260714170452-0b6b9b901234 |
| 14 | github.com/charmbracelet/bubbles v1.0.0 | 14 | github.com/charmbracelet/bubbles v1.0.0 | ||
| 15 | github.com/charmbracelet/bubbletea v1.3.10 | 15 | github.com/charmbracelet/bubbletea v1.3.10 | ||
| 16 | github.com/charmbracelet/lipgloss v1.1.0 | 16 | github.com/charmbracelet/lipgloss v1.1.0 | ||
M go.sum +12 -0 generated file: collapsed
A internal/infrastructure/persistence/sqlite/history_repo_benchmark_test.go +71 -0
| @@ -0,0 +1,71 @@ | |||
| 1 | + | package sqlite_test | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "fmt" | |
| 5 | + | "path/filepath" | |
| 6 | + | "testing" | |
| 7 | + | ||
| 8 | + | "github.com/bnema/dumber/internal/domain/entity" | |
| 9 | + | "github.com/bnema/dumber/internal/domain/repository" | |
| 10 | + | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | |
| 11 | + | ) | |
| 12 | + | ||
| 13 | + | // newHistoryBenchmarkRepository creates a representative local history corpus | |
| 14 | + | // outside the measured operation. Sidebar reads use GetRecent and omnibox | |
| 15 | + | // history suggestions use Search. | |
| 16 | + | func newHistoryBenchmarkRepository(b *testing.B) (repository.HistoryRepository, func()) { | |
| 17 | + | b.Helper() | |
| 18 | + | ||
| 19 | + | ctx := historyTestCtx() | |
| 20 | + | db, err := sqlite.NewConnection(ctx, filepath.Join(b.TempDir(), "dumber.db")) | |
| 21 | + | if err != nil { | |
| 22 | + | b.Fatal(err) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | b.Cleanup(func() { | |
| 26 | + | if err := db.Close(); err != nil { | |
| 27 | + | b.Errorf("close benchmark database: %v", err) | |
| 28 | + | } | |
| 29 | + | }) | |
| 30 | + | ||
| 31 | + | repo := sqlite.NewHistoryRepository(db) | |
| 32 | + | for i := range 200 { | |
| 33 | + | entry := &entity.HistoryEntry{ | |
| 34 | + | URL: fmt.Sprintf("https://example%d.test/dumber/history/%d", i%20, i), | |
| 35 | + | Title: fmt.Sprintf("Dumber history entry %d", i), | |
| 36 | + | } | |
| 37 | + | if err := repo.Save(ctx, entry); err != nil { | |
| 38 | + | b.Fatal(err) | |
| 39 | + | } | |
| 40 | + | } | |
| 41 | + | ||
| 42 | + | return repo, func() {} | |
| 43 | + | } | |
| 44 | + | ||
| 45 | + | func BenchmarkHistorySQLiteSidebarRecent(b *testing.B) { | |
| 46 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |
| 47 | + | defer closeDB() | |
| 48 | + | ctx := historyTestCtx() | |
| 49 | + | ||
| 50 | + | b.ReportAllocs() | |
| 51 | + | b.ResetTimer() | |
| 52 | + | for range b.N { | |
| 53 | + | if _, err := repo.GetRecent(ctx, 50, 0); err != nil { | |
| 54 | + | b.Fatal(err) | |
| 55 | + | } | |
| 56 | + | } | |
| 57 | + | } | |
| 58 | + | ||
| 59 | + | func BenchmarkHistorySQLiteOmniboxSearch(b *testing.B) { | |
| 60 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |
| 61 | + | defer closeDB() | |
| 62 | + | ctx := historyTestCtx() | |
| 63 | + | ||
| 64 | + | b.ReportAllocs() | |
| 65 | + | b.ResetTimer() | |
| 66 | + | for range b.N { | |
| 67 | + | if _, err := repo.Search(ctx, "dumber history", 10); err != nil { | |
| 68 | + | b.Fatal(err) | |
| 69 | + | } | |
| 70 | + | } | |
| 71 | + | } | |
| @@ -0,0 +1,71 @@ | |||||
| 1 | + | package sqlite_test | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "fmt" | |||
| 5 | + | "path/filepath" | |||
| 6 | + | "testing" | |||
| 7 | + | ||||
| 8 | + | "github.com/bnema/dumber/internal/domain/entity" | |||
| 9 | + | "github.com/bnema/dumber/internal/domain/repository" | |||
| 10 | + | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | |||
| 11 | + | ) | |||
| 12 | + | ||||
| 13 | + | // newHistoryBenchmarkRepository creates a representative local history corpus | |||
| 14 | + | // outside the measured operation. Sidebar reads use GetRecent and omnibox | |||
| 15 | + | // history suggestions use Search. | |||
| 16 | + | func newHistoryBenchmarkRepository(b *testing.B) (repository.HistoryRepository, func()) { | |||
| 17 | + | b.Helper() | |||
| 18 | + | ||||
| 19 | + | ctx := historyTestCtx() | |||
| 20 | + | db, err := sqlite.NewConnection(ctx, filepath.Join(b.TempDir(), "dumber.db")) | |||
| 21 | + | if err != nil { | |||
| 22 | + | b.Fatal(err) | |||
| 23 | + | } | |||
| 24 | + | ||||
| 25 | + | b.Cleanup(func() { | |||
| 26 | + | if err := db.Close(); err != nil { | |||
| 27 | + | b.Errorf("close benchmark database: %v", err) | |||
| 28 | + | } | |||
| 29 | + | }) | |||
| 30 | + | ||||
| 31 | + | repo := sqlite.NewHistoryRepository(db) | |||
| 32 | + | for i := range 200 { | |||
| 33 | + | entry := &entity.HistoryEntry{ | |||
| 34 | + | URL: fmt.Sprintf("https://example%d.test/dumber/history/%d", i%20, i), | |||
| 35 | + | Title: fmt.Sprintf("Dumber history entry %d", i), | |||
| 36 | + | } | |||
| 37 | + | if err := repo.Save(ctx, entry); err != nil { | |||
| 38 | + | b.Fatal(err) | |||
| 39 | + | } | |||
| 40 | + | } | |||
| 41 | + | ||||
| 42 | + | return repo, func() {} | |||
| 43 | + | } | |||
| 44 | + | ||||
| 45 | + | func BenchmarkHistorySQLiteSidebarRecent(b *testing.B) { | |||
| 46 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |||
| 47 | + | defer closeDB() | |||
| 48 | + | ctx := historyTestCtx() | |||
| 49 | + | ||||
| 50 | + | b.ReportAllocs() | |||
| 51 | + | b.ResetTimer() | |||
| 52 | + | for range b.N { | |||
| 53 | + | if _, err := repo.GetRecent(ctx, 50, 0); err != nil { | |||
| 54 | + | b.Fatal(err) | |||
| 55 | + | } | |||
| 56 | + | } | |||
| 57 | + | } | |||
| 58 | + | ||||
| 59 | + | func BenchmarkHistorySQLiteOmniboxSearch(b *testing.B) { | |||
| 60 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |||
| 61 | + | defer closeDB() | |||
| 62 | + | ctx := historyTestCtx() | |||
| 63 | + | ||||
| 64 | + | b.ReportAllocs() | |||
| 65 | + | b.ResetTimer() | |||
| 66 | + | for range b.N { | |||
| 67 | + | if _, err := repo.Search(ctx, "dumber history", 10); err != nil { | |||
| 68 | + | b.Fatal(err) | |||
| 69 | + | } | |||
| 70 | + | } | |||
| 71 | + | } | |||
M internal/logging/first_presentation_collector_test.go +132 -1
| @@ -2,6 +2,7 @@ package logging | |||
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | 4 | "encoding/json" | |
| 5 | + | "fmt" | |
| 5 | 6 | "os" | |
| 6 | 7 | "os/exec" | |
| 7 | 8 | "path/filepath" | |
| @@ -143,8 +144,9 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||
| 143 | 144 | } | |
| 144 | 145 | for _, required := range []string{ | |
| 145 | 146 | `"measured_source_revision"`, | |
| 147 | + | `"version": "v0.8.4-0.20260714160309-bbd397409ebe"`, | |
| 146 | 148 | `"tag": "v0.8.4"`, | |
| 147 | - | `"revision": "f217ece342dea3ef2a3f98671fcd16a39ad0037d"`, | |
| 149 | + | `"revision": "bbd397409ebed75a5979c1e4566a2ef319f6a484"`, | |
| 148 | 150 | } { | |
| 149 | 151 | require.Contains(t, artifacts.String(), required) | |
| 150 | 152 | } | |
| @@ -166,6 +168,135 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||
| 166 | 168 | require.Equal(t, "integrated-gpu", metadata.Comparison.MachineGPUProfile) | |
| 167 | 169 | } | |
| 168 | 170 | ||
| 171 | + | func TestFirstPresentationCollectorDerivesSelectedImmutableModuleProvenance(t *testing.T) { | |
| 172 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |
| 173 | + | require.NoError(t, err) | |
| 174 | + | temp := t.TempDir() | |
| 175 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |
| 176 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |
| 177 | + | binary := filepath.Join(temp, "dumber") | |
| 178 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |
| 179 | + | ||
| 180 | + | // This exact pseudo-version is deliberately newer than the former v0.8.4 | |
| 181 | + | // hardcode; the collector must report what the selected module says. | |
| 182 | + | const version = "v0.8.5-0.20300102030405-bbd397409ebe" | |
| 183 | + | const revision = "bbd397409ebed75a5979c1e4566a2ef319f6a484" | |
| 184 | + | goBin := collectorProvenanceGo(t, temp, version, revision, "") | |
| 185 | + | output := filepath.Join(temp, "artifacts") | |
| 186 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |
| 187 | + | cmd.Dir = repoRoot | |
| 188 | + | cmd.Env = append(os.Environ(), | |
| 189 | + | "DISPLAY=:test", | |
| 190 | + | "DUMBER_CEF_DIR="+runtime, | |
| 191 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |
| 192 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |
| 193 | + | "DUMBER_FIRST_PRESENTATION_TIMEOUT_SECONDS=1", | |
| 194 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |
| 195 | + | ) | |
| 196 | + | result, err := cmd.CombinedOutput() | |
| 197 | + | require.NoErrorf(t, err, "collector failed: %s", result) | |
| 198 | + | ||
| 199 | + | var metadata struct { | |
| 200 | + | Upstream struct { | |
| 201 | + | Module string `json:"module"` | |
| 202 | + | Version string `json:"version"` | |
| 203 | + | Tag string `json:"tag"` | |
| 204 | + | Revision string `json:"revision"` | |
| 205 | + | } `json:"upstream"` | |
| 206 | + | } | |
| 207 | + | contents, err := os.ReadFile(filepath.Join(output, "metadata.json")) | |
| 208 | + | require.NoError(t, err) | |
| 209 | + | require.NoError(t, json.Unmarshal(contents, &metadata)) | |
| 210 | + | require.Equal(t, "github.com/bnema/purego-cef2gtk", metadata.Upstream.Module) | |
| 211 | + | require.Equal(t, version, metadata.Upstream.Version) | |
| 212 | + | require.Equal(t, "v0.8.5", metadata.Upstream.Tag) | |
| 213 | + | require.Equal(t, revision, metadata.Upstream.Revision) | |
| 214 | + | ||
| 215 | + | script, err := os.ReadFile(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |
| 216 | + | require.NoError(t, err) | |
| 217 | + | require.NotContains(t, string(script), "f217ece342dea3ef2a3f98671fcd16a39ad0037d") | |
| 218 | + | } | |
| 219 | + | ||
| 220 | + | func TestFirstPresentationCollectorRejectsNonImmutableModuleProvenanceWithoutLeaks(t *testing.T) { | |
| 221 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |
| 222 | + | require.NoError(t, err) | |
| 223 | + | ||
| 224 | + | for _, test := range []struct { | |
| 225 | + | name, version, revision, ref string | |
| 226 | + | }{ | |
| 227 | + | {name: "branch selector", version: "main", ref: "main"}, | |
| 228 | + | {name: "missing origin", version: "v0.8.5-0.20300102030405-bbd397409ebe"}, | |
| 229 | + | {name: "named origin ref", version: "v0.8.5-0.20300102030405-bbd397409ebe", revision: "bbd397409ebed75a5979c1e4566a2ef319f6a484", ref: "main"}, | |
| 230 | + | } { | |
| 231 | + | t.Run(test.name, func(t *testing.T) { | |
| 232 | + | temp := t.TempDir() | |
| 233 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |
| 234 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |
| 235 | + | binary := filepath.Join(temp, "dumber") | |
| 236 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |
| 237 | + | ||
| 238 | + | goBin := collectorProvenanceGo(t, temp, test.version, test.revision, test.ref) | |
| 239 | + | output := filepath.Join(temp, "artifacts") | |
| 240 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |
| 241 | + | cmd.Dir = repoRoot | |
| 242 | + | cmd.Env = append(os.Environ(), | |
| 243 | + | "DISPLAY=:test", | |
| 244 | + | "DUMBER_CEF_DIR="+runtime, | |
| 245 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |
| 246 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |
| 247 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |
| 248 | + | ) | |
| 249 | + | result, runErr := cmd.CombinedOutput() | |
| 250 | + | require.Errorf(t, runErr, "collector accepted nonimmutable module provenance: %s", result) | |
| 251 | + | require.Contains(t, string(result), "immutable module provenance is unavailable") | |
| 252 | + | require.NotContains(t, string(result), temp) | |
| 253 | + | require.NoFileExists(t, filepath.Join(output, "metadata.json")) | |
| 254 | + | for _, name := range runArtifactNames() { | |
| 255 | + | require.NoFileExists(t, filepath.Join(output, name)) | |
| 256 | + | } | |
| 257 | + | }) | |
| 258 | + | } | |
| 259 | + | } | |
| 260 | + | ||
| 261 | + | func collectorProvenanceGo(t *testing.T, temp, version, revision, ref string) string { | |
| 262 | + | t.Helper() | |
| 263 | + | infoPath := filepath.Join(temp, "module.info") | |
| 264 | + | info := map[string]any{"Version": version} | |
| 265 | + | if revision != "" { | |
| 266 | + | info["Origin"] = map[string]string{ | |
| 267 | + | "VCS": "git", "URL": "https://github.com/bnema/purego-cef2gtk", "Hash": revision, "Ref": ref, | |
| 268 | + | } | |
| 269 | + | } | |
| 270 | + | infoJSON, err := json.Marshal(info) | |
| 271 | + | require.NoError(t, err) | |
| 272 | + | require.NoError(t, os.WriteFile(infoPath, infoJSON, 0o600)) | |
| 273 | + | ||
| 274 | + | selectedJSON, err := json.Marshal(map[string]string{ | |
| 275 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, | |
| 276 | + | }) | |
| 277 | + | require.NoError(t, err) | |
| 278 | + | downloadedJSON, err := json.Marshal(map[string]string{ | |
| 279 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, "Info": infoPath, | |
| 280 | + | }) | |
| 281 | + | require.NoError(t, err) | |
| 282 | + | binDir := filepath.Join(temp, "bin") | |
| 283 | + | require.NoError(t, os.Mkdir(binDir, 0o755)) | |
| 284 | + | goBin := filepath.Join(binDir, "go") | |
| 285 | + | script := fmt.Sprintf(`#!/bin/sh | |
| 286 | + | if [ "$1" = "list" ] && [ "$2" = "-m" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk" ]; then | |
| 287 | + | printf '%%s\n' '%s' | |
| 288 | + | exit 0 | |
| 289 | + | fi | |
| 290 | + | if [ "$1" = "mod" ] && [ "$2" = "download" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk@%s" ]; then | |
| 291 | + | printf '%%s\n' '%s' | |
| 292 | + | exit 0 | |
| 293 | + | fi | |
| 294 | + | exit 1 | |
| 295 | + | `, selectedJSON, version, downloadedJSON) | |
| 296 | + | require.NoError(t, os.WriteFile(goBin, []byte(script), 0o755)) | |
| 297 | + | return goBin | |
| 298 | + | } | |
| 299 | + | ||
| 169 | 300 | func TestFirstPresentationCollectorDefaultsToXDGStateEvidenceDirectory(t *testing.T) { | |
| 170 | 301 | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |
| 171 | 302 | require.NoError(t, err) | |
| @@ -2,6 +2,7 @@ package logging | |||||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | "encoding/json" | 4 | "encoding/json" | ||
| 5 | + | "fmt" | |||
| 5 | "os" | 6 | "os" | ||
| 6 | "os/exec" | 7 | "os/exec" | ||
| 7 | "path/filepath" | 8 | "path/filepath" | ||
| @@ -143,8 +144,9 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||||
| 143 | } | 144 | } | ||
| 144 | for _, required := range []string{ | 145 | for _, required := range []string{ | ||
| 145 | `"measured_source_revision"`, | 146 | `"measured_source_revision"`, | ||
| 147 | + | `"version": "v0.8.4-0.20260714160309-bbd397409ebe"`, | |||
| 146 | `"tag": "v0.8.4"`, | 148 | `"tag": "v0.8.4"`, | ||
| 147 | - | `"revision": "f217ece342dea3ef2a3f98671fcd16a39ad0037d"`, | 149 | + | `"revision": "bbd397409ebed75a5979c1e4566a2ef319f6a484"`, |
| 148 | } { | 150 | } { | ||
| 149 | require.Contains(t, artifacts.String(), required) | 151 | require.Contains(t, artifacts.String(), required) | ||
| 150 | } | 152 | } | ||
| @@ -166,6 +168,135 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||||
| 166 | require.Equal(t, "integrated-gpu", metadata.Comparison.MachineGPUProfile) | 168 | require.Equal(t, "integrated-gpu", metadata.Comparison.MachineGPUProfile) | ||
| 167 | } | 169 | } | ||
| 168 | 170 | ||||
| 171 | + | func TestFirstPresentationCollectorDerivesSelectedImmutableModuleProvenance(t *testing.T) { | |||
| 172 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |||
| 173 | + | require.NoError(t, err) | |||
| 174 | + | temp := t.TempDir() | |||
| 175 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |||
| 176 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |||
| 177 | + | binary := filepath.Join(temp, "dumber") | |||
| 178 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |||
| 179 | + | ||||
| 180 | + | // This exact pseudo-version is deliberately newer than the former v0.8.4 | |||
| 181 | + | // hardcode; the collector must report what the selected module says. | |||
| 182 | + | const version = "v0.8.5-0.20300102030405-bbd397409ebe" | |||
| 183 | + | const revision = "bbd397409ebed75a5979c1e4566a2ef319f6a484" | |||
| 184 | + | goBin := collectorProvenanceGo(t, temp, version, revision, "") | |||
| 185 | + | output := filepath.Join(temp, "artifacts") | |||
| 186 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |||
| 187 | + | cmd.Dir = repoRoot | |||
| 188 | + | cmd.Env = append(os.Environ(), | |||
| 189 | + | "DISPLAY=:test", | |||
| 190 | + | "DUMBER_CEF_DIR="+runtime, | |||
| 191 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |||
| 192 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |||
| 193 | + | "DUMBER_FIRST_PRESENTATION_TIMEOUT_SECONDS=1", | |||
| 194 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |||
| 195 | + | ) | |||
| 196 | + | result, err := cmd.CombinedOutput() | |||
| 197 | + | require.NoErrorf(t, err, "collector failed: %s", result) | |||
| 198 | + | ||||
| 199 | + | var metadata struct { | |||
| 200 | + | Upstream struct { | |||
| 201 | + | Module string `json:"module"` | |||
| 202 | + | Version string `json:"version"` | |||
| 203 | + | Tag string `json:"tag"` | |||
| 204 | + | Revision string `json:"revision"` | |||
| 205 | + | } `json:"upstream"` | |||
| 206 | + | } | |||
| 207 | + | contents, err := os.ReadFile(filepath.Join(output, "metadata.json")) | |||
| 208 | + | require.NoError(t, err) | |||
| 209 | + | require.NoError(t, json.Unmarshal(contents, &metadata)) | |||
| 210 | + | require.Equal(t, "github.com/bnema/purego-cef2gtk", metadata.Upstream.Module) | |||
| 211 | + | require.Equal(t, version, metadata.Upstream.Version) | |||
| 212 | + | require.Equal(t, "v0.8.5", metadata.Upstream.Tag) | |||
| 213 | + | require.Equal(t, revision, metadata.Upstream.Revision) | |||
| 214 | + | ||||
| 215 | + | script, err := os.ReadFile(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |||
| 216 | + | require.NoError(t, err) | |||
| 217 | + | require.NotContains(t, string(script), "f217ece342dea3ef2a3f98671fcd16a39ad0037d") | |||
| 218 | + | } | |||
| 219 | + | ||||
| 220 | + | func TestFirstPresentationCollectorRejectsNonImmutableModuleProvenanceWithoutLeaks(t *testing.T) { | |||
| 221 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |||
| 222 | + | require.NoError(t, err) | |||
| 223 | + | ||||
| 224 | + | for _, test := range []struct { | |||
| 225 | + | name, version, revision, ref string | |||
| 226 | + | }{ | |||
| 227 | + | {name: "branch selector", version: "main", ref: "main"}, | |||
| 228 | + | {name: "missing origin", version: "v0.8.5-0.20300102030405-bbd397409ebe"}, | |||
| 229 | + | {name: "named origin ref", version: "v0.8.5-0.20300102030405-bbd397409ebe", revision: "bbd397409ebed75a5979c1e4566a2ef319f6a484", ref: "main"}, | |||
| 230 | + | } { | |||
| 231 | + | t.Run(test.name, func(t *testing.T) { | |||
| 232 | + | temp := t.TempDir() | |||
| 233 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |||
| 234 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |||
| 235 | + | binary := filepath.Join(temp, "dumber") | |||
| 236 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |||
| 237 | + | ||||
| 238 | + | goBin := collectorProvenanceGo(t, temp, test.version, test.revision, test.ref) | |||
| 239 | + | output := filepath.Join(temp, "artifacts") | |||
| 240 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |||
| 241 | + | cmd.Dir = repoRoot | |||
| 242 | + | cmd.Env = append(os.Environ(), | |||
| 243 | + | "DISPLAY=:test", | |||
| 244 | + | "DUMBER_CEF_DIR="+runtime, | |||
| 245 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |||
| 246 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |||
| 247 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |||
| 248 | + | ) | |||
| 249 | + | result, runErr := cmd.CombinedOutput() | |||
| 250 | + | require.Errorf(t, runErr, "collector accepted nonimmutable module provenance: %s", result) | |||
| 251 | + | require.Contains(t, string(result), "immutable module provenance is unavailable") | |||
| 252 | + | require.NotContains(t, string(result), temp) | |||
| 253 | + | require.NoFileExists(t, filepath.Join(output, "metadata.json")) | |||
| 254 | + | for _, name := range runArtifactNames() { | |||
| 255 | + | require.NoFileExists(t, filepath.Join(output, name)) | |||
| 256 | + | } | |||
| 257 | + | }) | |||
| 258 | + | } | |||
| 259 | + | } | |||
| 260 | + | ||||
| 261 | + | func collectorProvenanceGo(t *testing.T, temp, version, revision, ref string) string { | |||
| 262 | + | t.Helper() | |||
| 263 | + | infoPath := filepath.Join(temp, "module.info") | |||
| 264 | + | info := map[string]any{"Version": version} | |||
| 265 | + | if revision != "" { | |||
| 266 | + | info["Origin"] = map[string]string{ | |||
| 267 | + | "VCS": "git", "URL": "https://github.com/bnema/purego-cef2gtk", "Hash": revision, "Ref": ref, | |||
| 268 | + | } | |||
| 269 | + | } | |||
| 270 | + | infoJSON, err := json.Marshal(info) | |||
| 271 | + | require.NoError(t, err) | |||
| 272 | + | require.NoError(t, os.WriteFile(infoPath, infoJSON, 0o600)) | |||
| 273 | + | ||||
| 274 | + | selectedJSON, err := json.Marshal(map[string]string{ | |||
| 275 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, | |||
| 276 | + | }) | |||
| 277 | + | require.NoError(t, err) | |||
| 278 | + | downloadedJSON, err := json.Marshal(map[string]string{ | |||
| 279 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, "Info": infoPath, | |||
| 280 | + | }) | |||
| 281 | + | require.NoError(t, err) | |||
| 282 | + | binDir := filepath.Join(temp, "bin") | |||
| 283 | + | require.NoError(t, os.Mkdir(binDir, 0o755)) | |||
| 284 | + | goBin := filepath.Join(binDir, "go") | |||
| 285 | + | script := fmt.Sprintf(`#!/bin/sh | |||
| 286 | + | if [ "$1" = "list" ] && [ "$2" = "-m" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk" ]; then | |||
| 287 | + | printf '%%s\n' '%s' | |||
| 288 | + | exit 0 | |||
| 289 | + | fi | |||
| 290 | + | if [ "$1" = "mod" ] && [ "$2" = "download" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk@%s" ]; then | |||
| 291 | + | printf '%%s\n' '%s' | |||
| 292 | + | exit 0 | |||
| 293 | + | fi | |||
| 294 | + | exit 1 | |||
| 295 | + | `, selectedJSON, version, downloadedJSON) | |||
| 296 | + | require.NoError(t, os.WriteFile(goBin, []byte(script), 0o755)) | |||
| 297 | + | return goBin | |||
| 298 | + | } | |||
| 299 | + | ||||
| 169 | func TestFirstPresentationCollectorDefaultsToXDGStateEvidenceDirectory(t *testing.T) { | 300 | func TestFirstPresentationCollectorDefaultsToXDGStateEvidenceDirectory(t *testing.T) { | ||
| 170 | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | 301 | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | ||
| 171 | require.NoError(t, err) | 302 | require.NoError(t, err) | ||
M scripts/collect_first_presentation.sh +78 -9
| @@ -31,8 +31,78 @@ else | |||
| 31 | 31 | fi | |
| 32 | 32 | readonly output | |
| 33 | 33 | readonly upstream_module="github.com/bnema/purego-cef2gtk" | |
| 34 | - | readonly upstream_tag="v0.8.4" | |
| 35 | - | readonly upstream_revision="f217ece342dea3ef2a3f98671fcd16a39ad0037d" | |
| 34 | + | ||
| 35 | + | # Resolve the version selected by this checkout, then obtain its immutable VCS | |
| 36 | + | # origin from Go's cached module metadata. Do not infer a revision from a tag, | |
| 37 | + | # a branch, or a truncated pseudo-version suffix. | |
| 38 | + | resolve_upstream_provenance() { | |
| 39 | + | local selected_metadata selected_version downloaded_metadata | |
| 40 | + | ||
| 41 | + | selected_metadata="$(go list -m -json "$upstream_module" 2>/dev/null)" || { | |
| 42 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |
| 43 | + | exit 2 | |
| 44 | + | } | |
| 45 | + | selected_version="$(python3 - "$upstream_module" "$selected_metadata" <<'PY' | |
| 46 | + | import json, sys | |
| 47 | + | try: | |
| 48 | + | metadata = json.loads(sys.argv[2]) | |
| 49 | + | if metadata.get("Path") != sys.argv[1] or not isinstance(metadata.get("Version"), str): | |
| 50 | + | raise ValueError | |
| 51 | + | print(metadata["Version"]) | |
| 52 | + | except (AttributeError, TypeError, ValueError, json.JSONDecodeError): | |
| 53 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |
| 54 | + | PY | |
| 55 | + | )" || exit $? | |
| 56 | + | downloaded_metadata="$(go mod download -json "$upstream_module@$selected_version" 2>/dev/null)" || { | |
| 57 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |
| 58 | + | exit 2 | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | python3 - "$upstream_module" "$selected_metadata" "$downloaded_metadata" <<'PY' | |
| 62 | + | import json, re, sys | |
| 63 | + | ||
| 64 | + | module, selected_raw, downloaded_raw = sys.argv[1:] | |
| 65 | + | ||
| 66 | + | def fail(): | |
| 67 | + | # Do not expose Go cache locations or other machine-local values. | |
| 68 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |
| 69 | + | ||
| 70 | + | try: | |
| 71 | + | selected = json.loads(selected_raw) | |
| 72 | + | downloaded = json.loads(downloaded_raw) | |
| 73 | + | version = selected["Version"] | |
| 74 | + | if selected.get("Path") != module or downloaded.get("Path") != module: | |
| 75 | + | fail() | |
| 76 | + | if downloaded.get("Version") != version: | |
| 77 | + | fail() | |
| 78 | + | # A selected pseudo-version is an exact immutable selector, never a branch. | |
| 79 | + | match = re.fullmatch(r"(v\d+\.\d+\.\d+)-0\.\d{14}-([0-9a-f]{12})", version) | |
| 80 | + | if not match: | |
| 81 | + | fail() | |
| 82 | + | info_path = downloaded.get("Info") | |
| 83 | + | if not isinstance(info_path, str) or not info_path: | |
| 84 | + | fail() | |
| 85 | + | with open(info_path, encoding="utf-8") as info_file: | |
| 86 | + | info = json.load(info_file) | |
| 87 | + | origin = info.get("Origin") or downloaded.get("Origin") | |
| 88 | + | if info.get("Version") != version or not isinstance(origin, dict): | |
| 89 | + | fail() | |
| 90 | + | revision = origin.get("Hash") | |
| 91 | + | if origin.get("VCS") != "git" or origin.get("URL") != "https://github.com/bnema/purego-cef2gtk": | |
| 92 | + | fail() | |
| 93 | + | if not isinstance(revision, str) or not re.fullmatch(r"[0-9a-f]{40}", revision): | |
| 94 | + | fail() | |
| 95 | + | if not revision.startswith(match.group(2)): | |
| 96 | + | fail() | |
| 97 | + | # A named ref can move. Only the immutable hash itself is acceptable. | |
| 98 | + | if origin.get("Ref") not in (None, "", revision): | |
| 99 | + | fail() | |
| 100 | + | except (AttributeError, KeyError, OSError, TypeError, ValueError, json.JSONDecodeError): | |
| 101 | + | fail() | |
| 102 | + | ||
| 103 | + | print("\t".join((version, match.group(1), revision))) | |
| 104 | + | PY | |
| 105 | + | } | |
| 36 | 106 | ||
| 37 | 107 | # The artifact destination is caller-controlled. Never empty or recursively | |
| 38 | 108 | # clear it: collection only writes to a newly-created directory whose parent is | |
| @@ -66,10 +136,9 @@ prepare_output | |||
| 66 | 136 | [[ -x "$binary" ]] || { echo "first-presentation: executable not found: $binary" >&2; exit 2; } | |
| 67 | 137 | [[ -d "$runtime" ]] || { echo "first-presentation: CEF runtime not found: $runtime" >&2; exit 2; } | |
| 68 | 138 | [[ -n "${WAYLAND_DISPLAY:-}${DISPLAY:-}" ]] || { echo "first-presentation: a current Wayland/X11 display is required" >&2; exit 2; } | |
| 69 | - | [[ "$(go list -m -f '{{.Version}}' "$upstream_module")" == "$upstream_tag" ]] || { | |
| 70 | - | echo "first-presentation: expected $upstream_module@$upstream_tag" >&2 | |
| 71 | - | exit 2 | |
| 72 | - | } | |
| 139 | + | upstream_provenance="$(resolve_upstream_provenance)" || exit $? | |
| 140 | + | IFS=$'\t' read -r upstream_version upstream_tag upstream_revision <<<"$upstream_provenance" | |
| 141 | + | readonly upstream_version upstream_tag upstream_revision | |
| 73 | 142 | ||
| 74 | 143 | # Raw logs and temporary XDG homes may contain machine-local paths. Keep them | |
| 75 | 144 | # outside the committed artifact directory and always remove them. | |
| @@ -80,9 +149,9 @@ cleanup_work_root() { | |||
| 80 | 149 | rm -rf -- "$work_root" | |
| 81 | 150 | } | |
| 82 | 151 | trap cleanup_work_root EXIT | |
| 83 | - | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_tag" "$upstream_revision" <<'PY' | |
| 152 | + | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_version" "$upstream_tag" "$upstream_revision" <<'PY' | |
| 84 | 153 | import hashlib, json, os, platform, subprocess, sys | |
| 85 | - | path, binary, timeout, upstream_module, upstream_tag, upstream_revision = sys.argv[1:] | |
| 154 | + | path, binary, timeout, upstream_module, upstream_version, upstream_tag, upstream_revision = sys.argv[1:] | |
| 86 | 155 | with open(binary, "rb") as candidate: | |
| 87 | 156 | binary_sha256 = hashlib.file_digest(candidate, "sha256").hexdigest() | |
| 88 | 157 | ||
| @@ -102,7 +171,7 @@ json.dump({ | |||
| 102 | 171 | "binary": {"label": "dumber", "sha256": binary_sha256}, | |
| 103 | 172 | "timeout_seconds": int(timeout), | |
| 104 | 173 | "measured_source_revision": subprocess.check_output(["git", "-c", f"safe.directory={os.getcwd()}", "rev-parse", "HEAD"], text=True).strip(), | |
| 105 | - | "upstream": {"module": upstream_module, "tag": upstream_tag, "revision": upstream_revision}, | |
| 174 | + | "upstream": {"module": upstream_module, "version": upstream_version, "tag": upstream_tag, "revision": upstream_revision}, | |
| 106 | 175 | "comparison": {"os": os_label, "architecture": architecture, "display_protocol": display_protocol, "machine_gpu_profile": gpu_profile}, | |
| 107 | 176 | "render_configuration": {"backend": "gdk-dmabuf", "buffer_sharing": "dmabuf", "renderer": "vulkan"} | |
| 108 | 177 | }, open(path, "w"), indent=2, sort_keys=True) | |
| @@ -31,8 +31,78 @@ else | |||||
| 31 | fi | 31 | fi | ||
| 32 | readonly output | 32 | readonly output | ||
| 33 | readonly upstream_module="github.com/bnema/purego-cef2gtk" | 33 | readonly upstream_module="github.com/bnema/purego-cef2gtk" | ||
| 34 | - | readonly upstream_tag="v0.8.4" | 34 | + | |
| 35 | - | readonly upstream_revision="f217ece342dea3ef2a3f98671fcd16a39ad0037d" | 35 | + | # Resolve the version selected by this checkout, then obtain its immutable VCS |
| 36 | + | # origin from Go's cached module metadata. Do not infer a revision from a tag, | |||
| 37 | + | # a branch, or a truncated pseudo-version suffix. | |||
| 38 | + | resolve_upstream_provenance() { | |||
| 39 | + | local selected_metadata selected_version downloaded_metadata | |||
| 40 | + | ||||
| 41 | + | selected_metadata="$(go list -m -json "$upstream_module" 2>/dev/null)" || { | |||
| 42 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |||
| 43 | + | exit 2 | |||
| 44 | + | } | |||
| 45 | + | selected_version="$(python3 - "$upstream_module" "$selected_metadata" <<'PY' | |||
| 46 | + | import json, sys | |||
| 47 | + | try: | |||
| 48 | + | metadata = json.loads(sys.argv[2]) | |||
| 49 | + | if metadata.get("Path") != sys.argv[1] or not isinstance(metadata.get("Version"), str): | |||
| 50 | + | raise ValueError | |||
| 51 | + | print(metadata["Version"]) | |||
| 52 | + | except (AttributeError, TypeError, ValueError, json.JSONDecodeError): | |||
| 53 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |||
| 54 | + | PY | |||
| 55 | + | )" || exit $? | |||
| 56 | + | downloaded_metadata="$(go mod download -json "$upstream_module@$selected_version" 2>/dev/null)" || { | |||
| 57 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |||
| 58 | + | exit 2 | |||
| 59 | + | } | |||
| 60 | + | ||||
| 61 | + | python3 - "$upstream_module" "$selected_metadata" "$downloaded_metadata" <<'PY' | |||
| 62 | + | import json, re, sys | |||
| 63 | + | ||||
| 64 | + | module, selected_raw, downloaded_raw = sys.argv[1:] | |||
| 65 | + | ||||
| 66 | + | def fail(): | |||
| 67 | + | # Do not expose Go cache locations or other machine-local values. | |||
| 68 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |||
| 69 | + | ||||
| 70 | + | try: | |||
| 71 | + | selected = json.loads(selected_raw) | |||
| 72 | + | downloaded = json.loads(downloaded_raw) | |||
| 73 | + | version = selected["Version"] | |||
| 74 | + | if selected.get("Path") != module or downloaded.get("Path") != module: | |||
| 75 | + | fail() | |||
| 76 | + | if downloaded.get("Version") != version: | |||
| 77 | + | fail() | |||
| 78 | + | # A selected pseudo-version is an exact immutable selector, never a branch. | |||
| 79 | + | match = re.fullmatch(r"(v\d+\.\d+\.\d+)-0\.\d{14}-([0-9a-f]{12})", version) | |||
| 80 | + | if not match: | |||
| 81 | + | fail() | |||
| 82 | + | info_path = downloaded.get("Info") | |||
| 83 | + | if not isinstance(info_path, str) or not info_path: | |||
| 84 | + | fail() | |||
| 85 | + | with open(info_path, encoding="utf-8") as info_file: | |||
| 86 | + | info = json.load(info_file) | |||
| 87 | + | origin = info.get("Origin") or downloaded.get("Origin") | |||
| 88 | + | if info.get("Version") != version or not isinstance(origin, dict): | |||
| 89 | + | fail() | |||
| 90 | + | revision = origin.get("Hash") | |||
| 91 | + | if origin.get("VCS") != "git" or origin.get("URL") != "https://github.com/bnema/purego-cef2gtk": | |||
| 92 | + | fail() | |||
| 93 | + | if not isinstance(revision, str) or not re.fullmatch(r"[0-9a-f]{40}", revision): | |||
| 94 | + | fail() | |||
| 95 | + | if not revision.startswith(match.group(2)): | |||
| 96 | + | fail() | |||
| 97 | + | # A named ref can move. Only the immutable hash itself is acceptable. | |||
| 98 | + | if origin.get("Ref") not in (None, "", revision): | |||
| 99 | + | fail() | |||
| 100 | + | except (AttributeError, KeyError, OSError, TypeError, ValueError, json.JSONDecodeError): | |||
| 101 | + | fail() | |||
| 102 | + | ||||
| 103 | + | print("\t".join((version, match.group(1), revision))) | |||
| 104 | + | PY | |||
| 105 | + | } | |||
| 36 | 106 | ||||
| 37 | # The artifact destination is caller-controlled. Never empty or recursively | 107 | # The artifact destination is caller-controlled. Never empty or recursively | ||
| 38 | # clear it: collection only writes to a newly-created directory whose parent is | 108 | # clear it: collection only writes to a newly-created directory whose parent is | ||
| @@ -66,10 +136,9 @@ prepare_output | |||||
| 66 | [[ -x "$binary" ]] || { echo "first-presentation: executable not found: $binary" >&2; exit 2; } | 136 | [[ -x "$binary" ]] || { echo "first-presentation: executable not found: $binary" >&2; exit 2; } | ||
| 67 | [[ -d "$runtime" ]] || { echo "first-presentation: CEF runtime not found: $runtime" >&2; exit 2; } | 137 | [[ -d "$runtime" ]] || { echo "first-presentation: CEF runtime not found: $runtime" >&2; exit 2; } | ||
| 68 | [[ -n "${WAYLAND_DISPLAY:-}${DISPLAY:-}" ]] || { echo "first-presentation: a current Wayland/X11 display is required" >&2; exit 2; } | 138 | [[ -n "${WAYLAND_DISPLAY:-}${DISPLAY:-}" ]] || { echo "first-presentation: a current Wayland/X11 display is required" >&2; exit 2; } | ||
| 69 | - | [[ "$(go list -m -f '{{.Version}}' "$upstream_module")" == "$upstream_tag" ]] || { | 139 | + | upstream_provenance="$(resolve_upstream_provenance)" || exit $? |
| 70 | - | echo "first-presentation: expected $upstream_module@$upstream_tag" >&2 | 140 | + | IFS=$'\t' read -r upstream_version upstream_tag upstream_revision <<<"$upstream_provenance" |
| 71 | - | exit 2 | 141 | + | readonly upstream_version upstream_tag upstream_revision |
| 72 | - | } | |||
| 73 | 142 | ||||
| 74 | # Raw logs and temporary XDG homes may contain machine-local paths. Keep them | 143 | # Raw logs and temporary XDG homes may contain machine-local paths. Keep them | ||
| 75 | # outside the committed artifact directory and always remove them. | 144 | # outside the committed artifact directory and always remove them. | ||
| @@ -80,9 +149,9 @@ cleanup_work_root() { | |||||
| 80 | rm -rf -- "$work_root" | 149 | rm -rf -- "$work_root" | ||
| 81 | } | 150 | } | ||
| 82 | trap cleanup_work_root EXIT | 151 | trap cleanup_work_root EXIT | ||
| 83 | - | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_tag" "$upstream_revision" <<'PY' | 152 | + | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_version" "$upstream_tag" "$upstream_revision" <<'PY' |
| 84 | import hashlib, json, os, platform, subprocess, sys | 153 | import hashlib, json, os, platform, subprocess, sys | ||
| 85 | - | path, binary, timeout, upstream_module, upstream_tag, upstream_revision = sys.argv[1:] | 154 | + | path, binary, timeout, upstream_module, upstream_version, upstream_tag, upstream_revision = sys.argv[1:] |
| 86 | with open(binary, "rb") as candidate: | 155 | with open(binary, "rb") as candidate: | ||
| 87 | binary_sha256 = hashlib.file_digest(candidate, "sha256").hexdigest() | 156 | binary_sha256 = hashlib.file_digest(candidate, "sha256").hexdigest() | ||
| 88 | 157 | ||||
| @@ -102,7 +171,7 @@ json.dump({ | |||||
| 102 | "binary": {"label": "dumber", "sha256": binary_sha256}, | 171 | "binary": {"label": "dumber", "sha256": binary_sha256}, | ||
| 103 | "timeout_seconds": int(timeout), | 172 | "timeout_seconds": int(timeout), | ||
| 104 | "measured_source_revision": subprocess.check_output(["git", "-c", f"safe.directory={os.getcwd()}", "rev-parse", "HEAD"], text=True).strip(), | 173 | "measured_source_revision": subprocess.check_output(["git", "-c", f"safe.directory={os.getcwd()}", "rev-parse", "HEAD"], text=True).strip(), | ||
| 105 | - | "upstream": {"module": upstream_module, "tag": upstream_tag, "revision": upstream_revision}, | 174 | + | "upstream": {"module": upstream_module, "version": upstream_version, "tag": upstream_tag, "revision": upstream_revision}, |
| 106 | "comparison": {"os": os_label, "architecture": architecture, "display_protocol": display_protocol, "machine_gpu_profile": gpu_profile}, | 175 | "comparison": {"os": os_label, "architecture": architecture, "display_protocol": display_protocol, "machine_gpu_profile": gpu_profile}, | ||
| 107 | "render_configuration": {"backend": "gdk-dmabuf", "buffer_sharing": "dmabuf", "renderer": "vulkan"} | 176 | "render_configuration": {"backend": "gdk-dmabuf", "buffer_sharing": "dmabuf", "renderer": "vulkan"} | ||
| 108 | }, open(path, "w"), indent=2, sort_keys=True) | 177 | }, open(path, "w"), indent=2, sort_keys=True) | ||
M vendor/github.com/bnema/purego-cef/cef/bridge.go +8 -13 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/cefadapter/accelerated_paint.go +34 -37 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/dmabuf/frame.go +38 -19 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/gtkgdk/renderer.go +89 -69 generated file: collapsed
M vendor/github.com/bnema/purego-pipewire/internal/core/player.go +5 -0 generated file: collapsed
M vendor/github.com/bnema/purego-pipewire/internal/core/player_rt.go +10 -6 generated file: collapsed
M vendor/github.com/bnema/purego-pipewire/internal/core/pwbuffer.go +66 -32 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/driver/driver.go +268 -63 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/core/db.go +8 -0 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/core/rows.go +13 -0 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/loader/loader.go +23 -5 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/ports/in/ports_gen.go +3 -0 generated file: collapsed
M vendor/github.com/bnema/puregotk/internal/core/core.go +197 -4 generated file: collapsed
M vendor/github.com/bnema/puregotk/pkg/core/core.go +10 -0 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-about-dialog.go +99 -64 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-about-window.go +95 -62 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-accent-color.go +7 -15 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-action-row.go +33 -29
| @@ -119,6 +119,7 @@ type ActionRow struct { | |||
| 119 | 119 | var xActionRowGLibType func() types.GType | |
| 120 | 120 | ||
| 121 | 121 | func ActionRowGLibType() types.GType { | |
| 122 | + | core.LazyRegister(&xActionRowGLibType, "ADW", "adw_action_row_get_type", false) | |
| 122 | 123 | return xActionRowGLibType() | |
| 123 | 124 | } | |
| 124 | 125 | ||
| @@ -132,6 +133,7 @@ var xNewActionRow func() uintptr | |||
| 132 | 133 | ||
| 133 | 134 | // Creates a new `AdwActionRow`. | |
| 134 | 135 | func NewActionRow() *ActionRow { | |
| 136 | + | core.LazyRegister(&xNewActionRow, "ADW", "adw_action_row_new", false) | |
| 135 | 137 | var cls *ActionRow | |
| 136 | 138 | ||
| 137 | 139 | cret := xNewActionRow() | |
| @@ -149,6 +151,8 @@ var xActionRowActivate func(uintptr) | |||
| 149 | 151 | ||
| 150 | 152 | // Activates @self. | |
| 151 | 153 | func (x *ActionRow) Activate() { | |
| 154 | + | core.LazyRegister(&xActionRowActivate, "ADW", "adw_action_row_activate", false) | |
| 155 | + | ||
| 152 | 156 | xActionRowActivate(x.GoPointer()) | |
| 153 | 157 | } | |
| 154 | 158 | ||
| @@ -156,6 +160,8 @@ var xActionRowAddPrefix func(uintptr, uintptr) | |||
| 156 | 160 | ||
| 157 | 161 | // Adds a prefix widget to @self. | |
| 158 | 162 | func (x *ActionRow) AddPrefix(WidgetVar *gtk.Widget) { | |
| 163 | + | core.LazyRegister(&xActionRowAddPrefix, "ADW", "adw_action_row_add_prefix", false) | |
| 164 | + | ||
| 159 | 165 | xActionRowAddPrefix(x.GoPointer(), WidgetVar.GoPointer()) | |
| 160 | 166 | } | |
| 161 | 167 | ||
| @@ -163,6 +169,8 @@ var xActionRowAddSuffix func(uintptr, uintptr) | |||
| 163 | 169 | ||
| 164 | 170 | // Adds a suffix widget to @self. | |
| 165 | 171 | func (x *ActionRow) AddSuffix(WidgetVar *gtk.Widget) { | |
| 172 | + | core.LazyRegister(&xActionRowAddSuffix, "ADW", "adw_action_row_add_suffix", false) | |
| 173 | + | ||
| 166 | 174 | xActionRowAddSuffix(x.GoPointer(), WidgetVar.GoPointer()) | |
| 167 | 175 | } | |
| 168 | 176 | ||
| @@ -170,6 +178,7 @@ var xActionRowGetActivatableWidget func(uintptr) uintptr | |||
| 170 | 178 | ||
| 171 | 179 | // Gets the widget activated when @self is activated. | |
| 172 | 180 | func (x *ActionRow) GetActivatableWidget() *gtk.Widget { | |
| 181 | + | core.LazyRegister(&xActionRowGetActivatableWidget, "ADW", "adw_action_row_get_activatable_widget", false) | |
| 173 | 182 | var cls *gtk.Widget | |
| 174 | 183 | ||
| 175 | 184 | cret := xActionRowGetActivatableWidget(x.GoPointer()) | |
| @@ -187,6 +196,8 @@ var xActionRowGetIconName func(uintptr) string | |||
| 187 | 196 | ||
| 188 | 197 | // Gets the icon name for @self. | |
| 189 | 198 | func (x *ActionRow) GetIconName() string { | |
| 199 | + | core.LazyRegister(&xActionRowGetIconName, "ADW", "adw_action_row_get_icon_name", false) | |
| 200 | + | ||
| 190 | 201 | cret := xActionRowGetIconName(x.GoPointer()) | |
| 191 | 202 | return cret | |
| 192 | 203 | } | |
| @@ -195,6 +206,8 @@ var xActionRowGetSubtitle func(uintptr) string | |||
| 195 | 206 | ||
| 196 | 207 | // Gets the subtitle for @self. | |
| 197 | 208 | func (x *ActionRow) GetSubtitle() string { | |
| 209 | + | core.LazyRegister(&xActionRowGetSubtitle, "ADW", "adw_action_row_get_subtitle", false) | |
| 210 | + | ||
| 198 | 211 | cret := xActionRowGetSubtitle(x.GoPointer()) | |
| 199 | 212 | return cret | |
| 200 | 213 | } | |
| @@ -204,6 +217,8 @@ var xActionRowGetSubtitleLines func(uintptr) int | |||
| 204 | 217 | // Gets the number of lines at the end of which the subtitle label will be | |
| 205 | 218 | // ellipsized. | |
| 206 | 219 | func (x *ActionRow) GetSubtitleLines() int { | |
| 220 | + | core.LazyRegister(&xActionRowGetSubtitleLines, "ADW", "adw_action_row_get_subtitle_lines", false) | |
| 221 | + | ||
| 207 | 222 | cret := xActionRowGetSubtitleLines(x.GoPointer()) | |
| 208 | 223 | return cret | |
| 209 | 224 | } | |
| @@ -212,6 +227,8 @@ var xActionRowGetSubtitleSelectable func(uintptr) bool | |||
| 212 | 227 | ||
| 213 | 228 | // Gets whether the user can copy the subtitle from the label | |
| 214 | 229 | func (x *ActionRow) GetSubtitleSelectable() bool { | |
| 230 | + | core.LazyRegister(&xActionRowGetSubtitleSelectable, "ADW", "adw_action_row_get_subtitle_selectable", false) | |
| 231 | + | ||
| 215 | 232 | cret := xActionRowGetSubtitleSelectable(x.GoPointer()) | |
| 216 | 233 | return cret | |
| 217 | 234 | } | |
| @@ -221,6 +238,8 @@ var xActionRowGetTitleLines func(uintptr) int | |||
| 221 | 238 | // Gets the number of lines at the end of which the title label will be | |
| 222 | 239 | // ellipsized. | |
| 223 | 240 | func (x *ActionRow) GetTitleLines() int { | |
| 241 | + | core.LazyRegister(&xActionRowGetTitleLines, "ADW", "adw_action_row_get_title_lines", false) | |
| 242 | + | ||
| 224 | 243 | cret := xActionRowGetTitleLines(x.GoPointer()) | |
| 225 | 244 | return cret | |
| 226 | 245 | } | |
| @@ -229,6 +248,8 @@ var xActionRowRemove func(uintptr, uintptr) | |||
| 229 | 248 | ||
| 230 | 249 | // Removes a child from @self. | |
| 231 | 250 | func (x *ActionRow) Remove(WidgetVar *gtk.Widget) { | |
| 251 | + | core.LazyRegister(&xActionRowRemove, "ADW", "adw_action_row_remove", false) | |
| 252 | + | ||
| 232 | 253 | xActionRowRemove(x.GoPointer(), WidgetVar.GoPointer()) | |
| 233 | 254 | } | |
| 234 | 255 | ||
| @@ -243,6 +264,8 @@ var xActionRowSetActivatableWidget func(uintptr, uintptr) | |||
| 243 | 264 | // The target widget will be activated by emitting the | |
| 244 | 265 | // [signal@Gtk.Widget::mnemonic-activate] signal on it. | |
| 245 | 266 | func (x *ActionRow) SetActivatableWidget(WidgetVar *gtk.Widget) { | |
| 267 | + | core.LazyRegister(&xActionRowSetActivatableWidget, "ADW", "adw_action_row_set_activatable_widget", false) | |
| 268 | + | ||
| 246 | 269 | xActionRowSetActivatableWidget(x.GoPointer(), WidgetVar.GoPointer()) | |
| 247 | 270 | } | |
| 248 | 271 | ||
| @@ -250,6 +273,8 @@ var xActionRowSetIconName func(uintptr, uintptr) | |||
| 250 | 273 | ||
| 251 | 274 | // Sets the icon name for @self. | |
| 252 | 275 | func (x *ActionRow) SetIconName(IconNameVar *string) { | |
| 276 | + | core.LazyRegister(&xActionRowSetIconName, "ADW", "adw_action_row_set_icon_name", false) | |
| 277 | + | ||
| 253 | 278 | IconNameVarPtr := core.GStrdupNullable(IconNameVar) | |
| 254 | 279 | defer core.GFreeNullable(IconNameVarPtr) | |
| 255 | 280 | ||
| @@ -263,6 +288,8 @@ var xActionRowSetSubtitle func(uintptr, string) | |||
| 263 | 288 | // The subtitle is interpreted as Pango markup unless | |
| 264 | 289 | // [property@PreferencesRow:use-markup] is set to `FALSE`. | |
| 265 | 290 | func (x *ActionRow) SetSubtitle(SubtitleVar string) { | |
| 291 | + | core.LazyRegister(&xActionRowSetSubtitle, "ADW", "adw_action_row_set_subtitle", false) | |
| 292 | + | ||
| 266 | 293 | xActionRowSetSubtitle(x.GoPointer(), SubtitleVar) | |
| 267 | 294 | } | |
| 268 | 295 | ||
| @@ -273,6 +300,8 @@ var xActionRowSetSubtitleLines func(uintptr, int) | |||
| 273 | 300 | // | |
| 274 | 301 | // If the value is 0, the number of lines won't be limited. | |
| 275 | 302 | func (x *ActionRow) SetSubtitleLines(SubtitleLinesVar int) { | |
| 303 | + | core.LazyRegister(&xActionRowSetSubtitleLines, "ADW", "adw_action_row_set_subtitle_lines", false) | |
| 304 | + | ||
| 276 | 305 | xActionRowSetSubtitleLines(x.GoPointer(), SubtitleLinesVar) | |
| 277 | 306 | } | |
| 278 | 307 | ||
| @@ -282,6 +311,8 @@ var xActionRowSetSubtitleSelectable func(uintptr, bool) | |||
| 282 | 311 | // | |
| 283 | 312 | // See also [property@Gtk.Label:selectable]. | |
| 284 | 313 | func (x *ActionRow) SetSubtitleSelectable(SubtitleSelectableVar bool) { | |
| 314 | + | core.LazyRegister(&xActionRowSetSubtitleSelectable, "ADW", "adw_action_row_set_subtitle_selectable", false) | |
| 315 | + | ||
| 285 | 316 | xActionRowSetSubtitleSelectable(x.GoPointer(), SubtitleSelectableVar) | |
| 286 | 317 | } | |
| 287 | 318 | ||
| @@ -292,6 +323,8 @@ var xActionRowSetTitleLines func(uintptr, int) | |||
| 292 | 323 | // | |
| 293 | 324 | // If the value is 0, the number of lines won't be limited. | |
| 294 | 325 | func (x *ActionRow) SetTitleLines(TitleLinesVar int) { | |
| 326 | + | core.LazyRegister(&xActionRowSetTitleLines, "ADW", "adw_action_row_set_title_lines", false) | |
| 327 | + | ||
| 295 | 328 | xActionRowSetTitleLines(x.GoPointer(), TitleLinesVar) | |
| 296 | 329 | } | |
| 297 | 330 | ||
| @@ -776,33 +809,4 @@ func (x *ActionRow) GetBuildableId() string { | |||
| 776 | 809 | func init() { | |
| 777 | 810 | core.SetPackageName("ADW", "libadwaita-1") | |
| 778 | 811 | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0", "libadwaita-1.0.dylib"}) | |
| 779 | - | var libs []uintptr | |
| 780 | - | for _, libPath := range core.GetPaths("ADW") { | |
| 781 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 782 | - | if err != nil { | |
| 783 | - | panic(err) | |
| 784 | - | } | |
| 785 | - | libs = append(libs, lib) | |
| 786 | - | } | |
| 787 | - | ||
| 788 | - | core.PuregoSafeRegister(&xActionRowGLibType, libs, "adw_action_row_get_type") | |
| 789 | - | ||
| 790 | - | core.PuregoSafeRegister(&xNewActionRow, libs, "adw_action_row_new") | |
| 791 | - | ||
| 792 | - | core.PuregoSafeRegister(&xActionRowActivate, libs, "adw_action_row_activate") | |
| 793 | - | core.PuregoSafeRegister(&xActionRowAddPrefix, libs, "adw_action_row_add_prefix") | |
| 794 | - | core.PuregoSafeRegister(&xActionRowAddSuffix, libs, "adw_action_row_add_suffix") | |
| 795 | - | core.PuregoSafeRegister(&xActionRowGetActivatableWidget, libs, "adw_action_row_get_activatable_widget") | |
| 796 | - | core.PuregoSafeRegister(&xActionRowGetIconName, libs, "adw_action_row_get_icon_name") | |
| 797 | - | core.PuregoSafeRegister(&xActionRowGetSubtitle, libs, "adw_action_row_get_subtitle") | |
| 798 | - | core.PuregoSafeRegister(&xActionRowGetSubtitleLines, libs, "adw_action_row_get_subtitle_lines") | |
| 799 | - | core.PuregoSafeRegister(&xActionRowGetSubtitleSelectable, libs, "adw_action_row_get_subtitle_selectable") | |
| 800 | - | core.PuregoSafeRegister(&xActionRowGetTitleLines, libs, "adw_action_row_get_title_lines") | |
| 801 | - | core.PuregoSafeRegister(&xActionRowRemove, libs, "adw_action_row_remove") | |
| 802 | - | core.PuregoSafeRegister(&xActionRowSetActivatableWidget, libs, "adw_action_row_set_activatable_widget") | |
| 803 | - | core.PuregoSafeRegister(&xActionRowSetIconName, libs, "adw_action_row_set_icon_name") | |
| 804 | - | core.PuregoSafeRegister(&xActionRowSetSubtitle, libs, "adw_action_row_set_subtitle") | |
| 805 | - | core.PuregoSafeRegister(&xActionRowSetSubtitleLines, libs, "adw_action_row_set_subtitle_lines") | |
| 806 | - | core.PuregoSafeRegister(&xActionRowSetSubtitleSelectable, libs, "adw_action_row_set_subtitle_selectable") | |
| 807 | - | core.PuregoSafeRegister(&xActionRowSetTitleLines, libs, "adw_action_row_set_title_lines") | |
| 808 | 812 | } | |
| @@ -119,6 +119,7 @@ type ActionRow struct { | |||||
| 119 | var xActionRowGLibType func() types.GType | 119 | var xActionRowGLibType func() types.GType | ||
| 120 | 120 | ||||
| 121 | func ActionRowGLibType() types.GType { | 121 | func ActionRowGLibType() types.GType { | ||
| 122 | + | core.LazyRegister(&xActionRowGLibType, "ADW", "adw_action_row_get_type", false) | |||
| 122 | return xActionRowGLibType() | 123 | return xActionRowGLibType() | ||
| 123 | } | 124 | } | ||
| 124 | 125 | ||||
| @@ -132,6 +133,7 @@ var xNewActionRow func() uintptr | |||||
| 132 | 133 | ||||
| 133 | // Creates a new `AdwActionRow`. | 134 | // Creates a new `AdwActionRow`. | ||
| 134 | func NewActionRow() *ActionRow { | 135 | func NewActionRow() *ActionRow { | ||
| 136 | + | core.LazyRegister(&xNewActionRow, "ADW", "adw_action_row_new", false) | |||
| 135 | var cls *ActionRow | 137 | var cls *ActionRow | ||
| 136 | 138 | ||||
| 137 | cret := xNewActionRow() | 139 | cret := xNewActionRow() | ||
| @@ -149,6 +151,8 @@ var xActionRowActivate func(uintptr) | |||||
| 149 | 151 | ||||
| 150 | // Activates @self. | 152 | // Activates @self. | ||
| 151 | func (x *ActionRow) Activate() { | 153 | func (x *ActionRow) Activate() { | ||
| 154 | + | core.LazyRegister(&xActionRowActivate, "ADW", "adw_action_row_activate", false) | |||
| 155 | + | ||||
| 152 | xActionRowActivate(x.GoPointer()) | 156 | xActionRowActivate(x.GoPointer()) | ||
| 153 | } | 157 | } | ||
| 154 | 158 | ||||
| @@ -156,6 +160,8 @@ var xActionRowAddPrefix func(uintptr, uintptr) | |||||
| 156 | 160 | ||||
| 157 | // Adds a prefix widget to @self. | 161 | // Adds a prefix widget to @self. | ||
| 158 | func (x *ActionRow) AddPrefix(WidgetVar *gtk.Widget) { | 162 | func (x *ActionRow) AddPrefix(WidgetVar *gtk.Widget) { | ||
| 163 | + | core.LazyRegister(&xActionRowAddPrefix, "ADW", "adw_action_row_add_prefix", false) | |||
| 164 | + | ||||
| 159 | xActionRowAddPrefix(x.GoPointer(), WidgetVar.GoPointer()) | 165 | xActionRowAddPrefix(x.GoPointer(), WidgetVar.GoPointer()) | ||
| 160 | } | 166 | } | ||
| 161 | 167 | ||||
| @@ -163,6 +169,8 @@ var xActionRowAddSuffix func(uintptr, uintptr) | |||||
| 163 | 169 | ||||
| 164 | // Adds a suffix widget to @self. | 170 | // Adds a suffix widget to @self. | ||
| 165 | func (x *ActionRow) AddSuffix(WidgetVar *gtk.Widget) { | 171 | func (x *ActionRow) AddSuffix(WidgetVar *gtk.Widget) { | ||
| 172 | + | core.LazyRegister(&xActionRowAddSuffix, "ADW", "adw_action_row_add_suffix", false) | |||
| 173 | + | ||||
| 166 | xActionRowAddSuffix(x.GoPointer(), WidgetVar.GoPointer()) | 174 | xActionRowAddSuffix(x.GoPointer(), WidgetVar.GoPointer()) | ||
| 167 | } | 175 | } | ||
| 168 | 176 | ||||
| @@ -170,6 +178,7 @@ var xActionRowGetActivatableWidget func(uintptr) uintptr | |||||
| 170 | 178 | ||||
| 171 | // Gets the widget activated when @self is activated. | 179 | // Gets the widget activated when @self is activated. | ||
| 172 | func (x *ActionRow) GetActivatableWidget() *gtk.Widget { | 180 | func (x *ActionRow) GetActivatableWidget() *gtk.Widget { | ||
| 181 | + | core.LazyRegister(&xActionRowGetActivatableWidget, "ADW", "adw_action_row_get_activatable_widget", false) | |||
| 173 | var cls *gtk.Widget | 182 | var cls *gtk.Widget | ||
| 174 | 183 | ||||
| 175 | cret := xActionRowGetActivatableWidget(x.GoPointer()) | 184 | cret := xActionRowGetActivatableWidget(x.GoPointer()) | ||
| @@ -187,6 +196,8 @@ var xActionRowGetIconName func(uintptr) string | |||||
| 187 | 196 | ||||
| 188 | // Gets the icon name for @self. | 197 | // Gets the icon name for @self. | ||
| 189 | func (x *ActionRow) GetIconName() string { | 198 | func (x *ActionRow) GetIconName() string { | ||
| 199 | + | core.LazyRegister(&xActionRowGetIconName, "ADW", "adw_action_row_get_icon_name", false) | |||
| 200 | + | ||||
| 190 | cret := xActionRowGetIconName(x.GoPointer()) | 201 | cret := xActionRowGetIconName(x.GoPointer()) | ||
| 191 | return cret | 202 | return cret | ||
| 192 | } | 203 | } | ||
| @@ -195,6 +206,8 @@ var xActionRowGetSubtitle func(uintptr) string | |||||
| 195 | 206 | ||||
| 196 | // Gets the subtitle for @self. | 207 | // Gets the subtitle for @self. | ||
| 197 | func (x *ActionRow) GetSubtitle() string { | 208 | func (x *ActionRow) GetSubtitle() string { | ||
| 209 | + | core.LazyRegister(&xActionRowGetSubtitle, "ADW", "adw_action_row_get_subtitle", false) | |||
| 210 | + | ||||
| 198 | cret := xActionRowGetSubtitle(x.GoPointer()) | 211 | cret := xActionRowGetSubtitle(x.GoPointer()) | ||
| 199 | return cret | 212 | return cret | ||
| 200 | } | 213 | } | ||
| @@ -204,6 +217,8 @@ var xActionRowGetSubtitleLines func(uintptr) int | |||||
| 204 | // Gets the number of lines at the end of which the subtitle label will be | 217 | // Gets the number of lines at the end of which the subtitle label will be | ||
| 205 | // ellipsized. | 218 | // ellipsized. | ||
| 206 | func (x *ActionRow) GetSubtitleLines() int { | 219 | func (x *ActionRow) GetSubtitleLines() int { | ||
| 220 | + | core.LazyRegister(&xActionRowGetSubtitleLines, "ADW", "adw_action_row_get_subtitle_lines", false) | |||
| 221 | + | ||||
| 207 | cret := xActionRowGetSubtitleLines(x.GoPointer()) | 222 | cret := xActionRowGetSubtitleLines(x.GoPointer()) | ||
| 208 | return cret | 223 | return cret | ||
| 209 | } | 224 | } | ||
| @@ -212,6 +227,8 @@ var xActionRowGetSubtitleSelectable func(uintptr) bool | |||||
| 212 | 227 | ||||
| 213 | // Gets whether the user can copy the subtitle from the label | 228 | // Gets whether the user can copy the subtitle from the label | ||
| 214 | func (x *ActionRow) GetSubtitleSelectable() bool { | 229 | func (x *ActionRow) GetSubtitleSelectable() bool { | ||
| 230 | + | core.LazyRegister(&xActionRowGetSubtitleSelectable, "ADW", "adw_action_row_get_subtitle_selectable", false) | |||
| 231 | + | ||||
| 215 | cret := xActionRowGetSubtitleSelectable(x.GoPointer()) | 232 | cret := xActionRowGetSubtitleSelectable(x.GoPointer()) | ||
| 216 | return cret | 233 | return cret | ||
| 217 | } | 234 | } | ||
| @@ -221,6 +238,8 @@ var xActionRowGetTitleLines func(uintptr) int | |||||
| 221 | // Gets the number of lines at the end of which the title label will be | 238 | // Gets the number of lines at the end of which the title label will be | ||
| 222 | // ellipsized. | 239 | // ellipsized. | ||
| 223 | func (x *ActionRow) GetTitleLines() int { | 240 | func (x *ActionRow) GetTitleLines() int { | ||
| 241 | + | core.LazyRegister(&xActionRowGetTitleLines, "ADW", "adw_action_row_get_title_lines", false) | |||
| 242 | + | ||||
| 224 | cret := xActionRowGetTitleLines(x.GoPointer()) | 243 | cret := xActionRowGetTitleLines(x.GoPointer()) | ||
| 225 | return cret | 244 | return cret | ||
| 226 | } | 245 | } | ||
| @@ -229,6 +248,8 @@ var xActionRowRemove func(uintptr, uintptr) | |||||
| 229 | 248 | ||||
| 230 | // Removes a child from @self. | 249 | // Removes a child from @self. | ||
| 231 | func (x *ActionRow) Remove(WidgetVar *gtk.Widget) { | 250 | func (x *ActionRow) Remove(WidgetVar *gtk.Widget) { | ||
| 251 | + | core.LazyRegister(&xActionRowRemove, "ADW", "adw_action_row_remove", false) | |||
| 252 | + | ||||
| 232 | xActionRowRemove(x.GoPointer(), WidgetVar.GoPointer()) | 253 | xActionRowRemove(x.GoPointer(), WidgetVar.GoPointer()) | ||
| 233 | } | 254 | } | ||
| 234 | 255 | ||||
| @@ -243,6 +264,8 @@ var xActionRowSetActivatableWidget func(uintptr, uintptr) | |||||
| 243 | // The target widget will be activated by emitting the | 264 | // The target widget will be activated by emitting the | ||
| 244 | // [signal@Gtk.Widget::mnemonic-activate] signal on it. | 265 | // [signal@Gtk.Widget::mnemonic-activate] signal on it. | ||
| 245 | func (x *ActionRow) SetActivatableWidget(WidgetVar *gtk.Widget) { | 266 | func (x *ActionRow) SetActivatableWidget(WidgetVar *gtk.Widget) { | ||
| 267 | + | core.LazyRegister(&xActionRowSetActivatableWidget, "ADW", "adw_action_row_set_activatable_widget", false) | |||
| 268 | + | ||||
| 246 | xActionRowSetActivatableWidget(x.GoPointer(), WidgetVar.GoPointer()) | 269 | xActionRowSetActivatableWidget(x.GoPointer(), WidgetVar.GoPointer()) | ||
| 247 | } | 270 | } | ||
| 248 | 271 | ||||
| @@ -250,6 +273,8 @@ var xActionRowSetIconName func(uintptr, uintptr) | |||||
| 250 | 273 | ||||
| 251 | // Sets the icon name for @self. | 274 | // Sets the icon name for @self. | ||
| 252 | func (x *ActionRow) SetIconName(IconNameVar *string) { | 275 | func (x *ActionRow) SetIconName(IconNameVar *string) { | ||
| 276 | + | core.LazyRegister(&xActionRowSetIconName, "ADW", "adw_action_row_set_icon_name", false) | |||
| 277 | + | ||||
| 253 | IconNameVarPtr := core.GStrdupNullable(IconNameVar) | 278 | IconNameVarPtr := core.GStrdupNullable(IconNameVar) | ||
| 254 | defer core.GFreeNullable(IconNameVarPtr) | 279 | defer core.GFreeNullable(IconNameVarPtr) | ||
| 255 | 280 | ||||
| @@ -263,6 +288,8 @@ var xActionRowSetSubtitle func(uintptr, string) | |||||
| 263 | // The subtitle is interpreted as Pango markup unless | 288 | // The subtitle is interpreted as Pango markup unless | ||
| 264 | // [property@PreferencesRow:use-markup] is set to `FALSE`. | 289 | // [property@PreferencesRow:use-markup] is set to `FALSE`. | ||
| 265 | func (x *ActionRow) SetSubtitle(SubtitleVar string) { | 290 | func (x *ActionRow) SetSubtitle(SubtitleVar string) { | ||
| 291 | + | core.LazyRegister(&xActionRowSetSubtitle, "ADW", "adw_action_row_set_subtitle", false) | |||
| 292 | + | ||||
| 266 | xActionRowSetSubtitle(x.GoPointer(), SubtitleVar) | 293 | xActionRowSetSubtitle(x.GoPointer(), SubtitleVar) | ||
| 267 | } | 294 | } | ||
| 268 | 295 | ||||
| @@ -273,6 +300,8 @@ var xActionRowSetSubtitleLines func(uintptr, int) | |||||
| 273 | // | 300 | // | ||
| 274 | // If the value is 0, the number of lines won't be limited. | 301 | // If the value is 0, the number of lines won't be limited. | ||
| 275 | func (x *ActionRow) SetSubtitleLines(SubtitleLinesVar int) { | 302 | func (x *ActionRow) SetSubtitleLines(SubtitleLinesVar int) { | ||
| 303 | + | core.LazyRegister(&xActionRowSetSubtitleLines, "ADW", "adw_action_row_set_subtitle_lines", false) | |||
| 304 | + | ||||
| 276 | xActionRowSetSubtitleLines(x.GoPointer(), SubtitleLinesVar) | 305 | xActionRowSetSubtitleLines(x.GoPointer(), SubtitleLinesVar) | ||
| 277 | } | 306 | } | ||
| 278 | 307 | ||||
| @@ -282,6 +311,8 @@ var xActionRowSetSubtitleSelectable func(uintptr, bool) | |||||
| 282 | // | 311 | // | ||
| 283 | // See also [property@Gtk.Label:selectable]. | 312 | // See also [property@Gtk.Label:selectable]. | ||
| 284 | func (x *ActionRow) SetSubtitleSelectable(SubtitleSelectableVar bool) { | 313 | func (x *ActionRow) SetSubtitleSelectable(SubtitleSelectableVar bool) { | ||
| 314 | + | core.LazyRegister(&xActionRowSetSubtitleSelectable, "ADW", "adw_action_row_set_subtitle_selectable", false) | |||
| 315 | + | ||||
| 285 | xActionRowSetSubtitleSelectable(x.GoPointer(), SubtitleSelectableVar) | 316 | xActionRowSetSubtitleSelectable(x.GoPointer(), SubtitleSelectableVar) | ||
| 286 | } | 317 | } | ||
| 287 | 318 | ||||
| @@ -292,6 +323,8 @@ var xActionRowSetTitleLines func(uintptr, int) | |||||
| 292 | // | 323 | // | ||
| 293 | // If the value is 0, the number of lines won't be limited. | 324 | // If the value is 0, the number of lines won't be limited. | ||
| 294 | func (x *ActionRow) SetTitleLines(TitleLinesVar int) { | 325 | func (x *ActionRow) SetTitleLines(TitleLinesVar int) { | ||
| 326 | + | core.LazyRegister(&xActionRowSetTitleLines, "ADW", "adw_action_row_set_title_lines", false) | |||
| 327 | + | ||||
| 295 | xActionRowSetTitleLines(x.GoPointer(), TitleLinesVar) | 328 | xActionRowSetTitleLines(x.GoPointer(), TitleLinesVar) | ||
| 296 | } | 329 | } | ||
| 297 | 330 | ||||
| @@ -776,33 +809,4 @@ func (x *ActionRow) GetBuildableId() string { | |||||
| 776 | func init() { | 809 | func init() { | ||
| 777 | core.SetPackageName("ADW", "libadwaita-1") | 810 | core.SetPackageName("ADW", "libadwaita-1") | ||
| 778 | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0", "libadwaita-1.0.dylib"}) | 811 | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0", "libadwaita-1.0.dylib"}) | ||
| 779 | - | var libs []uintptr | |||
| 780 | - | for _, libPath := range core.GetPaths("ADW") { | |||
| 781 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |||
| 782 | - | if err != nil { | |||
| 783 | - | panic(err) | |||
| 784 | - | } | |||
| 785 | - | libs = append(libs, lib) | |||
| 786 | - | } | |||
| 787 | - | ||||
| 788 | - | core.PuregoSafeRegister(&xActionRowGLibType, libs, "adw_action_row_get_type") | |||
| 789 | - | ||||
| 790 | - | core.PuregoSafeRegister(&xNewActionRow, libs, "adw_action_row_new") | |||
| 791 | - | ||||
| 792 | - | core.PuregoSafeRegister(&xActionRowActivate, libs, "adw_action_row_activate") | |||
| 793 | - | core.PuregoSafeRegister(&xActionRowAddPrefix, libs, "adw_action_row_add_prefix") | |||
| 794 | - | core.PuregoSafeRegister(&xActionRowAddSuffix, libs, "adw_action_row_add_suffix") | |||
| 795 | - | core.PuregoSafeRegister(&xActionRowGetActivatableWidget, libs, "adw_action_row_get_activatable_widget") | |||
| 796 | - | core.PuregoSafeRegister(&xActionRowGetIconName, libs, "adw_action_row_get_icon_name") | |||
| 797 | - | core.PuregoSafeRegister(&xActionRowGetSubtitle, libs, "adw_action_row_get_subtitle") | |||
| 798 | - | core.PuregoSafeRegister(&xActionRowGetSubtitleLines, libs, "adw_action_row_get_subtitle_lines") | |||
| 799 | - | core.PuregoSafeRegister(&xActionRowGetSubtitleSelectable, libs, "adw_action_row_get_subtitle_selectable") | |||
| 800 | - | core.PuregoSafeRegister(&xActionRowGetTitleLines, libs, "adw_action_row_get_title_lines") | |||
| 801 | - | core.PuregoSafeRegister(&xActionRowRemove, libs, "adw_action_row_remove") | |||
| 802 | - | core.PuregoSafeRegister(&xActionRowSetActivatableWidget, libs, "adw_action_row_set_activatable_widget") | |||
| 803 | - | core.PuregoSafeRegister(&xActionRowSetIconName, libs, "adw_action_row_set_icon_name") | |||
| 804 | - | core.PuregoSafeRegister(&xActionRowSetSubtitle, libs, "adw_action_row_set_subtitle") | |||
| 805 | - | core.PuregoSafeRegister(&xActionRowSetSubtitleLines, libs, "adw_action_row_set_subtitle_lines") | |||
| 806 | - | core.PuregoSafeRegister(&xActionRowSetSubtitleSelectable, libs, "adw_action_row_set_subtitle_selectable") | |||
| 807 | - | core.PuregoSafeRegister(&xActionRowSetTitleLines, libs, "adw_action_row_set_title_lines") | |||
| 808 | } | 812 | } | ||