Problem with sed in spec file

Richard W.M. Jones rjones at
Wed Aug 21 15:03:23 UTC 2013

On Wed, Aug 21, 2013 at 12:49:04PM +0100, Paul Howarth wrote:
> On 21/08/13 12:21, Juan Orti Alcaine wrote:
> >Hello, I'm adding a SELinux module to the gogoc package, as seen in this
> >draft [1], and I've received a error about the dependecies. In my spec
> >file I use this to extract the selinux-policy version and use it as a
> >dependency:
> >
> >%global selinux_policyver %(%{__sed} -e
> >'s,.*selinux-policy-\\([^/]*\\)/.*,\\1,'
> >/usr/share/selinux/devel/policyhelp || echo 0.0.0)
> This was an attempt to grok the selinux-policy version number
> without querying the rpm database (which you can't reliably do
> during a package build). Unfortunately there is no upstream version
> number for the policy so the one used in Fedora is just made up.
> More unfortunately, the one place I was reliably able to find it (in
> the policyhelp file) no longer has it. In fact I can't find it
> anywhere in any of the selinux-policy-{devel,doc} files in F-20. So
> there's no way I can see of expressing the necessary dependency
> version in any sort of automated way.

Just open a bug against selinux-policy and ask the maintainer
to drop a file somewhere which contains the version number, eg:

  echo '%{version}' > $RPM_BUILD_ROOT%{_datadir}/selinux/version

We do something similar in the OCaml compiler base package.


Richard Jones, Virtualization Group, Red Hat
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.

More information about the devel mailing list