Skip to contentSkip to conversation

Lock external repository in custom FSTYPE

DISCUSSION Stefan Agner 2 participants 4 messages Oct 29, 2018 – Nov 2, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

We use meta-updater, which has a custom FSTYPE to build a OSTree repository. We share that repository across multiple bitbake executions. The underlying OSTree tools lock the OSTree repository before trying to interact, and if it fails ("error: Locking repo exclusive failed:
Resource temporarily unavailable") then the complete build fails (see also https://github.com/advancedtelematic/meta-updater/issues/412).

Now I'd rather prefer that two bitbake tasks would serialize the access to the OSTree repository. Is there a mechanism in bitbake to lock (and wait) for the repository to be not in use?

We tried using bb.utils.lockfile, but the task is written in shell. Also inline Python would not work since locking/unlocking need to be done within one Python script as far as I understand.

--
Stefan

#1 lore raw
Quoted 10 lines · Stefan Agner

Hi,

We use meta-updater, which has a custom FSTYPE to build a OSTree repository. We share that repository across multiple bitbake executions. The underlying OSTree tools lock the OSTree repository before trying to interact, and if it fails ("error: Locking repo exclusive failed:
Resource temporarily unavailable") then the complete build fails (see also https://github.com/advancedtelematic/meta-updater/issues/412).

Quoted 8 lines

Now I'd rather prefer that two bitbake tasks would serialize the access to the OSTree repository. Is there a mechanism in bitbake to lock (and wait) for the repository to be not in use?

We tried using bb.utils.lockfile, but the task is written in shell. Also inline Python would not work since locking/unlocking need to be done within one Python script as far as I understand.

perhaps you could use lockfiles something like

do_foo[lockfiles] = ...

Quoted 7 lines

--
Stefan
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 15 lines · Khem Raj
Quoted 14 lines · Stefan Agner

Hi,

We use meta-updater, which has a custom FSTYPE to build a OSTree repository. We share that repository across multiple bitbake executions. The underlying OSTree tools lock the OSTree repository before trying to interact, and if it fails ("error: Locking repo exclusive failed:
Resource temporarily unavailable") then the complete build fails (see also https://github.com/advancedtelematic/meta-updater/issues/412).

Now I'd rather prefer that two bitbake tasks would serialize the access to the OSTree repository. Is there a mechanism in bitbake to lock (and wait) for the repository to be not in use?

Quoted 8 lines
Quoted 4 lines

We tried using bb.utils.lockfile, but the task is written in shell. Also inline Python would not work since locking/unlocking need to be done within one Python script as far as I understand.

perhaps you could use lockfiles something like

do_foo[lockfiles] = ...

Wasn't aware of the lockfiles varflag, also seems not to appear in any documentation. Reading lib/bb/build.py suggests that it really is locking the complete task, exactly what we need.

Added the lockfiles varflag to the do_image_ostree task in image_types_ostree.bbclass:
do_image_ostree[lockfiles] += "${OSTREE_REPO}/ostree.lock"

And run two builds, the OSTree lock issues seem to be gone. Thanks Khem!

--
Stefan

Quoted 8 lines
Quoted 8 lines

--
Stefan
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 21 lines · Stefan Agner
Quoted 20 lines · Khem Raj
Quoted 18 lines · Stefan Agner

Hi,

We use meta-updater, which has a custom FSTYPE to build a OSTree repository. We share that repository across multiple bitbake executions. The underlying OSTree tools lock the OSTree repository before trying to interact, and if it fails ("error: Locking repo exclusive failed:
Resource temporarily unavailable") then the complete build fails (see also https://github.com/advancedtelematic/meta-updater/issues/412).

Now I'd rather prefer that two bitbake tasks would serialize the access to the OSTree repository. Is there a mechanism in bitbake to lock (and wait) for the repository to be not in use?

We tried using bb.utils.lockfile, but the task is written in shell. Also inline Python would not work since locking/unlocking need to be done within one Python script as far as I understand.

Quoted 6 lines
Quoted 3 lines

perhaps you could use lockfiles something like

do_foo[lockfiles] = ...

Wasn't aware of the lockfiles varflag, also seems not to appear in any documentation. Reading lib/bb/build.py suggests that it really is

I take that back:

https://www.yoctoproject.org/docs/latest/bitbake-user-manual/bitbake-user-manual.html#variable-flags

--
Stefan

Quoted 19 lines

locking the complete task, exactly what we need.

Added the lockfiles varflag to the do_image_ostree task in image_types_ostree.bbclass:
do_image_ostree[lockfiles] += "${OSTREE_REPO}/ostree.lock"

And run two builds, the OSTree lock issues seem to be gone. Thanks Khem!

--
Stefan

Quoted 8 lines
Quoted 8 lines

--
Stefan
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core