From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-611918-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 7301D138202
	for <garchives@archives.gentoo.org>; Wed, 24 Jul 2013 09:54:27 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id AD09FE0A5D;
	Wed, 24 Jul 2013 09:54:25 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id DC92DE0A5A
	for <gentoo-commits@lists.gentoo.org>; Wed, 24 Jul 2013 09:54:24 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id A08FC33E4D4
	for <gentoo-commits@lists.gentoo.org>; Wed, 24 Jul 2013 09:54:23 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id C4DEEE5466
	for <gentoo-commits@lists.gentoo.org>; Wed, 24 Jul 2013 09:54:20 +0000 (UTC)
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" <dywi@mailerd.de>
Message-ID: <1374659413.789651939ae2187e89403e6c09fa30a43026e126.dywi@gentoo>
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/remote/
X-VCS-Repository: proj/R_overlay
X-VCS-Files: roverlay/remote/basicrepo.py roverlay/remote/status.py
X-VCS-Directories: roverlay/remote/
X-VCS-Committer: dywi
X-VCS-Committer-Name: André Erdmann
X-VCS-Revision: 789651939ae2187e89403e6c09fa30a43026e126
X-VCS-Branch: master
Date: Wed, 24 Jul 2013 09:54:20 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 9c066904-5337-4483-83d2-0bc4a08c4c75
X-Archives-Hash: 0c9fcc931a44fa21b7cdd5ae053609ee

commit:     789651939ae2187e89403e6c09fa30a43026e126
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 24 09:50:13 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 24 09:50:13 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=78965193

roverlay/remote: more accurate (no)sync logging

---
 roverlay/remote/basicrepo.py | 37 +++++++++++++++++++++++++++++--------
 roverlay/remote/status.py    | 10 ++++++++++
 2 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/roverlay/remote/basicrepo.py b/roverlay/remote/basicrepo.py
index 33d8f30..b126f9b 100644
--- a/roverlay/remote/basicrepo.py
+++ b/roverlay/remote/basicrepo.py
@@ -13,15 +13,18 @@ import logging
 
 from roverlay.packageinfo import PackageInfo
 
+from . import status
+
+
 URI_SEPARATOR = '://'
 DEFAULT_PROTOCOL = 'http'
 
 LOCALREPO_SRC_URI = 'http://localhost/R-Packages'
 
-SYNC_SUCCESS = 1
-SYNC_FAIL    = 2
-SYNC_DONE    = SYNC_SUCCESS | SYNC_FAIL
-REPO_READY   = 4
+SYNC_SUCCESS = status.SYNC_SUCCESS
+SYNC_FAIL    = status.SYNC_FAIL
+SYNC_DONE    = status.SYNC_DONE
+REPO_READY   = status.REPO_READY
 
 def normalize_uri ( uri, protocol, force_protocol=False ):
    """Returns an uri that is prefixed by its protocol ('http://', ...).
@@ -84,15 +87,20 @@ class BasicRepo ( object ):
       else:
          self.src_uri = src_uri
 
-      self.sync_status = 0
-
       if remote_uri is not None:
          self.is_remote  = True
          self.remote_uri = remote_uri
       else:
          self.is_remote  = is_remote
+
+
+      self.sync_status = 0
    # --- end of __init__ (...) ---
 
+   def reset ( self ):
+      self.sync_status = 0
+   # --- end of reset (...) ---
+
    def ready ( self ):
       """Returns True if this repo is ready (for package scanning using
       scan_distdir).
@@ -192,20 +200,33 @@ class BasicRepo ( object ):
       """Syncs this repo."""
 
       status = False
-      print ( "Syncing {!r} ...".format ( self.name ) )
 
       if sync_enabled and hasattr ( self, '_dosync' ):
+         print ( "Syncing {!r} ...".format ( self.name ) )
          status = self._dosync()
 
       elif hasattr ( self, '_nosync'):
+         self.logger.debug ( "calling repo-specific nosync() method." )
          status = self._nosync()
 
+      elif self.exists():
+         self.logger.info ( "directory {!r} exists".format ( self.distdir ) )
+         status = True
       else:
-         status = self.exists()
+         self.logger.warning (
+            "directory {!r} does not exist".format ( self.distdir )
+         )
+         status = False
 
       if status:
+         self.logger.debug (
+            "sync(online={}) succeeded.".format ( sync_enabled )
+         )
          self._set_ready ( is_synced=sync_enabled )
       else:
+         self.logger.info (
+            "sync(online{}) failed.".format ( sync_enabled )
+         )
          self._set_fail()
 
       return status

diff --git a/roverlay/remote/status.py b/roverlay/remote/status.py
new file mode 100644
index 0000000..7caa896
--- /dev/null
+++ b/roverlay/remote/status.py
@@ -0,0 +1,10 @@
+# R overlay -- remote, status codes
+# -*- coding: utf-8 -*-
+# Copyright (C) 2013 André Erdmann <dywi@mailerd.de>
+# Distributed under the terms of the GNU General Public License;
+# either version 2 of the License, or (at your option) any later version.
+
+SYNC_SUCCESS = 1
+SYNC_FAIL    = 2
+SYNC_DONE    = SYNC_SUCCESS | SYNC_FAIL
+REPO_READY   = 4