Skip to contentSkip to conversation

package_ipk.bbclass fails due to a wrong version of a package

PATCH In review Denys Dmytriyenko 3 participants 10 messages Apr 2, 2009 – Apr 8, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I've been debugging this issue for a while now w/o much success.

We have following recipes in play:
curl_7.19.0.bb
curl-native_7.18.2.bb
curl-sdk_7.18.2.bb

None of those set PV explicitly, so they are picked up from the filename.

Now, let's run this:

$ bitbake curl curl-sdk

And here is the error message:
NOTE: package curl-sdk-7.18.2-r0: task do_package_write_ipk: started
ERROR: Error, lockfile path does not exist!: /oe/tmp/work/i686-armv5te-sdk-none-linux-gnueabi/curl-7.19.0-r1/install
ERROR: Error in executing: /oe/openembedded/recipes/curl/curl-sdk_7.18.2.bb
ERROR: Exception:<type 'exceptions.SystemExit'> Message:1
ERROR: Printing the environment of the function
ERROR: Error in executing: /oe/openembedded/recipes/curl/curl-sdk_7.18.2.bb
ERROR: Exception:<type 'exceptions.SystemExit'> Message:1
ERROR: Printing the environment of the function
ERROR: Build of /oe/openembedded/recipes/curl/curl-sdk_7.18.2.bb do_package_write_ipk failed
ERROR: Task 867 (/oe/openembedded/recipes/curl/curl-sdk_7.18.2.bb, do_package_write_ipk) failed

The message comes from package_ipk.bbclass, line 161, bb.utils.lockfile():

packages = bb.data.getVar('PACKAGES', d, True) for pkg in packages.split():
localdata = bb.data.createCopy(d) pkgdest = bb.data.getVar('PKGDEST', d, 1) root = "%s/%s" % (pkgdest, pkg)

lf = bb.utils.lockfile(root + ".lock")

For some reason it evaluates curl-sdk PV as 7.19.0 in there.

curl-sdk builds fine on its own, it only fails when it's built after the target one. I guess workaround would be to match the version numbers of target, native and sdk recipes...

Any ideas? Thanks in advance.

Signature · 1 line
Denys
#1 lore raw
Quoted 10 lines · Denys Dmytriyenko

Hi,

I've been debugging this issue for a while now w/o much success.

We have following recipes in play:
curl_7.19.0.bb
curl-native_7.18.2.bb
curl-sdk_7.18.2.bb

None of those set PV explicitly, so they are picked up from the filename.

Hmm, if you throw in a -v -DDD and log all the output, do you see both curl_7.18.2.bb being loaded (for -sdk) and curl_7.19.0.bb (for target) being loaded up?

Signature · 1 line
Tom Rini
#2 lore raw
Quoted 11 lines · Tom Rini
Quoted 9 lines · Denys Dmytriyenko

Hi,

I've been debugging this issue for a while now w/o much success.

We have following recipes in play:
curl_7.19.0.bb
curl-native_7.18.2.bb
curl-sdk_7.18.2.bb

Quoted 5 lines
Quoted 1 line

None of those set PV explicitly, so they are picked up from the filename.

Hmm, if you throw in a -v -DDD and log all the output, do you see both curl_7.18.2.bb being loaded (for -sdk) and curl_7.19.0.bb (for target) being loaded up?

Nope. While trying to build curl-sdk_7.18.2.bb there is no mentioning of 7.19.0 (grepped the output) until the do_package_write_ipk, where it tried to create a lock file, as I mentioned above:

NOTE: package curl-sdk-7.18.2-r0: task do_package_write_ipk: started
DEBUG: mkdirhier(/oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-sdk-7.18.2-r0/image)
DEBUG: mkdirhier(/oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-7.19.0-r1/image)
ERROR: Error, lockfile path does not exist!: /oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-7.19.0-r1/install

The second mkdirhier() is where it fails and it is called from lockfile(), which gets called from do_package_ipk()...

BTW, this was a i686-generic build, thus i686-i686-sdk path...

Signature · 1 line
Denys
#3 lore raw
Quoted 27 lines · Denys Dmytriyenko
Quoted 11 lines · Tom Rini
Quoted 9 lines · Denys Dmytriyenko

Hi,

I've been debugging this issue for a while now w/o much success.

