Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/11385 #104

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

javiercarrascocruz
Copy link

This series fixes the following bug reported on the Yocto Project Bugzilla:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=11385

When at it, a trivial typo has been fixed in the help message, and the rest of the options has been added. They follow the format used in the example for consistency (’option=val’, and not 'option val' as stated in the help message).

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
It has been reported that developers new to containers try to obtain
meta-data inside the poky-container, which leads to users reporting
false errors.

Specify the goal of poky-container and explicitly state that meta-data
must be retrieved outside the container.

Fixes: Bugzilla - Bug 11385
Closes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=11385
Suggested-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
@javiercarrascocruz
Copy link
Author

Gentle ping.

Does the CROPS contribution workflow run via mailing list? If that's the case, I would like to know which one to send these patches.

@moto-timo
Copy link
Member

This is the correct place for contributions. We have a very limited number of people reviewing. Apologies for the delay.

@javiercarrascocruz
Copy link
Author

No worries, I just wanted to make sure that I was in the right place.

@moto-timo moto-timo self-assigned this May 24, 2024
@moto-timo moto-timo self-requested a review May 24, 2024 16:09
Copy link
Member

@moto-timo moto-timo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statement about requiring metadata to be cloned outside of the container is not true. It is a symptom of not previously creating the workspace and passing that in as a volume to the container. This could perhaps be clarified, but is already documented.

in https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html#building-your-image to build an image.

Note that the container should not be used to clone Poky or obtain any other meta-data, which must be done
_outside_ the container using common tools like Git, as stated in https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html#use-git-to-clone-poky
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true. The instructions above tell you to create your workspace and pass that in as a volume. If you pass in a directory that does not exist, docker will "conveniently" create it inside the container as root.

For instance, this series of commands works just fine (on Linux) and poky is cloned with my user permissions:

ttorling@chiron:/srv/build/ttorling$ mkdir crops-workspace
ttorling@chiron:/srv/build/ttorling$ docker run --rm -it -v /srv/build/ttorling/crops-workspace:/workdir crops/poky --workdir=/workdir
pokyuser@14be76de76a9:/workdir$ git clone https://git.yoctoproject.org/poky.git
Cloning into 'poky'...
remote: Enumerating objects: 646774, done.
remote: Counting objects: 100% (1691/1691), done.
remote: Compressing objects: 100% (425/425), done.
remote: Total 646774 (delta 1364), reused 1419 (delta 1260), pack-reused 645083
Receiving objects: 100% (646774/646774), 204.82 MiB | 3.45 MiB/s, done.
Resolving deltas: 100% (471021/471021), done.
pokyuser@14be76de76a9:/workdir$ exit
exit
ttorling@chiron:/srv/build/ttorling$ ls -la crops-workspace/
total 12
drwxrwxr-x  3 ttorling ttorling 4096 May 24 09:20 .
drwxr-xr-x 73 ttorling ttorling 4096 May 24 09:18 ..
drwxr-xr-x 12 ttorling ttorling 4096 May 24 09:21 poky

There are also instructions for Windows and Mac OS to use the samba container, because those native file systems are not compatible with Linux.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On further review of the original bug, the issue being discussed there is the lack of the repo tool in the image. This has already been discussed and rejected crops/yocto-dockerfiles#42

The solution is to build a derivative container with the tools you need for your specific use case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dockerfile.repo:

FROM crops/poky:ubuntu-18.04

USER root

RUN  wget https://storage.googleapis.com/git-repo-downloads/repo -O /usr/local/bin/repo && \
     chmod +x /usr/local/bin/repo

# We always need to return to the usersetup and ENTRYPOINT
USER usersetup
ENV LANG=en_US.UTF-8

ENTRYPOINT ["/usr/bin/distro-entry.sh", "/usr/bin/dumb-init", "--", "/usr/bin/poky-entry.py"]

Build:
docker build -t crops/poky-repo:ubuntu-18.04 -f ./Docker.repo .

Execution:

ttorling@chiron:/srv/build/ttorling$ docker run --rm -it -v /srv/build/ttorling/crops-workspace:/workdir crops/poky-repo:ubuntu-18.04 --workdir=/workdir
pokyuser@aa90fb6f937a:/workdir$ which repo
/usr/local/bin/repo
pokyuser@aa90fb6f937a:/workdir$ repo --help
usage: repo COMMAND [ARGS]

repo is not yet installed.  Use "repo init" to install it here.

The most commonly used repo commands are:

  init      Install repo in the current working directory
  help      Display detailed help on a command

For access to the full online help, install repo ("repo init").

Bug reports: https://issues.gerritcodereview.com/issues/new?component=1370071

Because repo will always try to "phone home" and update itself, you will likely need to rebuild this container from time to time to have the latest version and avoid warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants