aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-01-07 08:56:14 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-01-07 08:56:14 -0500
commitaafb54eb71a2539319a6d67c65e97a4b0838ed34 (patch)
treea6dc44425370a7e02d1c4fa90613cfdaa1b5ffcb
parentddb29f9713e79cab473f63d7693951fdc2f8da98 (diff)
downloadgrokmirror-aafb54eb71a2539319a6d67c65e97a4b0838ed34.tar.gz
Update objstore repos after dumb-pullv2.0.6
If we're doing dumb-pull on a repo that uses objstore, fetch those objects into objstore as well. This warrants a quick 2.0.6 release. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--CHANGELOG.rst6
-rw-r--r--contrib/python-grokmirror.spec5
-rw-r--r--grokmirror/__init__.py11
-rwxr-xr-xgrokmirror/dumb_pull.py15
4 files changed, 25 insertions, 12 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 9d814b2..9a0971a 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,9 @@
+v2.0.6 (2021-01-07)
+-------------------
+- Use fsck.extra_repack_flags when doing quick post-clone repacks
+- Store objects in objstore after grok-dumb-pull call on a repo that uses
+ objstore repositories
+
v2.0.5 (2020-11-25)
-------------------
- Prioritize baseline repositories when finding related objstore repos.
diff --git a/contrib/python-grokmirror.spec b/contrib/python-grokmirror.spec
index 3bfc1c4..97045fe 100644
--- a/contrib/python-grokmirror.spec
+++ b/contrib/python-grokmirror.spec
@@ -4,7 +4,7 @@
%global userhome %{_sharedstatedir}/grokmirror
Name: python-%{srcname}
-Version: 2.0.5
+Version: 2.0.6
Release: 1%{?dist}
Summary: Framework to smartly mirror git repositories
@@ -85,6 +85,9 @@ exit 0
%{_mandir}/*/*
%changelog
+* Thu Jan 07 2021 Konstantin Ryabitsev <konstantin@linuxfoundation.org> - 2.0.6-1
+- Update to 2.0.6 with minor new features
+
* Tue Nov 25 2020 Konstantin Ryabitsev <konstantin@linuxfoundation.org> - 2.0.5-1
- Update to 2.0.5 with minor new features
diff --git a/grokmirror/__init__.py b/grokmirror/__init__.py
index 62a2b74..52f13da 100644
--- a/grokmirror/__init__.py
+++ b/grokmirror/__init__.py
@@ -38,7 +38,7 @@ from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
-VERSION = '2.0.5'
+VERSION = '2.0.6'
MANIFEST_LOCKH = None
REPO_LOCKH = dict()
GITBIN = '/usr/bin/git'
@@ -845,9 +845,12 @@ def is_alt_repo(toplevel, refrepo):
return False
-def is_obstrepo(fullpath, obstdir):
- # At this point, both should be normalized
- return fullpath.find(obstdir) == 0
+def is_obstrepo(fullpath, obstdir=None):
+ if obstdir:
+ # At this point, both should be normalized
+ return fullpath.find(obstdir) == 0
+ # Just check if it has a grokmirror.objstore file in the repo
+ return os.path.exists(os.path.join(fullpath, 'grokmirror.objstore'))
def find_all_gitdirs(toplevel, ignore=None, normalize=False, exclude_objstore=True):
diff --git a/grokmirror/dumb_pull.py b/grokmirror/dumb_pull.py
index 8bef771..2a70479 100755
--- a/grokmirror/dumb_pull.py
+++ b/grokmirror/dumb_pull.py
@@ -68,11 +68,6 @@ def dumb_pull_repo(gitdir, remotes, svn=False):
logger.debug('Will pull %s with following remotes: %s', gitdir, remotes)
old_revs = git_rev_parse_all(gitdir)
- if not old_revs:
- logger.critical('Error opening %s.', gitdir)
- logger.critical('Make sure it is a bare git repository.')
- sys.exit(1)
-
try:
grokmirror.lock_repo(gitdir, nonblocking=True)
except IOError:
@@ -114,14 +109,20 @@ def dumb_pull_repo(gitdir, remotes, svn=False):
if not remotefound:
logger.info('Could not find any remotes matching %s in %s', remote, gitdir)
- grokmirror.unlock_repo(gitdir)
new_revs = git_rev_parse_all(gitdir)
-
if old_revs == new_revs:
logger.debug('No new revs, no updates')
+ grokmirror.unlock_repo(gitdir)
return False
logger.debug('New revs found -- new content pulled')
+
+ # store any new objects, if it's using objstore
+ altrepo = grokmirror.get_altrepo(gitdir)
+ if grokmirror.is_obstrepo(altrepo):
+ logger.debug('Fetching into objstore')
+ grokmirror.fetch_objstore_repo(altrepo, gitdir)
+ grokmirror.unlock_repo(gitdir)
return True