Skip to contentSkip to conversation

libevent: enable OpenSSL unconditionally and update packaging

PATCH In review André Draszik 3 participants 7 messages Nov 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libevent: enable OpenSSL unconditionally and update packaging

The original commit describes the reason for disabling openssl so as to get 'more deterministic build[s]' and size-reduction:
commit 6c36fde6ce2e ("libevent: disable openssl by default"), commit ad130b97a51a in poky.

Since the introduction of per-recipe sysroots, we always have deterministic builds.

Size reduction can be achieved by splitting the package into multiple sub-packages, which each only provide one of the shared libraries.

Hence there appears no reason anymore to disable OpenSSL support.

Because this recipe only provides shared libraries which are handled automatically by bitbake, there is no need to add the subpackages to the RDEPENDS of PN for backwards compatibility. The packageing process of dependees will simply pull in the sub-packages as runtime dependency as needed.

This also how Debian splits this up.

While updating the packaging, we can also drop event_rpcgen.py which appears to be a tool for generating rpc bindings, i.e. something that should normally be in -dev. Given Debian doesn't package this at all, and given it actually requires python to run but no runtime dependency is stated at the moment, it would appear that no users of this exist.

These changes also allow us to build all of nghttp2 out-of-the-box, without affecting existing users.

---
 meta/recipes-support/libevent/libevent_2.1.11.bb | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
meta/recipes-support/libevent/libevent_2.1.11.bb +9 -4
index f005ab8bda..c746f22118 100644
@@ -19,9 +19,6 @@ UPSTREAM_CHECK_URI = "http://libevent.org/"
 
 S = "${WORKDIR}/${BPN}-${PV}-stable"
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
-
 inherit autotools
 
 # Needed for Debian packaging
@@ -29,11 +26,19 @@ LEAD_SONAME = "libevent-2.1.so"
 
 inherit ptest multilib_header
 
-DEPENDS = "zlib"
+DEPENDS = "openssl zlib"
+
+PACKAGES =+ "${PN}-core ${PN}-extra ${PN}-openssl ${PN}-pthreads"
+FILES_${PN}-core = "${libdir}/libevent_core*${SOLIBS}"
+FILES_${PN}-extra = "${libdir}/libevent_extra*${SOLIBS}"
+FILES_${PN}-openssl = "${libdir}/libevent_openssl*${SOLIBS}"
+FILES_${PN}-pthreads = "${libdir}/libevent_pthreads-*${SOLIBS}"
 
 BBCLASSEXTEND = "native nativesdk"
 
 do_install_append() {
+	rm ${D}${bindir}/event_rpcgen.py
+	rmdir ${D}${bindir}
         oe_multilib_header event2/event-config.h
 }
 
Signature · 1 line
2.23.0.rc1
#1 lore raw

I would rather keep the option to disable openssl, but simply switch it on by default.

Alex

Quoted 84 lines · André Draszik

The original commit describes the reason for disabling openssl so as to get 'more deterministic build[s]' and size-reduction:
commit 6c36fde6ce2e ("libevent: disable openssl by default"), commit ad130b97a51a in poky.

Since the introduction of per-recipe sysroots, we always have deterministic builds.

Size reduction can be achieved by splitting the package into multiple sub-packages, which each only provide one of the shared libraries.

Hence there appears no reason anymore to disable OpenSSL support.

Because this recipe only provides shared libraries which are handled automatically by bitbake, there is no need to add the subpackages to the RDEPENDS of PN for backwards compatibility. The packageing process of dependees will simply pull in the sub-packages as runtime dependency as needed.

This also how Debian splits this up.

While updating the packaging, we can also drop event_rpcgen.py which appears to be a tool for generating rpc bindings, i.e. something that should normally be in -dev. Given Debian doesn't package this at all, and given it actually requires python to run but no runtime dependency is stated at the moment, it would appear that no users of this exist.

These changes also allow us to build all of nghttp2 out-of-the-box, without affecting existing users.

---
 meta/recipes-support/libevent/libevent_2.1.11.bb | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
meta/recipes-support/libevent/libevent_2.1.11.bb +9 -5
index f005ab8bda..c746f22118 100644
@@ -19,9 +19,6 @@ UPSTREAM_CHECK_URI = "http://libevent.org/"
 
 S = "${WORKDIR}/${BPN}-${PV}-stable"
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
-
 inherit autotools
 
 # Needed for Debian packaging
@@ -29,11 +26,19 @@ LEAD_SONAME = "libevent-2.1.so"
 
 inherit ptest multilib_header
 
-DEPENDS = "zlib"
+DEPENDS = "openssl zlib"
+
+PACKAGES =+ "${PN}-core ${PN}-extra ${PN}-openssl ${PN}-pthreads"
+FILES_${PN}-core = "${libdir}/libevent_core*${SOLIBS}"
+FILES_${PN}-extra = "${libdir}/libevent_extra*${SOLIBS}"
+FILES_${PN}-openssl = "${libdir}/libevent_openssl*${SOLIBS}"
+FILES_${PN}-pthreads = "${libdir}/libevent_pthreads-*${SOLIBS}"
 
 BBCLASSEXTEND = "native nativesdk"
 
 do_install_append() {
+       rm ${D}${bindir}/event_rpcgen.py
+       rmdir ${D}${bindir}
         oe_multilib_header event2/event-config.h
 }
 
--

2.23.0.rc1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 1 line · Alexander Kanavin

I would rather keep the option to disable openssl, but simply switch it on by default

Why complicate things, what's the use-case? If libevent_openssl.so is not used by anything, that library will not be pulled in, as it is a separate package now.

Cheers,
A.

Quoted 82 lines

.

Alex

Quoted 77 lines · André Draszik

The original commit describes the reason for disabling openssl so as to get 'more deterministic build[s]' and size-reduction:
commit 6c36fde6ce2e ("libevent: disable openssl by default"), commit ad130b97a51a in poky.

Since the introduction of per-recipe sysroots, we always have deterministic builds.

Size reduction can be achieved by splitting the package into multiple sub-packages, which each only provide one of the shared libraries.

Hence there appears no reason anymore to disable OpenSSL support.

Because this recipe only provides shared libraries which are handled automatically by bitbake, there is no need to add the subpackages to the RDEPENDS of PN for backwards compatibility. The packageing process of dependees will simply pull in the sub-packages as runtime dependency as needed.

This also how Debian splits this up.

While updating the packaging, we can also drop event_rpcgen.py which appears to be a tool for generating rpc bindings, i.e. something that should normally be in -dev. Given Debian doesn't package this at all, and given it actually requires python to run but no runtime dependency is stated at the moment, it would appear that no users of this exist.

These changes also allow us to build all of nghttp2 out-of-the-box, without affecting existing users.

---
 meta/recipes-support/libevent/libevent_2.1.11.bb | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
meta/recipes-support/libevent/libevent_2.1.11.bb +9 -4
index f005ab8bda..c746f22118 100644
@@ -19,9 +19,6 @@ UPSTREAM_CHECK_URI = "http://libevent.org/"
 
 S = "${WORKDIR}/${BPN}-${PV}-stable"
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
-
 inherit autotools
 
 # Needed for Debian packaging
@@ -29,11 +26,19 @@ LEAD_SONAME = "libevent-2.1.so"
 
 inherit ptest multilib_header
 
-DEPENDS = "zlib"
+DEPENDS = "openssl zlib"
+
+PACKAGES =+ "${PN}-core ${PN}-extra ${PN}-openssl ${PN}-pthreads"
+FILES_${PN}-core = "${libdir}/libevent_core*${SOLIBS}"
+FILES_${PN}-extra = "${libdir}/libevent_extra*${SOLIBS}"
+FILES_${PN}-openssl = "${libdir}/libevent_openssl*${SOLIBS}"
+FILES_${PN}-pthreads = "${libdir}/libevent_pthreads-*${SOLIBS}"
 
 BBCLASSEXTEND = "native nativesdk"
 
 do_install_append() {
+       rm ${D}${bindir}/event_rpcgen.py
+       rmdir ${D}${bindir}
         oe_multilib_header event2/event-config.h
 }
 
Signature · 1 line
2.23.0.rc1
#3 lore raw
Quoted 8 lines · André Draszik
Quoted 2 lines · Alexander Kanavin

I would rather keep the option to disable openssl, but simply switch it on by default

Why complicate things, what's the use-case? If libevent_openssl.so is not
used by anything, that library will not be pulled in, as it is a separate package now.

Build time dependencies and hence build speed?

It sounds trivial but all these inter-dependencies do mount up so if we don't need it, keeping things minimal has advantages.

If there is a security issue in openssl, its one more thing that would have to be regenerated if a CVE fix were added too...

Cheers,

Richard

#6 lore raw

PATCH v2 1/1 libevent: update packaging (one package per shared library)

In reply to André Draszik

libevent produces several libraries that might or might not be used in the end. We can prevent those potentially unused libraries from being pulled into a file-system by splitting the individual shared libraries into individual packages.

Because this recipe only provides shared libraries which are handled automatically by bitbake (shlibs), there is no need to add the subpackages to the RDEPENDS of PN for backwards compatibility. The packaging process of dependees will simply pull in the sub-packages as runtime dependency as needed.

This also how Debian splits this up.

While updating the packaging, we can also drop event_rpcgen.py which appears to be a tool for generating rpc bindings, i.e. something that should normally be in -dev. Given Debian doesn't package this at all, and given it actually requires python to run but no runtime dependency is stated at the moment, it would appear that no users of this exist.

---
v2: keep SSL support turned-off by default

---
 meta/recipes-support/libevent/libevent_2.1.11.bb | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/recipes-support/libevent/libevent_2.1.11.bb +8 -0
index f005ab8bda..8c7c49e7dd 100644
@@ -31,9 +31,17 @@ inherit ptest multilib_header
 
 DEPENDS = "zlib"
 
+PACKAGES_DYNAMIC = "^${PN}-.*$"
+python split_libevent_libs () {
+    do_split_packages(d, '${libdir}', r'^libevent_([a-z]*)-.*\.so\..*', '${PN}-%s', '${SUMMARY} (%s)', prepend=True, allow_links=True)
+}
+PACKAGESPLITFUNCS_prepend = "split_libevent_libs "
+
 BBCLASSEXTEND = "native nativesdk"
 
 do_install_append() {
+	rm ${D}${bindir}/event_rpcgen.py
+	rmdir ${D}${bindir}
         oe_multilib_header event2/event-config.h
 }
 
Signature · 1 line
2.23.0.rc1
#4 lore raw
In reply to Richard Purdie
Quoted 10 lines · Richard Purdie
Quoted 8 lines · André Draszik
Quoted 2 lines · Alexander Kanavin

I would rather keep the option to disable openssl, but simply switch it on by default

Why complicate things, what's the use-case? If libevent_openssl.so is not
used by anything, that library will not be pulled in, as it is a separate package now.

Quoted 7 lines

Build time dependencies and hence build speed?

It sounds trivial but all these inter-dependencies do mount up so if we don't need it, keeping things minimal has advantages.

If there is a security issue in openssl, its one more thing that would have to be regenerated if a CVE fix were added too...

What about helping make network connections more secure by enabling ssl by default? Is yocto really advocating the use of unencrypted connections?

If build time is the argument, why is stack protection enabled by default in the compiler?
Why do other packages have OpenSSL support enabled by default?

I could go on, but I don't care enough, v2 sent :-)

Cheers,
Andre'

#5 lore raw
Quoted 18 lines · André Draszik
Quoted 17 lines · Richard Purdie
Quoted 9 lines · André Draszik
Quoted 2 lines · Alexander Kanavin

I would rather keep the option to disable openssl, but simply switch it on by default

Why complicate things, what's the use-case? If libevent_openssl.so is
not
used by anything, that library will not be pulled in, as it is a separate package now.

Build time dependencies and hence build speed?

It sounds trivial but all these inter-dependencies do mount up so if we
don't need it, keeping things minimal has advantages.

Quoted 7 lines
Quoted 3 lines

If there is a security issue in openssl, its one more thing that would
have to be regenerated if a CVE fix were added too...

What about helping make network connections more secure by enabling ssl by default? Is yocto really advocating the use of unencrypted connections?

No. Information like that about impact would help sway this discussion and should probably be in the commit message. Its a question of why as well as what and how.

Quoted 5 lines

If build time is the argument, why is stack protection enabled by default in the compiler?
Why do other packages have OpenSSL support enabled by default?

I could go on, but I don't care enough, v2 sent :-)

It is important, I suspect the commit message needs more info to help ensure we make informed decisions...

Cheers,

Richard