~alpine/devel

2 2

Best way to handle git submodules in APKBUILDs?

Camelia Lavender <cam@camelia.dev>
Details
Message ID
<db3a60b1-4219-4bc0-b62b-958ad2e9cd5b@camelia.dev>
DKIM signature
missing
Download raw message
Hi everyone!

I'm relatively new to Alpine Linux packaging, but I'm trying to learn 
more about it by packaging a few pieces of software that aren't yet 
included in Alpine repositories. I really hope I ask my question in the 
correct place (I tried looking on the Wiki but didn't find any 
information about this) :)

I was wondering what the best way to package projects that rely on git 
submodules was. The problem with submodules is that they usually aren't 
included in release tarballs. Also, since the "primary" source of the 
package is a tarball, it is not possible to use git to automatically 
pull submodules from their upstream repositories, which, in the end, 
makes it (I guess) necessary to add many different sources in the APKBUILD.

What I've been thinking about doing is this:

- For each submodule, I add a source in the APKBUILD, which points to 
the source tarball of the specific commit that is checked out in the 
repository.
- Then, I move the content of the tarball to the place where the content 
of the submodule should be.

Is this a correct way to do what I'm trying to achieve, or is there a 
better way to do so?

Thanks in advance! :)
-- 
Sincerely,

Camelia Lavender (she/they)
PGP: 0xDBCC70EFBC360E97
Naomi Rennie-Waldock <naomi.renniewaldock@gmail.com>
Details
Message ID
<C377DAFC-4939-48BE-98CE-302F79E708AF@gmail.com>
In-Reply-To
<db3a60b1-4219-4bc0-b62b-958ad2e9cd5b@camelia.dev> (view parent)
DKIM signature
missing
Download raw message
On 29 August 2025 17:26:04 BST, Camelia Lavender <cam@camelia.dev> wrote:
>Hi everyone!
>
>I'm relatively new to Alpine Linux packaging, but I'm trying to learn more about it by packaging a few pieces of software that aren't yet included in Alpine repositories. I really hope I ask my question in the correct place (I tried looking on the Wiki but didn't find any information about this) :)
>
>I was wondering what the best way to package projects that rely on git submodules was. The problem with submodules is that they usually aren't included in release tarballs. Also, since the "primary" source of the package is a tarball, it is not possible to use git to automatically pull submodules from their upstream repositories, which, in the end, makes it (I guess) necessary to add many different sources in the APKBUILD.
>
>What I've been thinking about doing is this:
>
>- For each submodule, I add a source in the APKBUILD, which points to the source tarball of the specific commit that is checked out in the repository.
>- Then, I move the content of the tarball to the place where the content of the submodule should be.
>
>Is this a correct way to do what I'm trying to achieve, or is there a better way to do so?
>
>Thanks in advance! :)
>-- 
>Sincerely,
>
>Camelia Lavender (she/they)
>PGP: 0xDBCC70EFBC360E97
>

That approach is what we've been doing for other packages where upstream doesn't provide a full source archive.
Achill Gilgenast <achill@achill.org>
Details
Message ID
<DCF2CH1L43SQ.2D3R5B8MCTU4K@achill.org>
In-Reply-To
<db3a60b1-4219-4bc0-b62b-958ad2e9cd5b@camelia.dev> (view parent)
DKIM signature
missing
Download raw message
On Fri Aug 29, 2025 at 6:26 PM CEST, Camelia Lavender wrote:
> Hi everyone!

Hey!

>
> I'm relatively new to Alpine Linux packaging, but I'm trying to learn 
> more about it by packaging a few pieces of software that aren't yet 
> included in Alpine repositories. I really hope I ask my question in the 
> correct place (I tried looking on the Wiki but didn't find any 
> information about this) :)
>
> I was wondering what the best way to package projects that rely on git 
> submodules was. The problem with submodules is that they usually aren't 

*usually* they are. For example, `meson dist` pacakges all the
sub*projects* into the tarball. But of course, there are exceptions, e.g.
GitHub-generated tarballs.

> included in release tarballs. Also, since the "primary" source of the 
> package is a tarball, it is not possible to use git to automatically 
> pull submodules from their upstream repositories, which, in the end, 
> makes it (I guess) necessary to add many different sources in the APKBUILD.
>
> What I've been thinking about doing is this:
>
> - For each submodule, I add a source in the APKBUILD, which points to 
> the source tarball of the specific commit that is checked out in the 
> repository.
> - Then, I move the content of the tarball to the place where the content 
> of the submodule should be.
>
> Is this a correct way to do what I'm trying to achieve, or is there a 
> better way to do so?

This is usually done, yeah. See https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/chatterino2/APKBUILD
as a random example.

But note, that it might depend on the kind of submodule, since Alpine
package are preferred as dependencies and not the vendored ones. For
assets and stuff, or forks of packages (as in the chatterino2 example),
that should be fine tho.

>
> Thanks in advance! :)

Thank you so much for being interested in Alpine packaging! If you have
any other questions, dont hesitate to ask me :)
Reply to thread Export thread (mbox)