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

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

Commit Message

Felix Moessbauer Aug. 21, 2025, 9:23 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>
---
Changes since v2:

- use '==' in comparison to make it similar to the line above

Changes since v1:

- align code style with line above

 meta/classes/dpkg-source.bbclass | 1 +
 1 file changed, 1 insertion(+)

Comments

Jan Kiszka Aug. 21, 2025, 9:24 a.m. UTC | #1
On 21.08.25 11:23, Felix Moessbauer 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>
> ---
> Changes since v2:
> 
> - use '==' in comparison to make it similar to the line above
> 
> Changes since v1:
> 
> - align code style with line above
> 
>  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..4877abd6 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] += "${@'' if '${PN}' == '${BPN}' else '${BPN}:do_clean'}"

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>

Thanks,
Jan

Patch

diff --git a/meta/classes/dpkg-source.bbclass b/meta/classes/dpkg-source.bbclass
index a2eb37a4..4877abd6 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] += "${@'' if '${PN}' == '${BPN}' else '${BPN}:do_clean'}"