Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] classes/archiver: fix tarball content in "original" mode
@ 2026-08-18 13:36 João Marcos Costa
  2026-08-27 13:12 ` Paul Barker
  0 siblings, 1 reply; 2+ messages in thread
From: João Marcos Costa @ 2026-08-18 13:36 UTC (permalink / raw)
  To: openembedded-core; +Cc: thomas.petazzoni, João Marcos Costa

When ARCHIVER_MODE[src] is set to "original", a tarball is generated with
the unpacked sources of a given recipe. Prior to it, a tmpdir
(i.e. from tempfile.mkdtemp()) is created and the sources are unpacked inside:

(...)/vim/9.2.0340/archiver-work/tmp8pu2nsck
`-- vim-9.2.0340
    |-- READMEdir
    |-- ci
    |-- lang

This tmpdir, however, ends up being shipped in the deployed tarball:

$ tar -tf vim-9.2.0340-r0.tar.xz
(...)
tmp8pu2nsck/vim-9.2.0340/ci/config.mk.clang-12.sed
tmp8pu2nsck/vim-9.2.0340/LICENSE
tmp8pu2nsck/vim-9.2.0340/.git-blame-ignore-revs
(...)

This can be avoided by using "-C" option from tar's command, with which we
can point to the tmpdir and to the content inside separately:

tar --exclude=temp --exclude=patches --exclude='.pc' \
-C (...)/vim/9.1.1683/archiver-work/tmpv0m93p52 -cf - . | \
xz --memlimit=50% --threads=64 > \
(...)/vim/9.1.1683/archiver-sources/(...)/vim-9.1.1683-r0/vim-9.1.1683-r0.tar.xz

and in the result:

./
./vim-9.1.1683/
./vim-9.1.1683/SECURITY.md
./vim-9.1.1683/.codecov.yml
(...)

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
---
 meta/classes/archiver.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 3124b7040d..85b591c084 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -424,7 +424,12 @@ def create_tarball(d, srcdir, suffix, ar_outdir):
     bb.note('Creating %s' % tarname)
     dirname = os.path.dirname(srcdir)
     basename = os.path.basename(srcdir)
-    tar_cmd = ["tar", "--exclude=temp", "--exclude=patches", "--exclude=.pc", '-cf', tarname, basename, '-I', compression_cmd]
+    if d.getVarFlag('ARCHIVER_MODE', 'src') == "original":
+        tar_dir, content = srcdir, "."
+    else:
+        tar_dir, content = dirname, basename
+
+    tar_cmd = ["tar", "--exclude=temp", "--exclude=patches", "--exclude=.pc", '-C', tar_dir, '-cf', tarname, content, '-I', compression_cmd]
     subprocess.check_call(tar_cmd, cwd=dirname)
 
 # creating .diff.gz between source.orig and source
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] classes/archiver: fix tarball content in "original" mode
  2026-08-18 13:36 [PATCH] classes/archiver: fix tarball content in "original" mode João Marcos Costa
@ 2026-08-27 13:12 ` Paul Barker
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Barker @ 2026-08-27 13:12 UTC (permalink / raw)
  To: João Marcos Costa, openembedded-core; +Cc: thomas.petazzoni

On Tue, 2026-08-18 at 15:36 +0200, João Marcos Costa wrote:
> When ARCHIVER_MODE[src] is set to "original", a tarball is generated with
> the unpacked sources of a given recipe. Prior to it, a tmpdir
> (i.e. from tempfile.mkdtemp()) is created and the sources are unpacked inside:
> 
> (...)/vim/9.2.0340/archiver-work/tmp8pu2nsck
> `-- vim-9.2.0340
>     |-- READMEdir
>     |-- ci
>     |-- lang
> 
> This tmpdir, however, ends up being shipped in the deployed tarball:
> 
> $ tar -tf vim-9.2.0340-r0.tar.xz
> (...)
> tmp8pu2nsck/vim-9.2.0340/ci/config.mk.clang-12.sed
> tmp8pu2nsck/vim-9.2.0340/LICENSE
> tmp8pu2nsck/vim-9.2.0340/.git-blame-ignore-revs
> (...)
> 
> This can be avoided by using "-C" option from tar's command, with which we
> can point to the tmpdir and to the content inside separately:
> 
> tar --exclude=temp --exclude=patches --exclude='.pc' \
> -C (...)/vim/9.1.1683/archiver-work/tmpv0m93p52 -cf - . | \
> xz --memlimit=50% --threads=64 > \
> (...)/vim/9.1.1683/archiver-sources/(...)/vim-9.1.1683-r0/vim-9.1.1683-r0.tar.xz
> 
> and in the result:
> 
> ./
> ./vim-9.1.1683/
> ./vim-9.1.1683/SECURITY.md
> ./vim-9.1.1683/.codecov.yml
> (...)
> 
> Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>

Reading this leaves me wondering why we're creating a tmpdir under
${ARCHIVER_WORKDIR}, why not just unpack the source directly under the
archiver workdir?

If the tmpdir is needed, I think the issue is that we're passing the
tmpdir path to create_tarball() in do_ar_original() instead of the full
path to the extracted sources. I think fixing the call site in
do_ar_original() would be cleaner if we can do that.

Best regards,

-- 
Paul Barker



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-27 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 13:36 [PATCH] classes/archiver: fix tarball content in "original" mode João Marcos Costa
2026-08-27 13:12 ` Paul Barker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox