Re: Building rpms in mock

Zenon Panoussis <[email protected]>
Newsgroups gmane.mail.imap.courier.general
Message-ID <[email protected]>
> I don't have any immediate plans to add more configure options, 
> but still I don't like how this approach ends up duplicating the 
> list of options in the spec file...

I agree. I already called it "messy" and "ugly". And you certainly
have a point in that

> rpm packages really are not meant to offer custom configuration 
> options, but to build a known package that's configured in a 
> known way, for a distribution. 

But even so, there are some other problems.

> A courier-authlib-config-%{mailuser}-%{mailgroup} empty subpackage. 
> So, it'll be courier-authlib-config-daemon-daemon for me, and 
> courier-authlib-config-courier-courier for you. [...]  Both 
> courier-authlib, and all other packages will get a dependency on 
> this subpackage.
This narrows down the possible user:group names to courier and
daemon and it's good, though anyone currently running as something
else, e.g. mail:daemon, will be left out in the cold.

The main problem I'm facing is that neither authlib nor courier
can be built in mock because they expect the user:group to exist.
So I wonder, why is that check necessary? If a --define has
already told configure what user:group to use, why can't the
rpm just go ahead and build with that user:group even if they
do not exist on the build host? And conversely, if configure
has not been told what user:group to use, why can't the rpm
just go ahead and build with the default user:group? After all,
even if someone builds an rpm with mismatching user:group for
an upgrade of his existing installation, the authlib-config
metapackage will now prevent him from installing it.

As for the installation host, since the rpm knows what user:group
to use, it's a simple matter to check for them in a %pre and create
them if need be. BTW, contrary to what I did in my previous %pre,
useradd -d should be %{prefix} instead of /usr/lib/courier so it
gets correctly expanded if someone changes the preset prefix.

Another problem comes with the old-style system detections by
fedora-release, rocky-release etc. A simple %{?fedora} would
cover the former and a %{?rhel} would cover all el variants and
derivatives, including alma which I am using and the rpm now
identifies as non-fedora and non-rhel. (I don't know whether
centos-stream identifies itself as rhel, fedora, or something
else.)

Finally, on line 170 of the 1.3.5-1 courier.spec there is a
dangling "%if %is_rocky" that I don't understand. But at least
this can be done regarding fedora:

--- rpmbuild/SPECS/courier.spec 2023-12-26 10:53:07.000000000 +0000
+++ rpmbuild/SPECS/courier.spec 2023-12-26 10:58:36.931000000 +0000
@@ -146,11 +146,6 @@
  BuildRequires:   perl(ExtUtils::Embed)
  BuildRequires:   /etc/mime.types

-%define need_perl_generators %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "0"; exit 1)
-
-%if %need_perl_generators
-BuildRequires: perl-generators
-%endif

  %define use_openssl %(rpm -q openssl-devel >/dev/null 2>&1 && echo 1 && exit 0; echo 0)

@@ -178,10 +173,9 @@
  BuildRequires:      %{__make}
  Obsoletes:     courier-smtpauth < 1.3.5

-%define is_fedora %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "0"; exit 1)
-
-%if %is_fedora
+%if %{?fedora}
  BuildRequires: /usr/lib/locale/locale-archive
+BuildRequires: perl-generators
  %endif

  %if ! %alternatives

perl-generators are also needed by all rhel. I assume that
the same applies to /usr/lib/locale/locale-archive; up to
el7 this came from glibc-common and from el8 on it is part
of glibc-all-langpacks. If so, %if ( %{?fedora} || %{?rhel} )
would do the trick for both at the same time.

Cheers,

Z


-- 
Слава Україні!
Путин хуйло!


_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.