Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] GitSync: fix spurious "sync-depth is deprecated" messages (bug 610708)
Date: Sat, 25 Feb 2017 00:03:58
Message-Id: 20170225000244.16625-1-zmedico@gentoo.org
1 The CheckGitConfig._check_depth method must not set the sync_depth
2 attribute, or else it will trigger "sync-depth is deprecated" messages.
3
4 Fixes: b3f6297a791a ("repos.conf: rename sync-depth option to clone-depth")
5 X-Gentoo-Bug: 610708
6 X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=610708
7 ---
8 pym/portage/sync/modules/git/__init__.py | 4 ----
9 pym/portage/sync/modules/git/git.py | 9 +++++++--
10 2 files changed, 7 insertions(+), 6 deletions(-)
11
12 diff --git a/pym/portage/sync/modules/git/__init__.py b/pym/portage/sync/modules/git/__init__.py
13 index 2df60e3..60b7395 100644
14 --- a/pym/portage/sync/modules/git/__init__.py
15 +++ b/pym/portage/sync/modules/git/__init__.py
16 @@ -21,8 +21,6 @@ class CheckGitConfig(CheckSyncConfig):
17
18 def _check_depth(self, attr):
19 d = getattr(self.repo, attr)
20 - # default
21 - setattr(self.repo, attr, 1)
22
23 if d is not None:
24 try:
25 @@ -33,8 +31,6 @@ class CheckGitConfig(CheckSyncConfig):
26 % (attr.replace('_', '-'), d),
27 level=self.logger.ERROR, noiselevel=-1)
28 else:
29 - if d == 0:
30 - d = None
31 setattr(self.repo, attr, d)
32
33
34 diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
35 index d5400d5..d432886 100644
36 --- a/pym/portage/sync/modules/git/git.py
37 +++ b/pym/portage/sync/modules/git/git.py
38 @@ -53,9 +53,14 @@ class GitSync(NewBase):
39 if self.settings.get("PORTAGE_QUIET") == "1":
40 git_cmd_opts += " --quiet"
41 if self.repo.clone_depth is not None:
42 - git_cmd_opts += " --depth %d" % self.repo.clone_depth
43 + if self.repo.clone_depth != 0:
44 + git_cmd_opts += " --depth %d" % self.repo.clone_depth
45 elif self.repo.sync_depth is not None:
46 - git_cmd_opts += " --depth %d" % self.repo.sync_depth
47 + if self.repo.sync_depth != 0:
48 + git_cmd_opts += " --depth %d" % self.repo.sync_depth
49 + else:
50 + # default
51 + git_cmd_opts += " --depth 1"
52 if self.repo.module_specific_options.get('sync-git-clone-extra-opts'):
53 git_cmd_opts += " %s" % self.repo.module_specific_options['sync-git-clone-extra-opts']
54 git_cmd = "%s clone%s %s ." % (self.bin_command, git_cmd_opts,
55 --
56 2.10.2

Replies