public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2014-08-17 21:17 Devan Franchini
  2014-08-19  1:49 ` Devan Franchini
  0 siblings, 1 reply; 20+ messages in thread
From: Devan Franchini @ 2014-08-17 21:17 UTC (permalink / raw
  To: gentoo-commits

commit:     b00db4058fd0633378dc7082faf08a5ac0de013e
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 21:16:27 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 21:16:27 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b00db405

reposconf.py: Modifies options added if sync_type doesn't exist

To prevent future complaining from portage, the options added to the
repos.conf has been changed if the sync_type does not exist.

---
 layman/config_modules/reposconf/reposconf.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index b664276..344c779 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -30,7 +30,7 @@ try:
     from portage.sync.modules import layman_
     sync_type = "layman"
 except ImportError:
-    sync_type = "None"
+    sync_type = None
 
 from   layman.compatibility  import fileopen
 from   layman.utils          import path
@@ -89,9 +89,10 @@ class ConfigHandler:
         self.repo_conf.add_section(overlay.name)
         self.repo_conf.set(overlay.name, 'priority', str(overlay.priority))
         self.repo_conf.set(overlay.name, 'location', path((self.storage, overlay.name)))
-        self.repo_conf.set(overlay.name, 'sync-type', sync_type)
         self.repo_conf.set(overlay.name, 'layman-type', overlay.sources[0].type_key)
-        self.repo_conf.set(overlay.name, 'sync-uri', overlay.sources[0].src)
+        if sync_type:
+            self.repo_conf.set(overlay.name, 'sync-type', sync_type)
+            self.repo_conf.set(overlay.name, 'sync-uri', overlay.sources[0].src)
         if overlay.sources[0].branch:
             self.repo_conf.set(overlay.name, 'branch', overlay.sources[0].branch)
         self.repo_conf.set(overlay.name, 'auto-sync', self.config['auto_sync'])


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
  2014-08-17 21:17 Devan Franchini
@ 2014-08-19  1:49 ` Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2014-08-19  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     b00db4058fd0633378dc7082faf08a5ac0de013e
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 21:16:27 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 21:16:27 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b00db405

reposconf.py: Modifies options added if sync_type doesn't exist

To prevent future complaining from portage, the options added to the
repos.conf has been changed if the sync_type does not exist.

---
 layman/config_modules/reposconf/reposconf.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index b664276..344c779 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -30,7 +30,7 @@ try:
     from portage.sync.modules import layman_
     sync_type = "layman"
 except ImportError:
-    sync_type = "None"
+    sync_type = None
 
 from   layman.compatibility  import fileopen
 from   layman.utils          import path
@@ -89,9 +89,10 @@ class ConfigHandler:
         self.repo_conf.add_section(overlay.name)
         self.repo_conf.set(overlay.name, 'priority', str(overlay.priority))
         self.repo_conf.set(overlay.name, 'location', path((self.storage, overlay.name)))
-        self.repo_conf.set(overlay.name, 'sync-type', sync_type)
         self.repo_conf.set(overlay.name, 'layman-type', overlay.sources[0].type_key)
-        self.repo_conf.set(overlay.name, 'sync-uri', overlay.sources[0].src)
+        if sync_type:
+            self.repo_conf.set(overlay.name, 'sync-type', sync_type)
+            self.repo_conf.set(overlay.name, 'sync-uri', overlay.sources[0].src)
         if overlay.sources[0].branch:
             self.repo_conf.set(overlay.name, 'branch', overlay.sources[0].branch)
         self.repo_conf.set(overlay.name, 'auto-sync', self.config['auto_sync'])


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2014-08-28 22:01 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2014-08-28 22:01 UTC (permalink / raw
  To: gentoo-commits

commit:     1bf062247723f546500c59f60c8869c1b30a4e23
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 17:36:20 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 17:36:20 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1bf06224

reposconf.py: Adds check to write all ovelays to blank file

If a user has a blank repos.conf file then a check should be
make to ensure that the user has all his/her installed overlays
written to that repos.conf file.

---
 layman/config_modules/reposconf/reposconf.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 344c779..864e86b 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -109,7 +109,7 @@ class ConfigHandler:
         '''
         self.repo_conf.remove_section(overlay.name)
 
-        return self.write()
+        return self.write(delete=overlay.name)
 
 
     def disable(self, overlay):
@@ -162,7 +162,7 @@ class ConfigHandler:
         return self.write()
 
 
-    def write(self, disable=None):
+    def write(self, delete=None, disable=None):
         '''
         Writes changes from ConfigParser to /etc/portage/repos.conf/layman.conf.
 
@@ -171,6 +171,12 @@ class ConfigHandler:
         '''
         try:
             with fileopen(self.path, 'w') as laymanconf:
+                # If the repos.conf is empty check to see if we can write
+                # all the overlays to the file.
+                if not self.repo_conf.sections():
+                    for i in self.overlays:
+                        if not i == delete:
+                            self.add(self.overlays[i])
                 self.repo_conf.write(laymanconf)
             if disable:
                 # comments out section header of the overlay.


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2014-12-03 19:08 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2014-12-03 19:08 UTC (permalink / raw
  To: gentoo-commits

commit:     836937658fda4d42599f9123debcd45056123cb3
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 30 06:25:15 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Nov 30 06:25:15 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=83693765

reposconf.py: Fixes incorrectly named self.overlays variable

---
 layman/config_modules/reposconf/reposconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 864e86b..773c8e8 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -41,7 +41,7 @@ class ConfigHandler:
         
         self.config = config
         self.output = config['output']
-        self.overlay = {}
+        self.overlays = {}
         self.path = config['repos_conf']
         self.storage = config['storage']
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2014-12-08  4:15 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2014-12-08  4:15 UTC (permalink / raw
  To: gentoo-commits

commit:     ffd07c433041e63ded0f4b013038502984e56591
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  8 04:14:55 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Dec  8 04:14:55 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ffd07c43

reposconf.py: Modifies checking for sync-plugin to reflect new plugin name

---
 layman/config_modules/reposconf/reposconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 773c8e8..1810c5e 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -27,7 +27,7 @@ except:
     import ConfigParser
 
 try:
-    from portage.sync.modules import layman_
+    from portage.sync.modules import laymanator
     sync_type = "layman"
 except ImportError:
     sync_type = None


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-02 23:05 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-02 23:05 UTC (permalink / raw
  To: gentoo-commits

commit:     c3e142db9824a6bdf8a1e32a1af54a2195bd72ed
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  2 23:05:34 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Feb  2 23:05:34 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c3e142db

reposconf.py: Modifies sync type name to reflect plugin name

---
 layman/config_modules/reposconf/reposconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 1810c5e..e25160b 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -28,7 +28,7 @@ except:
 
 try:
     from portage.sync.modules import laymanator
-    sync_type = "layman"
+    sync_type = "laymanator"
 except ImportError:
     sync_type = None
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-03  2:43 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-03  2:43 UTC (permalink / raw
  To: gentoo-commits

commit:     1e62b8fc00bc8c3259fa88d1bd4375fcf9ff57b3
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  3 02:21:46 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Feb  3 02:21:46 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1e62b8fc

reposconf.py: Corrects declaration of self.overlays to overlays parameter

---
 layman/config_modules/reposconf/reposconf.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index e25160b..7336808 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -8,7 +8,7 @@
 #             Handles modifications to /etc/portage/repos.conf/layman.conf
 #
 # Copyright:
-#             (c) 2014 Devan Franchini
+#             (c) 2015 Devan Franchini
 #             Distributed under the terms of the GNU General Public License v2
 #
 # Author(s):
@@ -41,7 +41,7 @@ class ConfigHandler:
         
         self.config = config
         self.output = config['output']
-        self.overlays = {}
+        self.overlays = overlays
         self.path = config['repos_conf']
         self.storage = config['storage']
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-04 17:13 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-04 17:13 UTC (permalink / raw
  To: gentoo-commits

commit:     2094523aed86c80894bf97f7cc7366cda17f6154
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  4 17:13:40 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Feb  4 17:13:40 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2094523a

reposconf.py: Modifies disable function to reflect enabled overlay output

---
 layman/config_modules/reposconf/reposconf.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 75bdc6d..b843ca3 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -132,7 +132,12 @@ class ConfigHandler:
         self.repo_conf.set(overlay.name, '#date disabled', current_date)
         self.repo_conf.set(overlay.name, '#priority', str(overlay.priority))
         self.repo_conf.set(overlay.name, '#location', path((self.storage, overlay.name)))
-        self.repo_conf.set(overlay.name, '#sync-uri', overlay.sources[0].src)
+        self.repo_conf.set(overlay.name, '#layman-type', overlay.sources[0].type_key)
+        if sync_type:
+            self.repo_conf.set(overlay.name, '#sync_type', sync_type)
+            self.repo_conf.set(overlay.name, '#sync-uri', overlay.sources[0].src)
+        if overlay.sources[0].branch:
+            self.repo_conf.set(overlay.name, '#branch', overlay.sources[0].branch)
         if sync_type:
             self.repo_conf.set(overlay.name, '#auto-sync', self.config['auto_sync'])
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-04 17:13 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-04 17:13 UTC (permalink / raw
  To: gentoo-commits

commit:     e7e8ec72c7d23ec96f25b9b3a35c2c85b28f0b8d
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  4 17:10:25 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Feb  4 17:10:34 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e7e8ec72

reposconf.py: Adds check to see if it is necessary to add auto_sync to section

---
 layman/config_modules/reposconf/reposconf.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index b0a323c..75bdc6d 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -95,7 +95,8 @@ class ConfigHandler:
             self.repo_conf.set(overlay.name, 'sync-uri', overlay.sources[0].src)
         if overlay.sources[0].branch:
             self.repo_conf.set(overlay.name, 'branch', overlay.sources[0].branch)
-        self.repo_conf.set(overlay.name, 'auto-sync', self.config['auto_sync'])
+        if sync_type: #To maintain a desired structure, we have to do this check twice.
+            self.repo_conf.set(overlay.name, 'auto-sync', self.config['auto_sync'])
 
         return self.write()
 
@@ -132,7 +133,8 @@ class ConfigHandler:
         self.repo_conf.set(overlay.name, '#priority', str(overlay.priority))
         self.repo_conf.set(overlay.name, '#location', path((self.storage, overlay.name)))
         self.repo_conf.set(overlay.name, '#sync-uri', overlay.sources[0].src)
-        self.repo_conf.set(overlay.name, '#auto-sync', self.config['auto_sync'])
+        if sync_type:
+            self.repo_conf.set(overlay.name, '#auto-sync', self.config['auto_sync'])
 
         return self.write(disable=overlay.name)
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-04 17:19 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-04 17:19 UTC (permalink / raw
  To: gentoo-commits

commit:     f72c335348d5933f8d9e061cd0dab41b2b34bf73
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  4 17:19:19 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Feb  4 17:19:19 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f72c3353

reposconf.py: Imports sys for hexversion check

---
 layman/config_modules/reposconf/reposconf.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index b843ca3..cdf5dba 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -17,6 +17,7 @@
 
 import os
 import subprocess
+import sys
 import time
 
 if sys.hexversion >= 0x3000000:


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-04 17:58 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-04 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     9b3c6b3190df328d8a72e6cb6833b13a6819dbbb
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  4 17:55:25 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Feb  4 17:55:27 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=9b3c6b31

reposconf.py: Rewrites enable() and disable() functions

The enable() function was cleaned up and the doc string was improved to
reflect what the function actually does. The previous behavior of the
disable function was completely replaced in favor of being a wrapper for
the delete() function. The reasoning behind this is that previously the
function would simply "comment" out the section and its lines. This lead
to an issue where the config manager would no longer list the sections,
causing them to no longer be in the repos.conf file if the file was
rewritten to by layman for any reason. So commenting the sections out
was more work than needed anyway.

---
 layman/config_modules/reposconf/reposconf.py | 40 +++++-----------------------
 1 file changed, 6 insertions(+), 34 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index cdf5dba..4cb27f8 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -116,46 +116,22 @@ class ConfigHandler:
 
     def disable(self, overlay):
         '''
-        Disables a repos.conf entry.
+        A wrapper for the delete() function to comply with RepoConfManager class.
 
         @param overlay: layman.overlay.Overlay instance.
         @rtype boolean: reflects a successful/failed write to the config file.
         '''
-        if not self.repo_conf.has_section(overlay.name):
-            self.output.error('ReposConf: ConfigHandler.disable(); failed '\
-                              'to disable "%(repo)s". Section does not exist.'\
-                              % ({'repo': overlay.name}))
-            return False
-        self.repo_conf.remove_section(overlay.name)
-        current_date = time.strftime('%x') + ' | ' + time.strftime('%X')
-
-        self.repo_conf.add_section(overlay.name)
-        self.repo_conf.set(overlay.name, '#date disabled', current_date)
-        self.repo_conf.set(overlay.name, '#priority', str(overlay.priority))
-        self.repo_conf.set(overlay.name, '#location', path((self.storage, overlay.name)))
-        self.repo_conf.set(overlay.name, '#layman-type', overlay.sources[0].type_key)
-        if sync_type:
-            self.repo_conf.set(overlay.name, '#sync_type', sync_type)
-            self.repo_conf.set(overlay.name, '#sync-uri', overlay.sources[0].src)
-        if overlay.sources[0].branch:
-            self.repo_conf.set(overlay.name, '#branch', overlay.sources[0].branch)
-        if sync_type:
-            self.repo_conf.set(overlay.name, '#auto-sync', self.config['auto_sync'])
-
-        return self.write(disable=overlay.name)
+        return self.delete(overlay)
 
 
     def enable(self, overlay):
         '''
-        Enables a disabled repos.conf entry.
+        A wrapper for the add() function to comply with RepoConfManager class.
 
         @param overlay: layman.overlay.Overlay instance.
         @rtype boolean: reflects a successful/failed write to the config file.
         '''
-        self.repo_conf.remove_section(overlay.name)
-        success = self.add(overlay)
-
-        return success
+        return self.add(overlay)
 
 
     def update(self, overlay):
@@ -170,11 +146,11 @@ class ConfigHandler:
         return self.write()
 
 
-    def write(self, delete=None, disable=None):
+    def write(self, delete=None):
         '''
         Writes changes from ConfigParser to /etc/portage/repos.conf/layman.conf.
 
-        @params disable: overlay name to be disabled.
+        @params delete: overlay name to be delete from the config.
         @return boolean: represents a successful write.
         '''
         try:
@@ -186,10 +162,6 @@ class ConfigHandler:
                         if not i == delete:
                             self.add(self.overlays[i])
                 self.repo_conf.write(laymanconf)
-            if disable:
-                # comments out section header of the overlay.
-                subprocess.call(['sed', '-i', 's/^\[%(ovl)s\]/#[%(ovl)s]/'\
-                                 % {'ovl': disable}, self.path])
             return True
         except IOError as error:
             self.output.error('ReposConf: ConfigHandler.write(); Failed to write "'\


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-05  2:48 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-05  2:48 UTC (permalink / raw
  To: gentoo-commits

commit:     a8aee27d23032ac743d9fd55a2ed1c39a271ca43
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  5 02:48:33 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  5 02:48:33 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=a8aee27d

reposconf.py: Adds toggle for auto-sync if sync plugin is not installed

---
 layman/config_modules/reposconf/reposconf.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 4cb27f8..fa75dc6 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -98,6 +98,8 @@ class ConfigHandler:
             self.repo_conf.set(overlay.name, 'branch', overlay.sources[0].branch)
         if sync_type: #To maintain a desired structure, we have to do this check twice.
             self.repo_conf.set(overlay.name, 'auto-sync', self.config['auto_sync'])
+        else:
+            self.repo_conf.set(overlay.name, 'auto-sync', 'No')
 
         return self.write()
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-05  2:56 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-05  2:56 UTC (permalink / raw
  To: gentoo-commits

commit:     894c5faa1565b2abfc6a568a8bc865a85b385e30
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  5 02:56:28 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  5 02:56:28 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=894c5faa

reposconf.py: Changes sync_type to SYNC_TYPE to reflect global var standards

---
 layman/config_modules/reposconf/reposconf.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index fa75dc6..e61dfe0 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -29,9 +29,9 @@ else:
 
 try:
     from portage.sync.modules import laymanator
-    sync_type = "laymanator"
+    SYNC_TYPE = "laymanator"
 except ImportError:
-    sync_type = None
+    SYNC_TYPE = None
 
 from   layman.compatibility  import fileopen
 from   layman.utils          import path
@@ -91,12 +91,12 @@ class ConfigHandler:
         self.repo_conf.set(overlay.name, 'priority', str(overlay.priority))
         self.repo_conf.set(overlay.name, 'location', path((self.storage, overlay.name)))
         self.repo_conf.set(overlay.name, 'layman-type', overlay.sources[0].type_key)
-        if sync_type:
-            self.repo_conf.set(overlay.name, 'sync-type', sync_type)
+        if SYNC_TYPE:
+            self.repo_conf.set(overlay.name, 'sync-type', SYNC_TYPE)
             self.repo_conf.set(overlay.name, 'sync-uri', overlay.sources[0].src)
         if overlay.sources[0].branch:
             self.repo_conf.set(overlay.name, 'branch', overlay.sources[0].branch)
-        if sync_type: #To maintain a desired structure, we have to do this check twice.
+        if SYNC_TYPE: #To maintain a desired structure, we have to do this check twice.
             self.repo_conf.set(overlay.name, 'auto-sync', self.config['auto_sync'])
         else:
             self.repo_conf.set(overlay.name, 'auto-sync', 'No')


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-08  0:33 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-02-08  0:33 UTC (permalink / raw
  To: gentoo-commits

commit:     303f082bc23a2c0bee18ddbf81429d0bdc3613d8
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 00:32:50 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Feb  8 00:32:54 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=303f082b

reposconf.py: Changes global SYNC_TYPE variable to laymansync

Also deletion of laymansync after import.

---
 layman/config_modules/reposconf/reposconf.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index e61dfe0..5848796 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -28,8 +28,9 @@ else:
     import ConfigParser
 
 try:
-    from portage.sync.modules import laymanator
-    SYNC_TYPE = "laymanator"
+    from portage.sync.modules import laymansync
+    SYNC_TYPE = "laymansync"
+    del laymansync
 except ImportError:
     SYNC_TYPE = None
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-08  3:39 Brian Dolbec
  0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2015-02-08  3:39 UTC (permalink / raw
  To: gentoo-commits

commit:     1ea6a261a39e8bb6f5c9c6a5a55424b54fcddbf7
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 03:38:18 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Feb  8 03:38:18 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1ea6a261

config_modules/reposconf/reposconf.py: Sort the overlays

---
 layman/config_modules/reposconf/reposconf.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 5848796..8b678eb 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -40,7 +40,7 @@ from   layman.utils          import path
 class ConfigHandler:
 
     def __init__(self, config, overlays):
-        
+
         self.config = config
         self.output = config['output']
         self.overlays = overlays
@@ -58,7 +58,7 @@ class ConfigHandler:
         '''
         try:
             read_files = config.read(self.path)
-                
+
             if not read_files:
                 self.output.warn("Warning, not able to parse config file: %(path)s"\
                     % ({'path':self.path}))
@@ -161,7 +161,7 @@ class ConfigHandler:
                 # If the repos.conf is empty check to see if we can write
                 # all the overlays to the file.
                 if not self.repo_conf.sections():
-                    for i in self.overlays:
+                    for i in sorted(self.overlays):
                         if not i == delete:
                             self.add(self.overlays[i])
                 self.repo_conf.write(laymanconf)


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-17  5:07 Brian Dolbec
  0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2015-02-17  5:07 UTC (permalink / raw
  To: gentoo-commits

commit:     2302d24c36edd7135b038c6b1f845b2e48da96a5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 17 05:03:05 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Feb 17 05:06:08 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2302d24c

config_modules/reposconf.py: pyflakes import cleanup

---
 layman/config_modules/reposconf/reposconf.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 2b12d00..2227b35 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -16,9 +16,7 @@
 #
 
 import os
-import subprocess
 import sys
-import time
 
 if sys.hexversion >= 0x3000000:
     # Import for Python3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-02-17  5:07 Brian Dolbec
  0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2015-02-17  5:07 UTC (permalink / raw
  To: gentoo-commits

commit:     afece9a3634defccebd86d161d21e5475f3fea3c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 17 05:02:32 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Feb 17 05:06:08 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=afece9a3

config_modules/reposconf.py: Fix bug 540012 Errors /layman.conf does not exist

app-portage/layman-2.3.0 - ReposConf: ConfigHandler.read(); Failed to read "/etc/portage/repos.conf/layman.conf.

---
 layman/config_modules/reposconf/reposconf.py | 30 +++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 8b678eb..2b12d00 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -46,6 +46,8 @@ class ConfigHandler:
         self.overlays = overlays
         self.path = config['repos_conf']
         self.storage = config['storage']
+        self.repo_config = None
+        self.rebuild = False
 
         self.read()
 
@@ -73,21 +75,33 @@ class ConfigHandler:
         Reads the repos.conf config file from
         /etc/portage/repos.conf/layman.conf
         '''
+        self.repo_conf = ConfigParser.ConfigParser()
         if os.path.isfile(self.path):
-            self.repo_conf = ConfigParser.ConfigParser()
             self._read_config(self.repo_conf)
         else:
-            self.output.error('ReposConf: ConfigHandler.read(); Failed to read "'\
+            self.output.warn('ReposConf: ConfigHandler.read(); Failed to read "'\
                 '%(path)s".\nFile not found.' % ({'path': self.path}))
+            target_dir = os.path.split(os.path.realpath(self.path))[0]
+            if not os.path.isdir(target_dir):
+                self.output.info("Creating %s" % target_dir)
+                try:
+                    os.mkdir(target_dir,0o0755)
+                    self.rebuild = True
+                except OSError:
+                    raise
 
 
-    def add(self, overlay):
+    def add(self, overlay, no_write=False):
         '''
         Adds overlay information to the specified config file.
 
         @param overlay: layman.overlay.Overlay instance.
+        @param no_write: boolean default=False usedto prevent circular recursion
+            when add() is called from write()
         @return boolean: reflects a successful/failed write to the config file.
         '''
+        if self.repo_conf and self.repo_conf.has_section(overlay.name):
+            return
         self.repo_conf.add_section(overlay.name)
         self.repo_conf.set(overlay.name, 'priority', str(overlay.priority))
         self.repo_conf.set(overlay.name, 'location', path((self.storage, overlay.name)))
@@ -102,7 +116,9 @@ class ConfigHandler:
         else:
             self.repo_conf.set(overlay.name, 'auto-sync', 'No')
 
-        return self.write()
+        if not no_write:
+            return self.write()
+        return
 
 
     def delete(self, overlay):
@@ -160,11 +176,15 @@ class ConfigHandler:
             with fileopen(self.path, 'w') as laymanconf:
                 # If the repos.conf is empty check to see if we can write
                 # all the overlays to the file.
+                if self.rebuild:
+                    # start over with a fresh instance
+                    self.repo_conf = ConfigParser.ConfigParser()
                 if not self.repo_conf.sections():
                     for i in sorted(self.overlays):
                         if not i == delete:
-                            self.add(self.overlays[i])
+                            self.add(self.overlays[i], no_write=True)
                 self.repo_conf.write(laymanconf)
+                self.rebuild = False
             return True
         except IOError as error:
             self.output.error('ReposConf: ConfigHandler.write(); Failed to write "'\


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-03-25  0:44 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-03-25  0:44 UTC (permalink / raw
  To: gentoo-commits

commit:     1bc4917464546d512e28c93bd7c249b7ae571be8
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 25 00:41:29 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Mar 25 00:41:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=1bc49174

reposconf.py: Adds sanity checking on self.path

A function has been created to properly relay any issues with the sanity
of a specified repos_conf path.

X-Gentoo-Bug: 538324
X-Gentoo-Bug-URL: https://bugs.gentoo.org/538324

 layman/config_modules/reposconf/reposconf.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index 2227b35..d107f05 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -35,6 +35,21 @@ except ImportError:
 from   layman.compatibility  import fileopen
 from   layman.utils          import path
 
+def check_conf_path(conf_path):
+    dirname = os.path.dirname(conf_path)
+    msg     = ''
+
+    if not os.path.isdir(dirname):
+        msg = '%s is not a directory when it should be.' % dirname
+    elif not os.path.isfile(conf_path):
+        msg = '%s is not a file when it should be.' % conf_path
+
+    if msg:
+        raise OSError(msg)
+
+    return conf_path
+
+
 class ConfigHandler:
 
     def __init__(self, config, overlays):
@@ -42,7 +57,7 @@ class ConfigHandler:
         self.config = config
         self.output = config['output']
         self.overlays = overlays
-        self.path = config['repos_conf']
+        self.path = check_conf_path(config['repos_conf'])
         self.storage = config['storage']
         self.repo_config = None
         self.rebuild = False


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-03-25  1:13 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-03-25  1:13 UTC (permalink / raw
  To: gentoo-commits

commit:     02d71289ada4baefd412c9297eccb2408dfb94a2
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 25 01:09:21 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Mar 25 01:09:21 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=02d71289

reposconf.py: Adds check to prevent conf_path false negative

In the check_conf_path() function if the file did not previously
exist and you tried to write to the repos.conf file specified by
repos_conf it would generate a false negative declaring that
repos_conf is a directory when it should be a file. This is clearly
not the case and remedied by calling os.access () in conjunction with
os.path.isfile () prior to declaring that the target is a directory.

X-Gentoo-Bug: 538324
X-Gentoo-Bug-URL: https://bugs.gentoo.org/538324

 layman/config_modules/reposconf/reposconf.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index d107f05..a57c87e 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -41,7 +41,8 @@ def check_conf_path(conf_path):
 
     if not os.path.isdir(dirname):
         msg = '%s is not a directory when it should be.' % dirname
-    elif not os.path.isfile(conf_path):
+    elif (os.access(conf_path, os.R_OK | os.W_OK) and
+          not os.path.isfile(conf_path)):
         msg = '%s is not a file when it should be.' % conf_path
 
     if msg:


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/
@ 2015-04-20 17:12 Devan Franchini
  0 siblings, 0 replies; 20+ messages in thread
From: Devan Franchini @ 2015-04-20 17:12 UTC (permalink / raw
  To: gentoo-commits

commit:     155056d851373a3415faedc6c00faae04e9b48b1
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 20 17:11:25 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Mon Apr 20 17:11:29 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=155056d8

reposconf.py: Adds proper disabling of overlays when option is "ALL"

X-Gentoo-Bug: 546852
X-Gentoo-Bug-URL: https://bugs.gentoo.org/546852

 layman/config_modules/reposconf/reposconf.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py
index a57c87e..1f0fd04 100644
--- a/layman/config_modules/reposconf/reposconf.py
+++ b/layman/config_modules/reposconf/reposconf.py
@@ -194,9 +194,11 @@ class ConfigHandler:
                     # start over with a fresh instance
                     self.repo_conf = ConfigParser.ConfigParser()
                 if not self.repo_conf.sections():
-                    for i in sorted(self.overlays):
-                        if not i == delete:
-                            self.add(self.overlays[i], no_write=True)
+                    if ('disable' in self.config.keys() and not
+                        self.config['disable'][0].lower() == 'all'):
+                        for i in sorted(self.overlays):
+                            if not i == delete:
+                                self.add(self.overlays[i], no_write=True)
                 self.repo_conf.write(laymanconf)
                 self.rebuild = False
             return True


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2015-04-20 17:12 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-20 17:12 [gentoo-commits] proj/layman:master commit in: layman/config_modules/reposconf/ Devan Franchini
  -- strict thread matches above, loose matches on Subject: below --
2015-03-25  1:13 Devan Franchini
2015-03-25  0:44 Devan Franchini
2015-02-17  5:07 Brian Dolbec
2015-02-17  5:07 Brian Dolbec
2015-02-08  3:39 Brian Dolbec
2015-02-08  0:33 Devan Franchini
2015-02-05  2:56 Devan Franchini
2015-02-05  2:48 Devan Franchini
2015-02-04 17:58 Devan Franchini
2015-02-04 17:19 Devan Franchini
2015-02-04 17:13 Devan Franchini
2015-02-04 17:13 Devan Franchini
2015-02-03  2:43 Devan Franchini
2015-02-02 23:05 Devan Franchini
2014-12-08  4:15 Devan Franchini
2014-12-03 19:08 Devan Franchini
2014-08-28 22:01 Devan Franchini
2014-08-17 21:17 Devan Franchini
2014-08-19  1:49 ` Devan Franchini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox