public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/grss:master commit in: /, grs/
@ 2015-07-05 12:10 Anthony G. Basile
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile @ 2015-07-05 12:10 UTC (permalink / raw
  To: gentoo-commits

commit:     e3c23c8ed8ac697a9a8fccf8edc5ef850f6a94ac
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  5 12:12:34 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul  5 12:12:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=e3c23c8e

clean-worldconf: remove try-except and fix typo.

 clean-worldconf  | 4 +---
 grs/WorldConf.py | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/clean-worldconf b/clean-worldconf
index 1fd5da3..2e76f57 100755
--- a/clean-worldconf
+++ b/clean-worldconf
@@ -7,10 +7,8 @@ from grs import WorldConf
 
 def main():
     WorldConf.clean()
-    try:
+    if os.path.isfile(CONST.PORTAGE_DIRTYFILE):
         os.remove(CONST.PORTAGE_DIRTYFILE)
-    except (FileNotFoundError, IsADirectoryError):
-        pass
 
 if __name__ == "__main__":
     main()

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index b9e9be9..481d3a3 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -98,7 +98,7 @@ class WorldConf():
                     continue
 
         fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env')
-        if os.path.isile(fpath):
+        if os.path.isfile(fpath):
             update = False
             with open(fpath, 'r') as g:
                 lines = g.readlines()


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

* [gentoo-commits] proj/grss:master commit in: /, grs/
@ 2015-07-05 15:37 Anthony G. Basile
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile @ 2015-07-05 15:37 UTC (permalink / raw
  To: gentoo-commits

commit:     367f271f463e16515aee0a31d59001cc4fac5008
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  5 15:39:47 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul  5 15:39:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=367f271f

grs/WorldConf.py: remove decorated package.env.

 grs/WorldConf.py | 46 ++++++----------------------------------------
 grsup            |  4 ++--
 2 files changed, 8 insertions(+), 42 deletions(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index 481d3a3..f20609b 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -20,22 +20,11 @@ class WorldConf():
         """
         try:
             for (f, v) in config[s].items():
-                # a '+' at the beginging means append to the file
-                undecorated_f = re.sub('^\+', '', f)
-
-                filepath = os.path.join(portage_confdir, undecorated_f)
+                filepath = os.path.join(portage_confdir, f)
                 dirpath  = os.path.dirname(filepath)
                 os.makedirs(dirpath, mode=0o755, exist_ok=True)
-                if f == undecorated_f or not os.path.exists(filepath):
-                    with open(filepath, 'w') as g:
-                        g.write('%s\n' % v)
-                else:
-                    with open(filepath, 'r+') as g:
-                        for l in g.readlines():
-                            if v == l.strip():
-                                break
-                        else:
-                            g.write('%s\n' % v)
+                with open(filepath, 'w') as g:
+                    g.write('%s\n' % v)
         except KeyError:
             pass
 
@@ -78,39 +67,16 @@ class WorldConf():
                 slot = slotvar
             slot_atoms.append(re.sub('[/:]', '_', '%s:%s' % (p, slot)))
 
-        env_slot_atoms = []
         for dirpath, dirnames, filenames in os.walk(CONST.PORTAGE_CONFIGDIR):
             # Only look at select files and directories.
             # TODO: This needs to be expanded.
-            skip = True
-            for p in ['env', 'package.accept_keywords', 'package.use', 'package.mask', 'package.unmask']:
-                if os.path.basename(dirpath) == p:
-                    skip = False
-            if skip:
+            if not os.path.basename(dirpath) in ['env', 'package.env', \
+                    'package.accept_keywords', 'package.use', 'package.mask', \
+                    'package.unmask']:
                 continue
 
             for f in filenames:
                 fpath = os.path.realpath(os.path.join(dirpath, f))
                 if f in slot_atoms:
                     os.remove(fpath)
-                    if os.path.basename(dirpath) == 'env':
-                        env_slot_atoms.append(f)
                     continue
-
-        fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env')
-        if os.path.isfile(fpath):
-            update = False
-            with open(fpath, 'r') as g:
-                lines = g.readlines()
-                mylines = copy.deepcopy(lines)
-                for l in lines:
-                    for slot_atom in env_slot_atoms:
-                        if re.search(re.escape(slot_atom), l):
-                            try:
-                                mylines.remove(l)
-                                update = True
-                            except ValueError:
-                                pass
-            if update:
-                with open(fpath, 'w') as g:
-                    g.writelines(mylines)

diff --git a/grsup b/grsup
index 69decfc..57029a7 100755
--- a/grsup
+++ b/grsup
@@ -18,7 +18,7 @@ from grs import WorldConf
 
 from _emerge.main import emerge_main, parse_opts
 from portage.exception import IsADirectory, ParseError, PermissionDenied
-from portage import setting
+from portage import settings
 
 
 def install_kernel(version = 'latest', logfile = CONST.LOGFILE):
@@ -38,7 +38,7 @@ def install_kernel(version = 'latest', logfile = CONST.LOGFILE):
         def get_kernels(self):
             return self.kernels
 
-    baseurl = setting['PORTAGE_BINHOST']
+    baseurl = settings['PORTAGE_BINHOST']
     if baseurl == '':
         print('PORTAGE_BINHOST is not set.  Install kernel manually.')
         return


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

end of thread, other threads:[~2015-07-05 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-05 12:10 [gentoo-commits] proj/grss:master commit in: /, grs/ Anthony G. Basile
  -- strict thread matches above, loose matches on Subject: below --
2015-07-05 15:37 Anthony G. Basile

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