On Sat, Oct 30, 2021 at 4:52 PM Björn 'besser82' Esser <besser82@xxxxxxxxxxxxxxxxx> wrote: > > Am Samstag, dem 30.10.2021 um 22:00 +0200 schrieb Alexander Ploumistos: > > Hello, > > > > I'm wondering if there's an "elegant" and "rpm" way to do the > > following, without calling an external tool (and maybe adding another > > dependency to a package): > > > > Project "foo" tracks the development of project "bar" and both use > > basic semantic versioning, X.Y.Z. Project "bar" rarely increments the > > patch version and only for internal development purposes. Regular > > releases always carry a patch version of 0, e.g. 16.5.0. Project "foo" > > follows the same major and minor versions as "bar", but they also > > publish releases with incremented patch versions. Any given foo > > release should be built against a bar release with the same major and > > minor versions. Does rpm provide a way to require that part of the > > version string, e.g. for foo-16.5.4: > > Requires: bar >= 16.5 > > without hard coding the actual values? > > > This should solve your problem as described: > > ``` > # These lines go *after* the package version has been set. > # Name: foo > # Version: X.Y.Z > # … > %global ver_major %(echo %{version} | cut -d. -f1) # X > %global ver_minor %(echo %{version} | cut -d. -f2) # Y > %global ver_minor_next %(echo $((%{ver_minor}+1))) # Y+1 > > # BuildRequires with versioning > BuildRequires: bar-devel >= %{ver_major}.%{ver_minor} # X.Y > BuildRequires: bar-devel < %{ver_major}.%{ver_minor_next} # X.(Y+1) > > # Archful runtime Requires with versioning > Requires: bar%{?_isa} >= %{ver_major}.%{ver_minor} > Requires: bar%{?_isa} < %{ver_major}.%{ver_minor_next} > > # Archless runtime Requires with versioning, if bar is noarch. > Requires: bar >= %{ver_major}.%{ver_minor} > Requires: bar < %{ver_major}.%{ver_minor_next} > ``` There's a slightly better way to do this now: # BuildRequires with versioning > BuildRequires: (bar-devel >= %{ver_major}.%{ver_minor} with bar-devel < %{ver_major}.%{ver_minor_next}) # Archful runtime Requires with versioning > Requires: (bar%{?_isa} >= %{ver_major}.%{ver_minor} with bar%{?_isa} < %{ver_major}.%{ver_minor_next}) # Archless runtime Requires with versioning (for noarch stuff) > Requires: (bar >= %{ver_major}.%{ver_minor} with bar < %{ver_major}.%{ver_minor_next}) These variants are better because they enforce that one and only one package satisfies the dependency, which can avoid weird satisfiability issues. -- 真実はいつも一つ!/ Always, there's only one truth! _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure