On Thu, Dec 22, 2022 at 01:31:17PM +1300, Daniel Swarbrick wrote: > Hi, > > I'm throwing this out to the team in hope of getting some help with a tricky > problem regarding two packages central to the Prometheus ecosystem. > > golang-github-prometheus-common and golang-github-prometheus-client-golang > have a circular dependency on each other. They have also both long depended > on golang-goprotobuf-dev (i.e., the v1.3.x branch of > github.com/golang/protobuf). > > Both prometheus-common and prometheus-client-golang require patching in > order to build against golang-goprotobuf-dev, since the upstream versions > require github.com/golang/protobuf 1.5.x. > > Now that golang-goprotobuf-dev is a transitional dummy package for > golang-github-golang-protobuf-1-3-dev, and > golang-github-golang-protobuf-1-5-dev is available in sid, these patches can > theoretically be dropped, and the dependencies updated. > > However... this is where the circular dependency bites. I'm unable to > modernize golang-github-prometheus-common to use protobuf-1-5-dev, since it > depends on golang-github-prometheus-client-golang, which still depends on > protobuf-1-3-dev, and results in a conflict. And vice versa. > > To make matters even trickier, client-golang also depends on > golang-github-prometheus-client-model-dev, which also depends on > protobuf-1-3-dev. >
I just checked what upstream does, they + use golang/protobuf/1.3 in https://github.com/prometheus/client_model/blob/v0.3.0/go.mod#L5 + use golang/protobuf/1.5 in other places. So we can assuem the generated pb.go (from client_model) by protoc-gen-go 1.3 can be used by golang/protobuf/1.5, and upstream has tested the combination. So I think we can follow upstream, which means: + still uses protoc-gen-go 1.3 to regenerate the client_model, ensure it only imports github.com/golang/protobuf. This is to make sure other packages that still depend on old protobuf won't break. + declare golang-github-prometheus-client-model-dev depends on golang-github-golang-protobuf-1-3-dev | golang-github-golang-protobuf-1-5-dev. + other prometheus packages can use golang-github-golang-protobuf-1-5-dev in build-depends. As a side node, please don't use golang-github-golang-protobuf-1-3-dev and golang-google-protobuf-dev together when building prometheus. They are not compatible.
