-
Notifications
You must be signed in to change notification settings - Fork 185
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
Fix local building in git projects #1617
base: master
Are you sure you want to change the base?
Conversation
Hello @adrianschroeter! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2024-10-14 13:19:40 UTC |
@wfeldt this should solve your issue |
note: this is not a good implementation and needs extensions if we want to support the experimental _subdirs way as well. However, it unblocks people for now again with local operations. |
f5a218d
to
5c8ea7f
Compare
@wfeldt can you test again if it works for you now? (it does for me) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make clear how to properly detect project and package checkouts that are in git and decide how to work with their metadata.
osc/git_scm/store.py
Outdated
@@ -32,7 +32,7 @@ def __init__(self, path, check=True): | |||
|
|||
# TODO: how to determine if the current git repo contains a project or a package? | |||
self.is_project = False | |||
self.is_package = os.path.exists(os.path.join(self.abspath, ".git")) | |||
self.is_package = os.path.exists(os.path.join(self.abspath, ".git")) or os.path.exists(os.path.join(self.abspath, "../.git")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you really suggesting that package is every directory that has .git in the parent dir?
We should rather find a better way of identifying project and package git checkouts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solved this in a better way now hopefully.
Problem here is that "is_package" is always false for the store on project git. But we still have packages ...
osc/git_scm/store.py
Outdated
@@ -68,11 +68,16 @@ def apiurl(self): | |||
|
|||
@property | |||
def project(self): | |||
if self._project is None: | |||
with open(os.path.join(os.path.join(self.abspath, '.osc/_project'))) as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra os.path.join()
.
Is the .osc
directory always present?
Couldn't we use it for detecting project and package names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least always when used "osc co". However, using git cli now to find toplevel directory as dirk recommended.
8cc57e0
to
06e8afb
Compare
osc/git_scm/store.py
Outdated
# NOTE: we have only one store in project-git for all packages | ||
self._toplevel = self._run_git(["rev-parse", "--show-toplevel"]) | ||
if self._toplevel == self.abspath: | ||
self.is_project = True | ||
self.is_package = False | ||
else: | ||
self.is_project = False | ||
self.is_package = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is the change that broke unit tests.
See tests / unit - read only fixtures (pull_request)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unable to find that check/failure, however I fixed a different one when executing it local.
There are still two test case failures, but IMHO the test cases are to blame here: tests/test_git_scm_store.py sets up the the work area with plain git (not osc co) and fails over missing .osc/_project later one.
IMHO this can not work, we either should set it up using "osc co" or also setup the .osc meta data.
06e8afb
to
59b1c8f
Compare
59b1c8f
to
b51fc53
Compare
b51fc53
to
9ca0799
Compare
osc did not find it's store and was unable to run a local build in a project git
Co-authored-by: Jose D. Gomez R. <[email protected]>
bc96499
to
512c48a
Compare
I have pushed a fixed version that passes the unit tests. |
osc did not find it's store and was unable to run a local build in a project git