We have following recipes in play:
curl_7.19.0.bb
curl-native_7.18.2.bb
curl-sdk_7.18.2.bb

Quoted 5 lines
Quoted 1 line

None of those set PV explicitly, so they are picked up from the filename.

Hmm, if you throw in a -v -DDD and log all the output, do you see both curl_7.18.2.bb being loaded (for -sdk) and curl_7.19.0.bb (for target) being loaded up?

Nope. While trying to build curl-sdk_7.18.2.bb there is no mentioning of 7.19.0 (grepped the output) until the do_package_write_ipk, where it tried to create a lock file, as I mentioned above:

NOTE: package curl-sdk-7.18.2-r0: task do_package_write_ipk: started
DEBUG: mkdirhier(/oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-sdk-7.18.2-r0/image)
DEBUG: mkdirhier(/oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-7.19.0-r1/image)
ERROR: Error, lockfile path does not exist!: /oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-7.19.0-r1/install

Quoted 4 lines

The second mkdirhier() is where it fails and it is called from lockfile(), which gets called from do_package_ipk()...

BTW, this was a i686-generic build, thus i686-i686-sdk path...

FYI, I figured it out few days ago, but had some personal matters to resolve first. I'll be sending a detailed explanation and a patch soon.

Signature · 1 line
Denys
#4 lore raw
Quoted 26 lines · Denys Dmytriyenko
Quoted 25 lines · Denys Dmytriyenko
Quoted 9 lines · Tom Rini
Quoted 7 lines · Denys Dmytriyenko

I've been debugging this issue for a while now w/o much success.

We have following recipes in play:
curl_7.19.0.bb
curl-native_7.18.2.bb
curl-sdk_7.18.2.bb

Quoted 5 lines
Quoted 1 line

None of those set PV explicitly, so they are picked up from the filename.

Hmm, if you throw in a -v -DDD and log all the output, do you see both curl_7.18.2.bb being loaded (for -sdk) and curl_7.19.0.bb (for target) being loaded up?

Nope. While trying to build curl-sdk_7.18.2.bb there is no mentioning of 7.19.0 (grepped the output) until the do_package_write_ipk, where it tried to create a lock file, as I mentioned above:

NOTE: package curl-sdk-7.18.2-r0: task do_package_write_ipk: started
DEBUG: mkdirhier(/oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-sdk-7.18.2-r0/image)
DEBUG: mkdirhier(/oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-7.19.0-r1/image)
ERROR: Error, lockfile path does not exist!: /oe/tmp/work/i686-i686-sdk-angstrom-linux/curl-7.19.0-r1/install

Quoted 7 lines
Quoted 4 lines

The second mkdirhier() is where it fails and it is called from lockfile(), which gets called from do_package_ipk()...

BTW, this was a i686-generic build, thus i686-i686-sdk path...

FYI, I figured it out few days ago, but had some personal matters to resolve first. I'll be sending a detailed explanation and a patch soon.

Ok, the problem comes from the 1af5030de05a1e65d1de734f7675ffc22c8318fc commit taken from Poky, which seems legitimate, as it "fixes" the generation of pkgdata/runtime files by adding extra fields, such as PN, PV and PR. It was commited as part of RPM packaging.

Unfortunately, that unmasks some issues, namely the one with curl/curl-sdk...

All curl recipes use a single .inc file, which expands the PACKAGES variable with libcurl name (i.e. "curl curl-dev curl-dbg libcurl libcurl-dev...").

Now when curl target is packaged, it generates a pkgdata file with version 7.19.0-r1 in it under arch dir. Next, when curl-sdk is being packaged its PACKAGES variable is "curl-sdk curl-sdk-dev curl-sdk-dbg libcurl libcurl-dev...". So when do_package_write_ipk() calls read_subpackage_metadata(), it looks for pkgdata of libcurl and finds it in arch dir first, extracting the wrong version numbers, hence lockfile() trying to access the wrong directory. Here is the code:

def get_subpkgedata_fn(pkg, d):

    import bb, os
    archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ")
    archs.reverse()
    pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d)
    targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d)
    for arch in archs:
        fn = pkgdata + arch + targetdir + pkg
        if os.path.exists(fn):
            return fn
    return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d)

