Bug 3786

Summary: RPM packaging fails for pkgconfig files with '-' in version field
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Phlip Balister <philip>
Component: coreAssignee: Alexander Kanavin <alex.kanavin>
Status: RESOLVED OBSOLETE QA Contact:
Severity: minor    
Priority: Low CC: mark.hatle, meta.mr.watcher, meta.watcher, n3npq, richard.purdie, sgw
Version: unspecified   
Target Milestone: 2.4 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Phlip Balister 2013-01-23 21:31:43 UTC
When building uhd (from meta-oe) AND enabling rpm packaging the rpm creation fails with an odd error:

.52.0 libstdc++.so.6(GLIBCXX_3.4) libc.so.6 libc.so.6(GLIBC_2.4) libc.so.6(GLIBC_2.9) libc.so.6(GLIBC_2.7) libc.so.6(GLIBC_2.8) libgcc_s.so.1(GCC_4.0.0) libtinfo.so.5 libncurses.so.5
| Processing files: uhd-dbg-3.5.0-r3.0.armv7a_vfp_neon
| Finding  Provides: /home/balister/src/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/uhd/1_3.5.0-r3.0/uhd.provides
| Finding  Requires: /home/balister/src/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/uhd/1_3.5.0-r3.0/uhd.requires
| Processing files: uhd-dev-3.5.0-r3.0.armv7a_vfp_neon
| Finding  Provides: /home/balister/src/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/uhd/1_3.5.0-r3.0/uhd.provides
| error: line 719: Illegal char '-' in EVR:
| 
| error: Failed to find Provides:
| 
| 
| RPM build errors:
|     line 719: Illegal char '-' in EVR:
| 
|     Failed to find Provides:
| DEBUG: Python function do_package_rpm finished


The recipe does find with opkg.

Mark Hatle looked at the uhd rpm files and suggested this:

do_install_append() {
    rm -f ${D}/usr/lib/pkgconfig/uhd.pc
}

This "solves" the problem, but something is not right. Mark asked me to create this bug.

This should be reproducible with just oe-core + meta-oe.
Comment 1 Mark Hatle 2013-01-23 22:02:03 UTC
I have successfully reproduced the problem.  Reproducer:

download oe-core/bitbake
download meta-openembedded

configure a new build
edit conf/bblayers.conf -- add meta-openembedded/meta-oe

bitbake ncurses
bitbake uhd

(uhd has a minor bug in it's dependencies, it requires ncurses but does not yet state it.)

Result of the above matches Philip's comments.
Comment 2 Mark Hatle 2013-01-23 22:20:34 UTC
Contents of packages-split/uhd-dev/usr/lib/pkgconfig/uhd.pc:


prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: UHD
Description: Ettus Research - USRP Hardware Driver
URL: http://code.ettus.com/redmine/ettus/projects/uhd/wiki
Version: 003.005.000-0-g5cb9779d
Requires:
Requires.private: 
Conflicts:
Cflags: -I${includedir} 
Libs: -L${libdir} -luhd
Libs.private: 


---

This causes the pkgconfig dependency code to pull out a dep on "Version" 003.005.000-0-g5cb9779d of the "pkgconfig(uhd)".  RPM is assuming the versioning should be handled by standard rules, which are "version-release", where "-" is not supported in either version or release.  Thus three '-' means it can't figure out which is version and which is release, thus the error is generated.

Still don't have a solution, but I can explain the fault at least.
Comment 3 Jeff Johnson 2013-01-24 19:59:09 UTC
Probably the most general/simplest fix would
be to add
    ... | tr -- - _
(or equivalent) to the script that extracts the version
from the *.pc file.

The file that needs changing is pkgconfigdeps.sh,
the version is being extracted by these 2 lines

$pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
...
$pkgconfig --print-requires "$filename" 2> /dev/null | while read n r v ; do

and you would need to split out the EVR field and change
all '-' dash characters to '_' underscore characters in the EVR field.
Comment 4 Phlip Balister 2013-01-24 20:05:30 UTC
I received this in the email also:


--- host/cmake/Modules/UHDVersion.cmake	2013-01-24 16:11:20.956506736 +0100
+++ host.b/cmake/Modules/UHDVersion.cmake	2013-01-24 17:11:22.966407775 +0100
@@ -69,7 +69,7 @@ ENDIF()
 
 ########################################################################
 IF(UHD_RELEASE_MODE STREQUAL "release")
-    SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_HASH}")
+    SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}+${UHD_GIT_HASH}")
 ELSE()
-    SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}")
+    SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}+${UHD_GIT_COUNT}+${UHD_GIT_HASH}")
 ENDIF()


This patches uhd to avoid the problem. I'll discuss with the UHD maintainer.
Comment 5 Jeff Johnson 2013-01-24 20:07:58 UTC
Actually all the splitting is done: just wrap
a back ticked sed/tr onto the $v field in the
two places that look like
    echo "pkgconfig($n) $r $v"
Comment 6 Jeff Johnson 2013-01-24 20:09:03 UTC
Yes changing the Version: string also Just Works
(but doesn't solve the problem generally and is
out-of-scope as an RPM "fix")
Comment 7 Mark Hatle 2013-02-22 20:01:26 UTC
The original problem was resolved by a change to UHD.  The underlying issue still needs to be resolved via a patch to the pkgconfig scanning code in rpmdeps.
Comment 8 Mark Hatle 2013-04-30 23:19:27 UTC
We will work on this for the 1.5 release.  The workaround should be good enough for 1.4, and the issue is fairly rare.
Comment 9 Mark Hatle 2013-07-16 18:01:55 UTC
Not deployment, bug in RPM integration.
Comment 10 Mark Hatle 2014-04-01 14:49:17 UTC
We've had no more reports of this.. but it should be fixed.  Moving it forward to 1.7.
Comment 11 Richard Purdie 2017-07-20 15:27:40 UTC
Alex: Could you check if we have this issue with rpmdeps in rpm v4 please?
Comment 12 Alexander Kanavin 2017-07-24 15:12:58 UTC
I have baked a version with two dashes into sqlite3.pc.in file, and rpm4 had no problem with that (maybe it doesn't look into .pc files at all anymore?). I'd say RESOLVED/OBSOLETE.