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

Build failed in a subdir with make-srpm mothed #2597

Closed
pkking opened this issue Mar 28, 2023 · 4 comments · Fixed by #2599
Closed

Build failed in a subdir with make-srpm mothed #2597

pkking opened this issue Mar 28, 2023 · 4 comments · Fixed by #2599
Assignees

Comments

@pkking
Copy link
Contributor

pkking commented Mar 28, 2023

logs here
Just for record:

Task:
{'appstream': True,
 'background': False,
 'build_id': 5715548,
 'chroot': None,
 'project_dirname': 'waaagh',
 'project_name': 'waaagh',
 'project_owner': 'lcrpkking',
 'repos': [],
 'sandbox': 'lcrpkking/waaagh--lcrpkking',
 'source_json': {'clone_url': 'https://github.com/pkking/copr.git',
                 'committish': '',
                 'spec': 'copr-frontend.spec',
                 'srpm_build_method': 'make_srpm',
                 'subdirectory': 'frontend',
                 'type': 'git'},
 'source_type': 8,
 'submitter': 'lcrpkking',
 'task_id': '5715548'}

Running: git clone https://github.com/pkking/copr.git /var/lib/copr-rpmbuild/workspace/workdir-0ksv7tdd/copr --depth 500 --no-single-branch --recursive

cmd: ['git', 'clone', 'https://github.com/pkking/copr.git', '/var/lib/copr-rpmbuild/workspace/workdir-0ksv7tdd/copr', '--depth', '500', '--no-single-branch', '--recursive']
cwd: .
rc: 0
stdout: 
stderr: Cloning into '/var/lib/copr-rpmbuild/workspace/workdir-0ksv7tdd/copr'...

Running: mock --uniqueext 1679972862.252171 -r /var/lib/copr-rpmbuild/workspace/safe-resultdir-yi7elwsi/mock-source-build.cfg '--plugin-option=bind_mount:dirs=(("/var/lib/copr-rpmbuild/workspace/workdir-0ksv7tdd", "/mnt/workdir-0ksv7tdd"), ("/var/lib/copr-rpmbuild/workspace/safe-resultdir-yi7elwsi", "/mnt/safe-resultdir-yi7elwsi"))' --chroot 'set -x && cd /mnt/workdir-0ksv7tdd/copr/frontend && echo -e "[safe]
directory = /mnt/workdir-0ksv7tdd/copr/frontend" > ~/.gitconfig && make -f /mnt/workdir-0ksv7tdd/copr/.copr/Makefile srpm outdir="/mnt/safe-resultdir-yi7elwsi" spec="/mnt/workdir-0ksv7tdd/copr/frontend/copr-frontend.spec"'

...

Complete!
tito build --tgz --output=/mnt/workdir-0ksv7tdd/copr/frontend/
ERROR: /mnt/workdir-0ksv7tdd/copr/frontend does not appear to be within a git checkout.
Creating output directory: /mnt/workdir-0ksv7tdd/copr/frontend
make: *** [/mnt/workdir-0ksv7tdd/copr/.copr/Makefile:3: srpm] Error 1
stderr: INFO: mock.py version 3.5 starting (python version = 3.11.0, NVR = mock-3.5-1.fc37)...

Seems copr just put the spec location into git safe.directory, but if we place the spec in a subdir, git wont got to work as well.

@praiskup
Copy link
Member

Thank you for the report. What makes you think this is git safe.directory-related issue?

@pkking
Copy link
Contributor Author

pkking commented Mar 28, 2023

Not so sure, but i read the tito code, the error msg indicate that the git repo is abnormal.
And while Copr clone the git repo outside mock chroot using a normal user, and build the srpm in mock chroot by root, i think it probably related to safe.directory.

@pkking
Copy link
Contributor Author

pkking commented Mar 29, 2023

Finally i bring up a local test container, i ssh as mockbuild user and tried to verify my idea:
When i run(with [safe] directory = /mnt/copr/)

cd ~;mkdir -p result
git clone https://github.com/pkking/copr
mock --uniqueext 1679972950.517360 -r /etc/mock/openeuler-22.03-x86_64.cfg '--plugin-option=bind_mount:dirs=(("/home/mockbuild/copr", "/mnt/copr"), ("/home/mockbuild/result", "/mnt/result"))' --chroot 'set -x 
&& cd /mnt/copr/frontend && echo -e "[safe] directory = /mnt/copr/" > ~/.gitconfig && ls -lh /mnt/copr && whoami && git status'

The git status exit with no excepion

+ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

But when i run:(with [safe] directory = /mnt/copr/frontend)

cd ~;mkdir -p result
git clone https://github.com/pkking/copr
mock --uniqueext 1679972950.517360 -r /etc/mock/openeuler-22.03-x86_64.cfg '--plugin-option=bind_mount:dirs=(("/home/mockbuild/copr", "/mnt/copr"), ("/home/mockbuild/result", "/mnt/result"))' --chroot 'set -x
 && cd /mnt/copr/frontend && echo -e "[safe] directory = /mnt/copr/frontend" > ~/.gitconfig && ls -lh /mnt/copr && whoami && git status '

The output is

+ git status
fatal: detected dubious ownership in repository at '/mnt/copr'
To add an exception for this directory, call:

   git config --global --add safe.directory /mnt/copr

I think that means we should set git repo root dir as safe.directory instead of the spec located dir.

@praiskup
Copy link
Member

Ok, that makes sense. Can you please submit a PR for this?

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

Successfully merging a pull request may close this issue.

3 participants