Now, the above code works in Poky, because Poky has the same version numbers for curl, curl-native and curl-sdk.

Maybe there is way to fix this issue in the core classes, but I don't believe libcurl should be in curl-sdk PACKAGES anyway. I have it fixed this way and I'll be sending the patch to the list shortly. Plus, curl-sdk is only needed for do_stage() and has empty do_install() anyway.

The above commit from Poky may unmask some other similar issues, not related to curl - for example the one Otavio reported recently. It can be easily verified if it is the rootcause:

$ git revert -n 1af5030de05a1e65d1de734f7675ffc22c8318fc

If there are multiple pkgdata files with the same name, but different contents, the above quoted get_subpkgedata_fn() function may pick the wrong one. The question is - is it even valid to have something like this:

${TMPDIR}/pkgdata/armv5te-none-linux-gnueabi/runtime/foo ${TMPDIR}/pkgdata/i686-armv5te-sdk-none-linux-gnueabi/runtime/foo

Signature · 1 line
Denys
#5 lore raw

PATCH 1/1 curl: move PACKAGES and FILES_* from the .inc file

---
 recipes/curl/curl-native_7.18.2.bb |    4 ++--
 recipes/curl/curl-sdk_7.18.2.bb    |    4 ++--
 recipes/curl/curl.inc              |   23 -----------------------
 recipes/curl/curl_7.18.2.bb        |   24 ++++++++++++++++++++++++
 recipes/curl/curl_7.19.0.bb        |   24 +++++++++++++++++++++++-
 5 files changed, 51 insertions(+), 28 deletions(-)
recipes/curl/curl-native_7.18.2.bb +2 -2
index f0e2b89..72f9420 100644
@@ -1,6 +1,7 @@
-require curl_${PV}.bb
+require curl.inc
 inherit native
 DEPENDS = "zlib-native"
+PR = "r1"
 
 do_stage () {
 	autotools_stage_all
@@ -9,4 +10,3 @@ do_stage () {
 do_install() {
 	:
 }
-
recipes/curl/curl-sdk_7.18.2.bb +2 -2
index 816fe64..02dd02a 100644
@@ -1,6 +1,7 @@
-require curl_${PV}.bb
+require curl.inc
 inherit sdk
 DEPENDS = "zlib-sdk"
+PR = "r1"
 
 do_stage () {
         install -d ${STAGING_INCDIR}/curl
@@ -11,4 +12,3 @@ do_stage () {
 do_install() {
 	:
 }
-
recipes/curl/curl.inc +0 -23
index d3edaef..ce4f5f2 100644
@@ -55,26 +55,3 @@ do_stage () {
 	install -m 0644 ${S}/include/curl/*.h ${STAGING_INCDIR}/curl/
 	oe_libinstall -so -a -C lib libcurl ${STAGING_LIBDIR}
 }
-
-PACKAGES += "${PN}-certs libcurl libcurl-dev libcurl-doc"
-
-FILES_${PN} = "${bindir}/curl"
-
-FILES_${PN}-certs = "${datadir}/curl/curl-*"
-PACKAGE_ARCH_${PN}-certs = "all"
-
-FILES_${PN}-doc = "${mandir}/man1/curl.1"
-
-FILES_lib${PN} = "${libdir}/lib*.so.*"
-RRECOMMENDS_lib${PN} += "${PN}-certs"
-FILES_lib${PN}-dev = "${includedir} \
-                      ${libdir}/lib*.so \
-                      ${libdir}/lib*.a \
-                      ${libdir}/lib*.la \
-                      ${libdir}/pkgconfig \
-                      ${datadir}/aclocal \
-                      ${bindir}/*-config"
-
-FILES_lib${PN}-doc = "${mandir}/man3 \
-                      ${mandir}/man1/curl-config.1"
-
recipes/curl/curl_7.18.2.bb +24 -0
index 2c3ec41..657699c 100644
@@ -1,2 +1,26 @@
 require curl.inc
 
+PR = "r1"
+
+PACKAGES += "${PN}-certs libcurl libcurl-dev libcurl-doc"
+
+FILES_${PN} = "${bindir}/curl"
+
+FILES_${PN}-certs = "${datadir}/curl/curl-*"
+PACKAGE_ARCH_${PN}-certs = "all"
+
+FILES_${PN}-doc = "${mandir}/man1/curl.1"
+
+FILES_lib${PN} = "${libdir}/lib*.so.*"
+RRECOMMENDS_lib${PN} += "${PN}-certs"
+FILES_lib${PN}-dev = "${includedir} \
+                      ${libdir}/lib*.so \
+                      ${libdir}/lib*.a \
+                      ${libdir}/lib*.la \
+                      ${libdir}/pkgconfig \
+                      ${datadir}/aclocal \
+                      ${bindir}/*-config"
+
+FILES_lib${PN}-doc = "${mandir}/man3 \
+                      ${mandir}/man1/curl-config.1"
+
recipes/curl/curl_7.19.0.bb +23 -1
index a99a68b..7f57275 100644
@@ -1,5 +1,27 @@
 require curl.inc
 
 SRC_URI += "file://off_t_abi_fix.patch;patch=1;pnum=0"
-PR = "r1"
+PR = "r2"
+
+PACKAGES += "${PN}-certs libcurl libcurl-dev libcurl-doc"
+
+FILES_${PN} = "${bindir}/curl"
+
+FILES_${PN}-certs = "${datadir}/curl/curl-*"
+PACKAGE_ARCH_${PN}-certs = "all"
+
+FILES_${PN}-doc = "${mandir}/man1/curl.1"
+
+FILES_lib${PN} = "${libdir}/lib*.so.*"
+RRECOMMENDS_lib${PN} += "${PN}-certs"
+FILES_lib${PN}-dev = "${includedir} \
+                      ${libdir}/lib*.so \
+                      ${libdir}/lib*.a \
+                      ${libdir}/lib*.la \
+                      ${libdir}/pkgconfig \
+                      ${datadir}/aclocal \
+                      ${bindir}/*-config"
+
+FILES_lib${PN}-doc = "${mandir}/man3 \
+                      ${mandir}/man1/curl-config.1"
 
Signature · 1 line
1.6.0.6
#6 lore raw

Re: [PATCH] curl: move PACKAGES and FILES_* from the .inc file

Quoted 8 lines · Denys Dmytriyenko
---
 recipes/curl/curl-native_7.18.2.bb |    4 ++--
 recipes/curl/curl-sdk_7.18.2.bb    |    4 ++--
 recipes/curl/curl.inc              |   23 -----------------------
 recipes/curl/curl_7.18.2.bb        |   24 ++++++++++++++++++++++++
 recipes/curl/curl_7.19.0.bb        |   24 +++++++++++++++++++++++-
 5 files changed, 51 insertions(+), 28 deletions(-)

I wonder if we should follow the gcc model here and anywhere else this is now broken and have curl-target.inc and curl-commmon.inc or so, so we aren't copying the target stuff twice (or more).

Signature · 1 line
Tom Rini
#7 lore raw

PATCH 1/1 curl: move PACKAGES and FILES_* from the .inc file

this resolves the lockfile() trying to access the wrong directory when building sdk version after target one was built

---
 recipes/curl/{curl.inc => curl-common.inc} |   23 -----------------------
 recipes/curl/curl-native_7.18.2.bb         |    4 ++--
 recipes/curl/curl-sdk_7.18.2.bb            |    4 ++--
 recipes/curl/curl-target.inc               |   22 ++++++++++++++++++++++
 recipes/curl/curl_7.18.2.bb                |    4 +++-
 recipes/curl/curl_7.19.0.bb                |    6 +++---
 6 files changed, 32 insertions(+), 31 deletions(-)
 rename recipes/curl/{curl.inc => curl-common.inc} (73%)
 create mode 100644 recipes/curl/curl-target.inc
recipes/curl/curl-common.inc renamed from recipes/curl/curl.inc +0 -23
similarity index 73%
rename from recipes/curl/curl.inc
rename to recipes/curl/curl-common.inc
index d3edaef..ce4f5f2 100644
@@ -55,26 +55,3 @@ do_stage () {
 	install -m 0644 ${S}/include/curl/*.h ${STAGING_INCDIR}/curl/
 	oe_libinstall -so -a -C lib libcurl ${STAGING_LIBDIR}
 }
-
-PACKAGES += "${PN}-certs libcurl libcurl-dev libcurl-doc"
-
-FILES_${PN} = "${bindir}/curl"
-
-FILES_${PN}-certs = "${datadir}/curl/curl-*"
-PACKAGE_ARCH_${PN}-certs = "all"
-
-FILES_${PN}-doc = "${mandir}/man1/curl.1"
-
-FILES_lib${PN} = "${libdir}/lib*.so.*"
-RRECOMMENDS_lib${PN} += "${PN}-certs"
-FILES_lib${PN}-dev = "${includedir} \
-                      ${libdir}/lib*.so \
-                      ${libdir}/lib*.a \
-                      ${libdir}/lib*.la \
-                      ${libdir}/pkgconfig \
-                      ${datadir}/aclocal \
-                      ${bindir}/*-config"
-
-FILES_lib${PN}-doc = "${mandir}/man3 \
-                      ${mandir}/man1/curl-config.1"
-
recipes/curl/curl-native_7.18.2.bb +2 -2
index f0e2b89..c95591b 100644
@@ -1,6 +1,7 @@
-require curl_${PV}.bb
+require curl-common.inc
 inherit native
 DEPENDS = "zlib-native"
+PR = "r1"
 
 do_stage () {
 	autotools_stage_all
@@ -9,4 +10,3 @@ do_stage () {
 do_install() {
 	:
 }
-
recipes/curl/curl-sdk_7.18.2.bb +2 -2
index 816fe64..35b0d88 100644
@@ -1,6 +1,7 @@
-require curl_${PV}.bb
+require curl-common.inc
 inherit sdk
 DEPENDS = "zlib-sdk"
+PR = "r1"
 
 do_stage () {
         install -d ${STAGING_INCDIR}/curl
@@ -11,4 +12,3 @@ do_stage () {
 do_install() {
 	:
 }
-
recipes/curl/curl-target.inc new file +22 -0
new file mode 100644
index 0000000..88877e5
@@ -0,0 +1,22 @@
+PACKAGES += "${PN}-certs libcurl libcurl-dev libcurl-doc"
+
+FILES_${PN} = "${bindir}/curl"
+
+FILES_${PN}-certs = "${datadir}/curl/curl-*"
+PACKAGE_ARCH_${PN}-certs = "all"
+
+FILES_${PN}-doc = "${mandir}/man1/curl.1"
+
+FILES_lib${PN} = "${libdir}/lib*.so.*"
+RRECOMMENDS_lib${PN} += "${PN}-certs"
+FILES_lib${PN}-dev = "${includedir} \
+                      ${libdir}/lib*.so \
+                      ${libdir}/lib*.a \
+                      ${libdir}/lib*.la \
+                      ${libdir}/pkgconfig \
+                      ${datadir}/aclocal \
+                      ${bindir}/*-config"
+
+FILES_lib${PN}-doc = "${mandir}/man3 \
+                      ${mandir}/man1/curl-config.1"
+
recipes/curl/curl_7.18.2.bb +3 -1
index 2c3ec41..3de6da4 100644
@@ -1,2 +1,4 @@
-require curl.inc
+require curl-common.inc
+require curl-target.inc
 
+PR = "r1"
recipes/curl/curl_7.19.0.bb +3 -3
index a99a68b..1944efe 100644
@@ -1,5 +1,5 @@
-require curl.inc
+require curl-common.inc
+require curl-target.inc
 
 SRC_URI += "file://off_t_abi_fix.patch;patch=1;pnum=0"
-PR = "r1"
-
+PR = "r2"
Signature · 1 line
1.6.0.6
#9 lore raw
In reply to Denys Dmytriyenko

Denys Dmytriyenko <[email protected]> writes:

[...]

Quoted 4 lines

Ok, the problem comes from the 1af5030de05a1e65d1de734f7675ffc22c8318fc commit taken from Poky, which seems legitimate, as it "fixes" the generation of pkgdata/runtime files by adding extra fields, such as PN, PV and PR. It was commited as part of RPM packaging.

[...]

Quoted 5 lines

The above commit from Poky may unmask some other similar issues, not related to curl - for example the one Otavio reported recently. It can be easily verified if it is the rootcause:

$ git revert -n 1af5030de05a1e65d1de734f7675ffc22c8318fc

[...]

I can confirm that it solves my issues here too; please revert it in dev and stable.

Signature · 3 lines
Otavio Salvador                  O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br