yauto: Handle PKG_CHECK_MODULES that define multiple modules (#5075)

**Summary**

The PKG_CHECK_MODULES macro in configure.ac files can define more than
one module (see
[here](https://autotools.info/pkgconfig/pkg_check_modules.html)).
Previously all the entries were simply added into the same
`pkgconfig()`.
This properly separates them into their own entries and also accepts
"<=" and "=" comparators (though these aren't used for anything except
detecting version definitions)

Also fix adding dependencies for combined configure.ac/Python projects

Old behaviour:
```
 go-task new -- gammastep https://gitlab.com/chinstrap/gammastep/-/archive/v2.0.9/gammastep-v2.0.9.tar.bz2
[...]
 yq '.builddeps' packages/g/gammastep/package.yml
- pkgconfig(libdrm)
- pkgconfig(x11)
- pkgconfig(xxf86vm)
- pkgconfig(xcb)
- pkgconfig(xcb-randr)
- pkgconfig(wayland-client wayland-scanner)
- pkgconfig(glib-2.0 gobject-2.0)
- pkgconfig(glib-2.0 gio-2.0)
```

New behaviour:
```
 go-task new -- gammastep https://gitlab.com/chinstrap/gammastep/-/archive/v2.0.9/gammastep-v2.0.9.tar.bz2
[...]
 yq '.builddeps' packages/g/gammastep/package.yml 
- pkgconfig(libdrm)
- pkgconfig(x11)
- pkgconfig(xxf86vm)
- pkgconfig(xcb)
- pkgconfig(xcb-randr)
- pkgconfig(wayland-client)
- pkgconfig(wayland-scanner)
- pkgconfig(glib-2.0)
- pkgconfig(gobject-2.0)
- pkgconfig(gio-2.0)
```


**Test Plan**

- `go-task new -- gammastep
https://gitlab.com/chinstrap/gammastep/-/archive/v2.0.9/gammastep-v2.0.9.tar.bz2`
produces correct build dependencies
- `go-task new -- rapidyml
https://github.com/biojppm/rapidyaml/archive/refs/tags/v0.7.2.tar.gz`
still works correctly
- `go-task new -- pip-tools
1ef453f10f/pip-tools-7.4.1.tar.gz`
still works correctly

**Checklist**

- [x] Package was built and tested against unstable
- [ ] This change could gainfully be listed in the weekly sync notes
once merged <!-- Write an appropriate message in the Summary section,
then add the "Topic: Sync Notes" label -->
This commit is contained in:
Evan Maddock 2025-02-19 14:56:50 -05:00 committed by GitHub
commit c57a20549c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,20 +262,27 @@ class AutoPackage:
splits = line.split(",")
part = splits[1] if len(splits) > 1 else splits[0]
part = part.replace("[", "").replace(")", "").replace("]", "")
splits = part.split(">=")
pkg = splits[0].strip()
dep = DepObject()
dep.name = pkg
if len(splits) > 1:
version = splits[1].strip()
# Can happen, we don't handle variable expansion.
if "$" in version:
splits = part.strip().split(" ")
version_info = None
for entry in splits:
if entry in ["=", "<=", ">="]:
version_info = True
continue
dep.version = version
# Check it hasn't been added
objs = [x for x in deps if x.name == dep.name]
if len(objs) == 0:
deps.append(dep)
if version_info:
# Can happen, we don't handle variable expansion.
version_info = False
if "$" in entry:
continue
deps[-1].version = entry
continue
if "$" in entry:
continue
dep = DepObject()
dep.name = entry
# Check it hasn't been added
objs = [x for x in deps if x.name == dep.name]
if len(objs) == 0:
deps.append(dep)
return deps
@ -326,16 +333,14 @@ description: |
total_str += "\nbuilddeps :\n"
if self.build_deps is not None and len(self.build_deps) > 0:
if self.compile_type == PYTHON_MODULES or self.component == "programming.python":
for dep in self.build_deps:
if len(dep.name.strip()) == 0:
continue
for dep in self.build_deps:
if len(dep.name.strip()) == 0:
continue
if dep.name in ["python-build", "python-installer",
"python-packaging", "python-wheel"]:
total_str += " - %s\n" % dep.name
else:
for dep in self.build_deps:
if len(dep.name.strip()) == 0:
continue
total_str += " - pkgconfig(%s)\n" % dep.name
continue
total_str += " - pkgconfig(%s)\n" % dep.name
if self.compile_type == GNOMEY:
setup = "%configure --disable-static"
elif self.compile_type == CMAKE: