Article View: linux.gentoo.user
Article #128Re: [gentoo-user] custom ebuild issues: tar archive extraction
From: Pocket
Date: Thu, 12 Nov 2026 11:10
Date: Thu, 12 Nov 2026 11:10
128 lines
5445 bytes
5445 bytes
On 11/11/26 22:31, Eli Schwartz wrote:
> On 11/11/26 8:52 PM, Pocket wrote:
>
>> The source archive actually extracts to
>> /var/tmp/portage/sys-kernel/linux-rpi-6.18.50/work/linux-stable_20260911/
>>
>> It is looking for
>> /var/tmp/portage/sys-kernel/linux-rpi-6.18.50/work/linux-rpi-6.18.50
>>
>> How do I tweak the ebuild to correct the issue above?
>> IE the tar archive extracts to a directory that is not the same as the
>> archives filename. I know how to do this in an archlinux PKGBUILD but
>> not in a ebuild.
>
> For an archlinux PKGBUILD, you would normally include
>
> ```
> cd "${srcdir}"/${pkgname}-${pkgver}
> ```
>
> at the top of each function.
Yes that is what is in my PKGBUILD script I use on archlinux.
BTW cd ${pkgname}-${pkgver} works also as the "${srcdir}" is automatic.
>
> For Gentoo:
>
> - ${srcdir} is ${WORKDIR}
>
> - ${pkgname} is ${PN}
> - ${pkgver} is ${PV}
> - ${pkgname}-${pkgver} is ${P}
>
>
> See the various descriptions at:
> https://devmanual.gentoo.org/ebuild-writing/variables/index.html
>
> Gentoo also does not use manual `cd`, and instead has an ${S} variable,
> and prepare/configure/compile/install will automatically `cd "${S}"` for
> you. The default value of ${S} is, unsurprisingly I suppose :)
> ${WORKDIR}/${P} (so basically exactly the same pattern as a PKGBUILD)
> and per the link I provided, you are expected to define
>
> S=${WORKDIR}/linux-stable_20260911
>
> so that it can `cd` automatically for you.
I did read the variables list doc (found that on the wiki earlier) and I
still need to fully understand what is there.
>
>
>> Also the symlink
>> /var/tmp/portage/sys-kernel/linux-rpi-6.18.50/work/ files -> /var/db/
>> repos/pocket/sys-kernel/linux-rpi/files is broken
>>
>> /var/db/repos/pocket/sys-kernel/linux-rpi/files doesn't exist
>
>
> The symlink is automatically created for internal reasons. An ebuild
> that doesn't have a files/ directory, cannot reference any files via
> ${FILESDIR} and the symlink will be broken. That is normal and expected.
>
>
What I did was this and it seemed to work
src_unpack() {
if [[ -n ${A} ]]; then
unpack ${A}
ln -vs linux-stable_20260911 linux-rpi-6.18.50
fi
}
That seens to work But.....
I see that that the proper way would be
S=${WORKDIR}/linux-stable_20260911
I will try that.
I am gonna have a look at the emerge script to see what makes it tick
but that is gonna be bit later.
Also I had to do ebuild linux-rpi-6.18.50.ebuild clean which must have
cleaned up some errors as it is now working thru the compile phase.
I am now working on the converting the PKGBUILD package() to the ebuild
src_install()
Then I am gonna do
ebuild linux-rpi-6.18.50.ebuild package
ebuild linux-rpi-6.18.50.ebuild install
and compare the ebuild generated archive with the one I have from a
PKGBUILD. The files (list/type/number etc) should be the same but the
files themselves may not match due to the differences in the compile phase.
After words I will create a new USB drive with the stage3 file, add the
kernel and boot loader and see if it will boot using btrfs as the root
filesystem. Which by the way was/is my goal.
I will post the ebuild when I get to the point I think I am done so I
can get some feed back on what else I haven't done correctly.
I am sure I have made other errors ;).
I did find that when I did an update which portage had an update it
complained/had issues with /usr/src. I created a symlink per the docs.
It still complained and I had to copy in the .config.
I am looking to why that is but I have not form anything that explains
that. I could have missed it as I have read many docs while getting
this to this point.
I am looking at the gentoo kernel requirements and I think I will need
this ebuild plus a linux sources ebuild and a linux-api-headers ebuild
to fully complete this. Correct?
Since gentoo doesn't have an ebuild that emerges and compiles a kernel
maybe I should then share/submit it to gentoo?
Thanks
--
Hindi madali ang maging ako
Technical Details
Message-ID:
<NYAQN-bpSg-1@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomodReferences:
<NYsgx-bkTc-5@gated-at.bofh.it> <NYtPk-blRW-11@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod From: Pocket <pocket@oldfart.online> Newsgroups: linux.gentoo.user Subject: Re: [gentoo-user] custom ebuild issues: tar archive extraction Date: Thu, 12 Nov 2026 12:10:01 +0100 Message-ID: <NYAQN-bpSg-1@gated-at.bofh.it> References: <NYsgx-bkTc-5@gated-at.bofh.it> <NYtPk-blRW-11@gated-at.bofh.it> List-ID: Gentoo Linux mail <gentoo-user.gentoo.org> Reply-To: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Envelope-From: pocket@oldfart.online Approved: robomod@news.nic.it Lines: 128 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Thu, 12 Nov 2026 06:04:48 -0500 X-Original-Message-ID: <45829991-0ff2-4b3f-ba83-685cd7639266@oldfart.online> X-Original-References: <6efebe75-8e79-4402-b916-6947d93c7869@oldfart.online> <5b98dc99-72af-4439-9caf-72ada84fdd01@gentoo.org>