public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/remote/
Date: Wed, 24 Jul 2013 09:54:20 +0000 (UTC)	[thread overview]
Message-ID: <1374659413.789651939ae2187e89403e6c09fa30a43026e126.dywi@gentoo> (raw)

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


             reply	other threads:[~2013-07-24  9:54 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24  9:54 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-01-26 17:41 [gentoo-commits] proj/R_overlay:master commit in: roverlay/remote/ André Erdmann
2014-02-16 16:45 André Erdmann
2014-02-15 19:49 André Erdmann
2014-02-15 19:49 André Erdmann
2014-02-15 19:49 André Erdmann
2013-09-03 13:15 André Erdmann
2013-09-03  8:35 André Erdmann
2013-09-02 16:21 André Erdmann
2013-08-29 15:08 André Erdmann
2013-08-07 16:10 André Erdmann
2013-08-07 16:10 André Erdmann
2013-07-24  9:54 André Erdmann
2013-07-24  9:54 André Erdmann
2013-07-23 14:57 André Erdmann
2013-07-23  9:38 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-23 14:57 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-23  9:38 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-23 14:57 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-16 16:35 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-16 16:36 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2012-08-13 18:07 André Erdmann
2012-08-11  0:01 André Erdmann
2012-08-10 15:16 André Erdmann
2012-08-10 15:16 André Erdmann
2012-08-09  9:26 André Erdmann
2012-08-02 15:14 André Erdmann
2012-08-01  7:33 André Erdmann
2012-07-31 17:51 André Erdmann
2012-07-09 17:25 André Erdmann
2012-07-06  8:15 André Erdmann
2012-07-04 18:21 André Erdmann
2012-07-04 18:21 André Erdmann
2012-07-03 17:48 André Erdmann
2012-06-27 14:46 André Erdmann
2012-06-26 15:55 André Erdmann
2012-06-26 15:42 André Erdmann
2012-06-25 18:19 André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374659413.789651939ae2187e89403e6c09fa30a43026e126.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox