Cyril Brulebois <cyril@debamax.com> (2020-12-26): > In hindsight, it would be even better to ignore all entries with E-S-O: > yes, and we wouldn't have to special-case this specific transition. For > the records, E-S-O: yes is a flag that's used to keep source packages in > the archive for license compliance reasons, usually because packages are > listed in Built-Using. See below for an excerpt of unstable's Sources, > focusing on packages that advertise golang.org/x/text in their > Go-Import-Path. This mail went out a little too fast: I had forgotten dh-make-golang doesn't actually work with Sources files directly, but uses an API endpoint on ftp-master. Since it seems to be very generic [1], instead of something dedicated to Go-Import-Path, I don't think we can really hope for a change in the ftp-master API (the function takes a single parameter at the moment). Maybe dh-make-golang could or should leverage a Sources file to be more precise when determining the (Build-)Depends? 1. https://salsa.debian.org/ftp-team/dak/-/blob/master/dakweb/queries/binary.py#L38-74 Another approach would be to at least warn when getGolangBinaries overrides an existing value in the mapping: func getGolangBinaries() (map[string]string, error) { golangBinaries := make(map[string]string) resp, err := http.Get(golangBinariesURL) if err != nil { return nil, fmt.Errorf("getting %q: %v", golangBinariesURL, err) } if got, want := resp.StatusCode, http.StatusOK; got != want { return nil, fmt.Errorf("unexpected HTTP status code: got %d, want %d", got, want) } var pkgs []struct { Binary string `json:"binary"` XSGoImportPath string `json:"metadata_value"` Source string `json:"source"` } if err := json.NewDecoder(resp.Body).Decode(&pkgs); err != nil { return nil, err } for _, pkg := range pkgs { if !strings.HasSuffix(pkg.Binary, "-dev") { continue // skip -dbgsym packages etc. } for _, importPath := range strings.Split(pkg.XSGoImportPath, ",") { // XS-Go-Import-Path can be comma-separated and contain spaces. =====> golangBinaries[strings.TrimSpace(importPath)] = pkg.Binary } } return golangBinaries, nil I think the code pointed by the arrow is where we can lose existing information, meaning the last binary declaring a given Go-Import-Path wins, and all others are dropped silently. If we had a list instead of a single value, we could at least use something “packageA | packageB” but then we probably would have to deduplicate. Currently, the file returned from https://api.ftp-master.debian.org/binary/by_metadata/Go-Import-Path has: { "binary": "golang-golang-x-text-dev", "source": "golang-golang-x-text", "metadata_value": "golang.org/x/text" }, { "binary": "golang-golang-x-text-dev", "source": "golang-x-text", "metadata_value": "golang.org/x/text" }, … { "binary": "golang-x-text-dev", "source": "golang-x-text", "metadata_value": "golang.org/x/text" }, In the end, maybe having some kind of hardcoded list of overrides would be the easiest to implement, and yield the best return on investment… ;) Cheers, -- Cyril Brulebois -- Debian Consultant @ DEBAMAX -- https://debamax.com/
Attachment:
signature.asc
Description: PGP signature