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

fix: cache lock file not deleted in an abnormal state, resulting in other tasks not blocking #488

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 29 additions & 26 deletions TarSCM/scm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,37 +146,40 @@ def fetch_upstream(self):
self._calc_dir_to_clone_to(clone_prefix)
self.prepare_clone_dir()

self.lock_cache()

if not os.path.isdir(self.clone_dir):
# initial clone
logging.debug(
"[fetch_upstream] Initial checkout/clone to directory: '%s'",
self.clone_dir
)
os.mkdir(self.clone_dir)
self.fetch_upstream_scm()
else:
logging.info("Detected cached repository...")
self.update_cache()
try:
self.lock_cache()

if not os.path.isdir(self.clone_dir):
# initial clone
logging.debug(
"[fetch_upstream] Initial checkout/clone to directory: '%s'",

Choose a reason for hiding this comment

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

line too long (81 > 79 characters)

self.clone_dir
)
os.mkdir(self.clone_dir)
self.fetch_upstream_scm()
else:
logging.info("Detected cached repository...")
self.update_cache()

self.prepare_working_copy()
self.prepare_working_copy()

# switch_to_revision
self.switch_revision()
# switch_to_revision
self.switch_revision()

# git specific: after switching to desired revision its necessary to
# update
# submodules since they depend on the actual version of the selected
# revision
self.fetch_submodules()
# git specific: after switching to desired revision its necessary to

Choose a reason for hiding this comment

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

line too long (80 > 79 characters)

# update
# submodules since they depend on the actual version of the selected

Choose a reason for hiding this comment

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

line too long (80 > 79 characters)

# revision
self.fetch_submodules()

# obs_scm specific: do not allow running git-lfs to prevent storage
# duplication with tar_scm
if self.args.use_obs_scm:
self.fetch_lfs()
# obs_scm specific: do not allow running git-lfs to prevent storage
# duplication with tar_scm
if self.args.use_obs_scm:
self.fetch_lfs()

self.unlock_cache()
self.unlock_cache()
finally:
self.unlock_cache()

def fetch_submodules(self):
"""NOOP in other scm's than git"""
Expand Down