[1/1] run clean task of BPN as well when cleaning PN

Message ID 20250820105908.1902523-1-felix.moessbauer@siemens.com
State Superseded, archived
Headers show
Series [1/1] run clean task of BPN as well when cleaning PN | expand

Commit Message

Felix Moessbauer Aug. 20, 2025, 10:59 a.m. UTC
The do_fetch_common_source task has a hidden dependency to having
the source package in isar apt. While this is modeled in bitbake (via
depends to ${BPN}:do_deploy_source), the source package is not there
anymore when running repo_del_package on the -native package.

This happens because the clean task on the -native package calls out to
repo_del_package, which also removes the source package. This deletion
remains hidden to bitbake, hence the ${PN}:do_dpkg_source is not
executed again and the do_fetch_common_source fails, as the source
package is not there anymore.

As it looks like there is no way in reprepro to not delete the source
package, we simply fix it by adding a dependency to BPN:do_clean in case
BPN != PN.

Fixes: 2ca3a7e5 ("dpkg-source: Build source package only once")
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/dpkg-source.bbclass | 1 +
 1 file changed, 1 insertion(+)

Comments

Jan Kiszka Aug. 20, 2025, 4:19 p.m. UTC | #1
On 20.08.25 12:59, 'Felix Moessbauer' via isar-users wrote:
> The do_fetch_common_source task has a hidden dependency to having
> the source package in isar apt. While this is modeled in bitbake (via
> depends to ${BPN}:do_deploy_source), the source package is not there
> anymore when running repo_del_package on the -native package.
> 
> This happens because the clean task on the -native package calls out to
> repo_del_package, which also removes the source package. This deletion
> remains hidden to bitbake, hence the ${PN}:do_dpkg_source is not
> executed again and the do_fetch_common_source fails, as the source
> package is not there anymore.
> 
> As it looks like there is no way in reprepro to not delete the source
> package, we simply fix it by adding a dependency to BPN:do_clean in case
> BPN != PN.
> 
> Fixes: 2ca3a7e5 ("dpkg-source: Build source package only once")
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/classes/dpkg-source.bbclass | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/classes/dpkg-source.bbclass b/meta/classes/dpkg-source.bbclass
> index a2eb37a4..20c082f6 100644
> --- a/meta/classes/dpkg-source.bbclass
> +++ b/meta/classes/dpkg-source.bbclass
> @@ -79,3 +79,4 @@ do_fetch_common_source() {
>  addtask fetch_common_source
>  
>  do_dpkg_build[depends] += "${@'${PN}:do_dpkg_source' if '${PN}' == '${BPN}' else '${PN}:do_fetch_common_source'}"
> +do_clean[depends] += "${@'${BPN}:do_clean' if d.getVar('PN') != d.getVar('BPN') else ''}"

For the sake of have both neighboring lines in the same visual and
logical style, please use the same test as above.

Makes sense otherwise.

Jan

Patch

diff --git a/meta/classes/dpkg-source.bbclass b/meta/classes/dpkg-source.bbclass
index a2eb37a4..20c082f6 100644
--- a/meta/classes/dpkg-source.bbclass
+++ b/meta/classes/dpkg-source.bbclass
@@ -79,3 +79,4 @@  do_fetch_common_source() {
 addtask fetch_common_source
 
 do_dpkg_build[depends] += "${@'${PN}:do_dpkg_source' if '${PN}' == '${BPN}' else '${PN}:do_fetch_common_source'}"
+do_clean[depends] += "${@'${BPN}:do_clean' if d.getVar('PN') != d.getVar('BPN') else ''}"