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

commit:     cc5128c7066d712a8f532ce33b6917a265f7c7e0
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  1 12:25:57 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  1 12:25:57 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=cc5128c7

grs/Interpret.py: remove excessive try-except block.

 grs/Interpret.py | 160 +++++++++++++++++++++++++++----------------------------
 1 file changed, 78 insertions(+), 82 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 8cef40e..6525c9e 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -109,92 +109,88 @@ class Interpret(Daemon):
             stampit(progress)
 
         build_script = os.path.join(libdir, 'build')
-        try:
-            with open(build_script, 'r') as s:
-                line_number = 0
-                for l in s.readlines():
-                    line_number += 1
-
-                    # For a release run, execute every line of the build script.
-                    # For an update run, exexute only lines with a leading +.
-                    ignore_stamp = False
-                    m = re.search('^(\+)(.*)$', l)
-                    if m:
-                        # There is a leading +, so remove it and skip if doing an update run
-                        ignore_stamp = self.update_run
-                        l = m.group(2)
-                    else:
-                        # There is no leading +, so skip if this is an update run
-                        if self.update_run:
-                            continue
-
-                    progress = os.path.join(tmpdir, '.completed_%02d' % line_number)
-                    if os.path.exists(progress) and not ignore_stamp:
+        with open(build_script, 'r') as s:
+            line_number = 0
+            for l in s.readlines():
+                line_number += 1
+
+                # For a release run, execute every line of the build script.
+                # For an update run, exexute only lines with a leading +.
+                ignore_stamp = False
+                m = re.search('^(\+)(.*)$', l)
+                if m:
+                    # There is a leading +, so remove it and skip if doing an update run
+                    ignore_stamp = self.update_run
+                    l = m.group(2)
+                else:
+                    # There is no leading +, so skip if this is an update run
+                    if self.update_run:
                         continue
 
-                    try:
-                        m = re.search('(\S+)\s+(\S+)', l)
-                        verb = m.group(1)
-                        obj  = m.group(2)
-                    except AttributeError:
-                        verb = l.strip()
-                        obj = None
+                progress = os.path.join(tmpdir, '.completed_%02d' % line_number)
+                if os.path.exists(progress) and not ignore_stamp:
+                    continue
+
+                try:
+                    m = re.search('(\S+)\s+(\S+)', l)
+                    verb = m.group(1)
+                    obj  = m.group(2)
+                except AttributeError:
+                    verb = l.strip()
+                    obj = None
 
-                    if verb == '':
+                if verb == '':
+                    stampit(progress)
+                    continue
+                if verb == 'log':
+                    if smartlog(l, obj):
                         stampit(progress)
                         continue
-                    if verb == 'log':
-                        if smartlog(l, obj):
-                            stampit(progress)
-                            continue
-                        if obj == 'stamp':
-                            lo.log('='*80)
-                        else:
-                            lo.log(obj)
-                    elif verb == 'mount':
-                        if smartlog(l, obj, False):
-                            stampit(progress)
-                            continue
-                        md.mount_all()
-                    elif verb == 'unmount':
-                        if smartlog(l, obj, False):
-                            stampit(progress)
-                            continue
-                        md.umount_all()
-                    elif verb == 'populate':
-                        if smartlog(l, obj):
-                            stampit(progress)
-                            continue
-                        po.populate(cycle=int(obj))
-                    elif verb == 'runscript':
-                        if smartlog(l, obj):
-                            stampit(progress)
-                            continue
-                        ru.runscript(obj)
-                    elif verb == 'clean':
-                        if smartlog(l, obj, False):
-                            stampit(progress)
-                            continue
-                        po.clean()
-                    elif verb == 'kernel':
-                        if smartlog(l, obj, False):
-                            stampit(progress)
-                            continue
-                        ke.kernel()
-                    elif verb == 'tarit':
-                        if smartlog(l, obj, False):
-                            stampit(progress)
-                            continue
-                        bi.tarit()
-                    elif verb == 'hashit':
-                        if smartlog(l, obj, False):
-                            stampit(progress)
-                            continue
-                        bi.hashit()
+                    if obj == 'stamp':
+                        lo.log('='*80)
                     else:
-                        lo.log('Bad command: %s' % l)
-
-                    stampit(progress)
+                        lo.log(obj)
+                elif verb == 'mount':
+                    if smartlog(l, obj, False):
+                        stampit(progress)
+                        continue
+                    md.mount_all()
+                elif verb == 'unmount':
+                    if smartlog(l, obj, False):
+                        stampit(progress)
+                        continue
+                    md.umount_all()
+                elif verb == 'populate':
+                    if smartlog(l, obj):
+                        stampit(progress)
+                        continue
+                    po.populate(cycle=int(obj))
+                elif verb == 'runscript':
+                    if smartlog(l, obj):
+                        stampit(progress)
+                        continue
+                    ru.runscript(obj)
+                elif verb == 'clean':
+                    if smartlog(l, obj, False):
+                        stampit(progress)
+                        continue
+                    po.clean()
+                elif verb == 'kernel':
+                    if smartlog(l, obj, False):
+                        stampit(progress)
+                        continue
+                    ke.kernel()
+                elif verb == 'tarit':
+                    if smartlog(l, obj, False):
+                        stampit(progress)
+                        continue
+                    bi.tarit()
+                elif verb == 'hashit':
+                    if smartlog(l, obj, False):
+                        stampit(progress)
+                        continue
+                    bi.hashit()
+                else:
+                    lo.log('Bad command: %s' % l)
 
-        except FileNotFoundError:
-            lo.log('Failed to open build script: %s' % build_script)
+                stampit(progress)


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

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

commit:     c8666db91ce157680ff66628868a637f0c27b067
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  1 12:32:48 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  1 12:32:48 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=c8666db9

grs/Kernel.py: don't fail if kernel image dir exists.

 grs/Kernel.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index ddae884..7dd76fa 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -51,7 +51,7 @@ class Kernel():
 
         # Remove any old image directory and create a boot directory
         # wich genkernel assumes is present.
-        shutil.rmtree(image_dir)
+        shutil.rmtree(image_dir, ignore_errors=True)
         os.makedirs(boot_dir, mode=0o755, exist_ok=True)
 
         cmd = 'emerge --nodeps -1n %s' % pkg_name


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

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

commit:     b07cf871939ce5dfea8e8a145ebca39c95e07439
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  1 16:08:11 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  1 16:08:11 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b07cf871

Clean up makedirs().

makedirs() exist_ok=True.  Use it to avoid FileExistsError.  We
are now logging exceptions vi stderr in Daemon.py, so let exceptions
propagate up for debugging.

 grs/Kernel.py           | 3 ++-
 grs/Log.py              | 5 +----
 grs/MountDirectories.py | 6 ++----
 grs/Populate.py         | 5 +----
 grs/Seed.py             | 5 +++--
 5 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 7dd76fa..16d2247 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -96,7 +96,8 @@ class Kernel():
 
         cwd = os.getcwd()
         os.chdir(image_dir)
-        os.unlink(tarball_path)
+        if os.path.isfile(tarball_path):
+            os.unlink(tarball_path)
         cmd = 'tar -Jcf %s .' % tarball_path
         Execute(cmd, timeout=600, logfile=self.logfile)
         os.chdir(cwd)

diff --git a/grs/Log.py b/grs/Log.py
index 91141e8..2a7ef9d 100644
--- a/grs/Log.py
+++ b/grs/Log.py
@@ -11,10 +11,7 @@ class Log():
 
     def __init__(self, logfile = CONST.LOGFILE):
         self.logfile = logfile
-        try:
-            os.makedirs(os.path.dirname(self.logfile))
-        except FileExistsError:
-            pass
+        os.makedirs(os.path.dirname(self.logfile), exist_ok=True)
         open(self.logfile, 'a').close()
 
 

diff --git a/grs/MountDirectories.py b/grs/MountDirectories.py
index 43cd91a..16edc32 100644
--- a/grs/MountDirectories.py
+++ b/grs/MountDirectories.py
@@ -83,8 +83,7 @@ class MountDirectories():
                 # Here source_directory is assumet to be an abspath
                 # and we create it if it doesn't exist
                 source_directory = mount[0]
-                if not os.path.isdir(source_directory):
-                    os.makedirs(source_directory)
+                os.makedirs(source_directory, mode=0o755, exist_ok=True)
                 target_directory = mount[1]
             elif isinstance(mount, dict):
                 tmp = list(mount.values())
@@ -94,8 +93,7 @@ class MountDirectories():
                 tmp = list(mount.keys())
                 target_directory = tmp[0]
             target_directory = os.path.join(self.portage_configroot, target_directory)
-            if not os.path.isdir(target_directory):
-                os.makedirs(target_directory)
+            os.makedirs(target_directory, mode=0o755, exist_ok=True)
             if isinstance(mount, str):
                 cmd = 'mount --bind /%s %s' % (source_directory, target_directory)
             elif isinstance(mount, list):

diff --git a/grs/Populate.py b/grs/Populate.py
index 504283c..75b7ed8 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -34,10 +34,7 @@ class Populate():
         Execute(cmd, timeout=60, logfile = self. logfile)
 
         # Add any extra files
-        try:
-            os.makedirs(self.etc)
-        except FileExistsError:
-            pass
+        os.makedirs(self.etc, mode=0o755, exist_ok=True)
         with open(self.resolv_conf, 'w') as f:
             f.write('nameserver %s' % self.nameserver)
 

diff --git a/grs/Seed.py b/grs/Seed.py
index 0da8354..76034cc 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -50,8 +50,9 @@ class Seed():
             if os.path.isdir(directory):
                 shutil.move(directory, '%s.0' % directory)
             # Now that all prevous directory are out of the way,
-            # create a new empty directory
-            os.makedirs(directory)
+            # create a new empty directory.  Fail if the directory
+            # is still around.
+            os.makedirs(directory, mode=0o755, exist_ok=False)
 
         # Download a stage tarball if we don't have one
         if not os.path.isfile(self.filepath):


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

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

commit:     453e36867eb79ec1989f241caf15552c04b49de4
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  1 16:54:27 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  1 16:54:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=453e3686

Clean up more exceptions.

 grs/Execute.py  | 12 ++++++------
 grs/Populate.py | 11 +++--------
 grs/Seed.py     | 13 +++----------
 3 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 533d269..15fe562 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -19,17 +19,17 @@ class Execute():
             pid = os.getpid()
             f.write('SENDING SIGTERM to pid = %d\n' % pid)
             f.close()
-            os.kill(pid, signal.SIGTERM)
+            try:
+                os.kill(pid, signal.SIGTERM)
+                os.kill(pid, signal.SIGKILL)
+            except ProcessLookupError:
+                pass
 
         f = open(logfile, 'a')
         args = shlex.split(cmd)
         extra_env = dict(os.environ, **extra_env)
 
-        try:
-            proc = subprocess.Popen(args, stdout=f, stderr=f, env=extra_env)
-        except FileNotFoundError:
-            f.write('Illegal cmd %s\n' % cmd)
-            signalexit()
+        proc = subprocess.Popen(args, stdout=f, stderr=f, env=extra_env)
 
         try:
             proc.wait(timeout)

diff --git a/grs/Populate.py b/grs/Populate.py
index 75b7ed8..f01c424 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -68,23 +68,18 @@ class Populate():
 
     def clean_subdirs(self, dirpath):
         path = os.path.join(self.portage_configroot, dirpath)
-        try:
+        if os.path.isdir(path)
             uid = os.stat(path).st_uid
             gid = os.stat(path).st_gid
             mode = os.stat(path).st_mode
             shutil.rmtree(path)
-            os.mkdir(path)
+            os.makedirs(path, mode=mode, exist_ok=False)
             os.chown(path, uid, gid)
-            os.chmod(path, mode)
-        except FileNotFoundError:
-            pass
 
 
     def clean(self):
         self.clean_subdirs('tmp')
         self.clean_subdirs('var/tmp')
         self.clean_subdirs('var/log')
-        try:
+        if os.path.isfile(self.resolv_conf):
             os.unlink(self.resolv_conf)
-        except FileNotFoundError:
-            pass

diff --git a/grs/Seed.py b/grs/Seed.py
index 76034cc..4ac95ed 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -56,16 +56,9 @@ class Seed():
 
         # Download a stage tarball if we don't have one
         if not os.path.isfile(self.filepath):
-            try:
-                request = urllib.request.urlopen(self.stage_uri)
-                with open(self.filepath, 'wb') as f:
-                    shutil.copyfileobj(request, f)
-            except: #any exception will do here
-                pid = os.getpid()
-                with open(self.logfile, 'r') as f:
-                    f.write('SENDING SIGTERM to pid = %d\n' % pid)
-                    f.close()
-                os.kill(pid, signal.SIGTERM)
+            request = urllib.request.urlopen(self.stage_uri)
+            with open(self.filepath, 'wb') as f:
+                shutil.copyfileobj(request, f)
 
         # Because python's tarfile sucks
         cmd = 'tar --xattrs -xf %s -C %s' % (self.filepath, self.portage_configroot)


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

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

commit:     8ef13ec8d489f876c4c335e0982d7acfe151a222
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  1 16:55:30 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  1 16:55:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=8ef13ec8

grs/WorldConf.py: clean up variable name.

 grs/WorldConf.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index ba683cd..d8140d8 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -14,7 +14,7 @@ class WorldConf():
     """
 
     @staticmethod
-    def conf2file(config, s, portage_dir):
+    def conf2file(config, s, portage_confdir):
         """ doc here
             more doc
         """
@@ -23,7 +23,7 @@ class WorldConf():
                 # a '+' at the beginging means append to the file
                 undecorated_f = re.sub('^\+', '', f)
 
-                filepath = os.path.join(portage_dir, undecorated_f)
+                filepath = os.path.join(portage_confdir, undecorated_f)
                 dirpath  = os.path.dirname(filepath)
                 os.makedirs(dirpath, mode=0o755, exist_ok=True)
                 if f == undecorated_f or not os.path.exists(filepath):
@@ -49,7 +49,7 @@ class WorldConf():
         config.read(CONST.WORLD_CONFIG)
 
         for s in config.sections():
-            WorldConf.conf2file(config, s, portage_dir=CONST.PORTAGE_CONFIGDIR)
+            WorldConf.conf2file(config, s, portage_confdir=CONST.PORTAGE_CONFIGDIR)
 
 
     @staticmethod


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

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

commit:     90ffd325f399934e455af5c836872cf644b49489
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  1 17:05:39 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  1 17:05:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=90ffd325

grs/Populate.py: fix syntax error.

 grs/Populate.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Populate.py b/grs/Populate.py
index f01c424..0271e74 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -68,7 +68,7 @@ class Populate():
 
     def clean_subdirs(self, dirpath):
         path = os.path.join(self.portage_configroot, dirpath)
-        if os.path.isdir(path)
+        if os.path.isdir(path):
             uid = os.stat(path).st_uid
             gid = os.stat(path).st_gid
             mode = os.stat(path).st_mode


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

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

commit:     0a3e35dd7541373d888528ace693408463831d15
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  1 17:29:39 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  1 17:29:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=0a3e35dd

grs/MountDirectories.py: fix minor typo.

 grs/MountDirectories.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/MountDirectories.py b/grs/MountDirectories.py
index 16edc32..737daf0 100644
--- a/grs/MountDirectories.py
+++ b/grs/MountDirectories.py
@@ -80,7 +80,7 @@ class MountDirectories():
                 source_directory = mount
                 target_directory = mount
             elif isinstance(mount, list):
-                # Here source_directory is assumet to be an abspath
+                # Here source_directory is assumed to be an abspath
                 # and we create it if it doesn't exist
                 source_directory = mount[0]
                 os.makedirs(source_directory, mode=0o755, exist_ok=True)


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

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

commit:     10a308cef6fecb1d8e3b4ffd932f79d5020bec85
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  2 22:32:51 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Jul  2 22:32:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=10a308ce

Daemon.py: add kudos.

 grs/Daemon.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/grs/Daemon.py b/grs/Daemon.py
index 8fed2a1..15290a5 100644
--- a/grs/Daemon.py
+++ b/grs/Daemon.py
@@ -9,6 +9,8 @@ import time
 class Daemon:
     """ doc here
         more doc
+        Adopted from Sander Marechal's "A simple unix/linux daemon in Python"
+        See: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
     """
 
     def __init__(self, pidfile, **kwargs):
@@ -41,7 +43,7 @@ class Daemon:
             sys.stderr.write('fork #2 failed %s\n' % err)
             sys.exit(1)
 
-        # Close stdin, and redirect both stdout and stderr to grs-daemon-<pid>.err
+        # Dup stdin to /dev/null, and stdout and stderr to grs-daemon-<pid>.err
         si = open(os.devnull, 'r')
         os.dup2(si.fileno(), sys.stdin.fileno())
 


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

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

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

grs/WorldConf.py: make sure package.env exists.

 grs/WorldConf.py | 41 +++++++++++++++++++----------------------
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index d8140d8..b9e9be9 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -65,9 +65,7 @@ class WorldConf():
             try:
                 uninstalled.remove(p)
             except ValueError:
-                # These packages are installed on the local system
-                # but not in the portage tree anymore.
-                print(p)
+                print('%s installed on local system, but not in portage repo anymore.' % p)
 
         slot_atoms = []
         for p in uninstalled:
@@ -83,11 +81,9 @@ class WorldConf():
         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 as we come up
-            # with a central class to deal with the internal
-            # structure of /etc/portage.
+            # TODO: This needs to be expanded.
             skip = True
-            for p in ['env', 'package.accept_keywords', 'package.use']:
+            for p in ['env', 'package.accept_keywords', 'package.use', 'package.mask', 'package.unmask']:
                 if os.path.basename(dirpath) == p:
                     skip = False
             if skip:
@@ -102,18 +98,19 @@ class WorldConf():
                     continue
 
         fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, 'package.env')
-        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)
+        if os.path.isile(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)


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

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

commit:     7ef9c7af8d8043d659ff5024ed4f09725a0d4c77
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  5 16:51:33 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul  5 16:51:33 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=7ef9c7af

grs/WorldConf.py: cleanup for new world.conf structure.

 grs/WorldConf.py | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index f20609b..f9eefe8 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -14,31 +14,20 @@ class WorldConf():
     """
 
     @staticmethod
-    def conf2file(config, s, portage_confdir):
-        """ doc here
-            more doc
-        """
-        try:
-            for (f, v) in config[s].items():
-                filepath = os.path.join(portage_confdir, f)
-                dirpath  = os.path.dirname(filepath)
-                os.makedirs(dirpath, mode=0o755, exist_ok=True)
-                with open(filepath, 'w') as g:
-                    g.write('%s\n' % v)
-        except KeyError:
-            pass
-
-
-    @staticmethod
     def install():
         """ doc here
             more doc
         """
         config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None)
         config.read(CONST.WORLD_CONFIG)
-
         for s in config.sections():
-            WorldConf.conf2file(config, s, portage_confdir=CONST.PORTAGE_CONFIGDIR)
+            for (directory, value) in config[s].items():
+                p_slot_atom = re.sub('[/:]', '_', s)
+                fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, '%s/%s' % (directory, p_slot_atom))
+                dpath  = os.path.dirname(fpath)
+                os.makedirs(dpath, mode=0o755, exist_ok=True)
+                with open(fpath, 'w') as g:
+                    g.write('%s\n' % value)
 
 
     @staticmethod
@@ -71,12 +60,11 @@ class WorldConf():
             # Only look at select files and directories.
             # TODO: This needs to be expanded.
             if not os.path.basename(dirpath) in ['env', 'package.env', \
-                    'package.accept_keywords', 'package.use', 'package.mask', \
-                    'package.unmask']:
+                    '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)
-                    continue


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

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

commit:     d4c28761646b141bd6bd7a75524be82b8989ac9e
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  6 18:16:17 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jul  6 18:16:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=d4c28761

WorldConf.py: clean up code a bit.

 grs/WorldConf.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index f9eefe8..b102e7d 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -23,8 +23,8 @@ class WorldConf():
         for s in config.sections():
             for (directory, value) in config[s].items():
                 p_slot_atom = re.sub('[/:]', '_', s)
-                fpath = os.path.join(CONST.PORTAGE_CONFIGDIR, '%s/%s' % (directory, p_slot_atom))
-                dpath  = os.path.dirname(fpath)
+                dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory)
+                fpath = os.path.join(dpath, p_slot_atom)
                 os.makedirs(dpath, mode=0o755, exist_ok=True)
                 with open(fpath, 'w') as g:
                     g.write('%s\n' % value)


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

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

commit:     12dbe651f71a92b4210642204276ea8e5d8fd2ea
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  6 20:16:13 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jul  6 20:16:13 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=12dbe651

grs/Populate.py: fix clean_subdirs.

 grs/Populate.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/grs/Populate.py b/grs/Populate.py
index 0271e74..b9c2323 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -73,8 +73,9 @@ class Populate():
             gid = os.stat(path).st_gid
             mode = os.stat(path).st_mode
             shutil.rmtree(path)
-            os.makedirs(path, mode=mode, exist_ok=False)
+            os.mkdir(path)
             os.chown(path, uid, gid)
+            os.chmod(path, mode)
 
 
     def clean(self):


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

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

commit:     3db7628eb5a3c05e0b11d346b2f8dad4da56136a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 02:19:59 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 02:19:59 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=3db7628e

grs/PivotChroot.py: introduce 'pivot' directive.

 grs/Interpret.py   |  6 ++++++
 grs/PivotChroot.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 6525c9e..8b1166b 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -87,6 +87,7 @@ class Interpret(Daemon):
         md = MountDirectories(portage_configroot, package, logfile)
         po = Populate(nameserver, libdir, workdir, portage_configroot, logfile)
         ru = RunScript(libdir, portage_configroot, logfile)
+        pc = PivotChroot(tmdpir, portage_configroot, logfile)
         ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         bi = TarIt(name, portage_configroot, logfile)
 
@@ -170,6 +171,11 @@ class Interpret(Daemon):
                         stampit(progress)
                         continue
                     ru.runscript(obj)
+                elif verb == 'pivot':
+                    if smartlog(l, obj):
+                        stampit(progress)
+                        continue
+                    pc.pivot(obj, md)
                 elif verb == 'clean':
                     if smartlog(l, obj, False):
                         stampit(progress)

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
new file mode 100644
index 0000000..3392559
--- /dev/null
+++ b/grs/PivotChroot.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+import glob
+import re
+import os
+import shutil
+
+from grs.Constants import CONST
+from grs.MountDirectories import MountDirectories
+
+
+class PivotChroot():
+    """ doc here
+        more doc
+    """
+
+    def __init__(self, tmpdir = CONST.TMPDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
+            logfile = CONST.LOGFILE):
+        """ doc here
+            more doc
+        """
+        self.tmpdir = tmpdir
+        self.portage_configroot = portage_configroot
+        self.logfile = logfile
+
+
+    def pivot(self, subchroot, md):
+        """ doc here
+            more doc
+        """
+        some_mounted, all_mounted = md.are_mounted()
+        if some_mounted:
+            md.umount_all()
+
+        # TODO: we need to move this code into its own class and inherit
+        # Rotate any previous portage_configroots out of the way
+        dirs = glob.glob('%s.*' % self.portage_configroot)
+        indexed_dir = {}
+        for d in dirs:
+            m = re.search('^.+\.(\d+)$', d)
+            indexed_dir[int(m.group(1))] = d
+        count = list(indexed_dir.keys())
+        count.sort()
+        count.reverse()
+        for c in count:
+            current_dir = indexed_dir[c]
+            m = re.search('^(.+)\.\d+$', current_dir)
+            next_dir = '%s.%d' % (m.group(1), c+1)
+            shutil.move(current_dir, next_dir)
+        # If there is a directory, then move it to %s.0
+        if os.path.isdir(self.portage_configroot):
+            shutil.move(self.portage_configroot, '%s.0' % self.portage_configroot)
+
+        inner_chroot = os.path.join(self.portage_configroot, subdir)
+        shutil.move(inner_chroot, os.path.join(self.tmpdir, 'system'))
+
+        if all_mounted:
+            md.mount_all()


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

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

commit:     026001adf952f29a1546da7ed9947224ae2d0940
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 11:29:14 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 11:29:14 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=026001ad

grs/Interpret.py: build lines with initial # are comments.

 grs/Interpret.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 8b1166b..1f3ca03 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -115,6 +115,11 @@ class Interpret(Daemon):
             for l in s.readlines():
                 line_number += 1
 
+                # Skip lines with initial # as comments
+                m = re.search('^(#).*$', l)
+                if m:
+                    continue
+
                 # For a release run, execute every line of the build script.
                 # For an update run, exexute only lines with a leading +.
                 ignore_stamp = False


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

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

commit:     06eac3195f7ac2a2e2c570ac0ff6401f0074488d
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 12:36:09 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 12:36:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=06eac319

grs/PivotChroot.py: fix typo.

 grs/PivotChroot.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index 3392559..0e2f26a 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -51,7 +51,7 @@ class PivotChroot():
         if os.path.isdir(self.portage_configroot):
             shutil.move(self.portage_configroot, '%s.0' % self.portage_configroot)
 
-        inner_chroot = os.path.join(self.portage_configroot, subdir)
+        inner_chroot = os.path.join(self.portage_configroot, subchroot)
         shutil.move(inner_chroot, os.path.join(self.tmpdir, 'system'))
 
         if all_mounted:


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

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

commit:     aeee686e631e04819185ed3ab5a994197bb2788e
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 12:46:41 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 12:46:41 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=aeee686e

grs: properly import PivotChroot

 grs/Interpret.py | 1 +
 grs/__init__.py  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 1f3ca03..6cc76b6 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -9,6 +9,7 @@ from grs.Daemon import Daemon
 from grs.Log import Log
 from grs.Kernel import Kernel
 from grs.MountDirectories import MountDirectories
+from grs.PivotChroot import PivotChroot
 from grs.Populate import Populate
 from grs.RunScript import RunScript
 from grs.Synchronize import Synchronize

diff --git a/grs/__init__.py b/grs/__init__.py
index 5580d1d..383e5f2 100644
--- a/grs/__init__.py
+++ b/grs/__init__.py
@@ -8,6 +8,7 @@ from grs.Interpret import Interpret
 from grs.Log import Log
 from grs.Kernel import Kernel
 from grs.MountDirectories import MountDirectories
+from grs.PivotChroot import PivotChroot
 from grs.Populate import Populate
 from grs.RunScript import RunScript
 from grs.Synchronize import Synchronize


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

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

commit:     3fad61e67aae16a22139834e105cd4b0a6048717
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 12:48:44 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 12:48:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=3fad61e6

grs/Interpret.py: fix typo.

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 6cc76b6..9308925 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -88,7 +88,7 @@ class Interpret(Daemon):
         md = MountDirectories(portage_configroot, package, logfile)
         po = Populate(nameserver, libdir, workdir, portage_configroot, logfile)
         ru = RunScript(libdir, portage_configroot, logfile)
-        pc = PivotChroot(tmdpir, portage_configroot, logfile)
+        pc = PivotChroot(tmpdir, portage_configroot, logfile)
         ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         bi = TarIt(name, portage_configroot, logfile)
 


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

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

commit:     4a853c6e719be4c16591bd947bd9cde40e6b9813
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 12:57:22 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 12:57:22 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=4a853c6e

grs/RunScript.py: remove .sh from script since either python or bash will do.

 grs/RunScript.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grs/RunScript.py b/grs/RunScript.py
index a80f342..b49f4f1 100644
--- a/grs/RunScript.py
+++ b/grs/RunScript.py
@@ -20,9 +20,9 @@ class RunScript():
 
     def runscript(self, script_name):
         script_org = os.path.join(self.libdir, 'scripts/%s' % script_name)
-        script_dst = os.path.join(self.portage_configroot, 'tmp/script.sh')
+        script_dst = os.path.join(self.portage_configroot, 'tmp/script')
         shutil.copy(script_org, script_dst)
         os.chmod(script_dst, 0o0755)
-        cmd = 'chroot %s /tmp/script.sh' % self.portage_configroot
+        cmd = 'chroot %s /tmp/script' % self.portage_configroot
         Execute(cmd, timeout=None, logfile=self.logfile)
         os.unlink(script_dst)


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

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

commit:     7a9b409009b3f445b6b54572ccf514a5273b2fbe
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 14:33:19 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 14:33:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=7a9b4090

grs/PivotChroot.py: fix path to inner chroot.

 grs/PivotChroot.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index 0e2f26a..6eec3a0 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -32,7 +32,8 @@ class PivotChroot():
         if some_mounted:
             md.umount_all()
 
-        # TODO: we need to move this code into its own class and inherit
+        # TODO: we need to generalize this code into its own class
+        # and inherit it here, in Log.py and Seed.py.
         # Rotate any previous portage_configroots out of the way
         dirs = glob.glob('%s.*' % self.portage_configroot)
         indexed_dir = {}
@@ -47,11 +48,11 @@ class PivotChroot():
             m = re.search('^(.+)\.\d+$', current_dir)
             next_dir = '%s.%d' % (m.group(1), c+1)
             shutil.move(current_dir, next_dir)
-        # If there is a directory, then move it to %s.0
-        if os.path.isdir(self.portage_configroot):
-            shutil.move(self.portage_configroot, '%s.0' % self.portage_configroot)
 
-        inner_chroot = os.path.join(self.portage_configroot, subchroot)
+        # Assume portage_configroot exists and out of the way to system.0,
+        # then pivot out the inner chroot to system.
+        shutil.move(self.portage_configroot, '%s.0' % self.portage_configroot)
+        inner_chroot = os.path.join('%s.0' % self.portage_configroot, subchroot)
         shutil.move(inner_chroot, os.path.join(self.tmpdir, 'system'))
 
         if all_mounted:


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

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

commit:     1cf61cdd3f1f4b99f5b07de8bfaead397704d57f
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 20:37:31 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 20:37:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=1cf61cdd

grs/TarIt.py: expand 'tarit' grammar.

 grs/Interpret.py | 15 +++++++++++----
 grs/TarIt.py     | 14 +++++++++-----
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 9308925..ae9c858 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -138,6 +138,9 @@ class Interpret(Daemon):
                 if os.path.exists(progress) and not ignore_stamp:
                     continue
 
+                # This is pretty simple interpretive logic, either its a
+                # single 'verb', or a 'verb obj' pair.  While restrictive,
+                # its good enough for now.
                 try:
                     m = re.search('(\S+)\s+(\S+)', l)
                     verb = m.group(1)
@@ -193,10 +196,14 @@ class Interpret(Daemon):
                         continue
                     ke.kernel()
                 elif verb == 'tarit':
-                    if smartlog(l, obj, False):
-                        stampit(progress)
-                        continue
-                    bi.tarit()
+                    # 'tarit' can either be just a verb,
+                    # or a 'verb obj' pair.
+                    if obj:
+                        smartlog(l, obj, True):
+                        bi.tarit(obj)
+                    else:
+                        smartlog(l, obj, False):
+                        bi.tarit()
                 elif verb == 'hashit':
                     if smartlog(l, obj, False):
                         stampit(progress)

diff --git a/grs/TarIt.py b/grs/TarIt.py
index c0c3f0c..b0b18e5 100644
--- a/grs/TarIt.py
+++ b/grs/TarIt.py
@@ -11,16 +11,20 @@ class TarIt():
         self.portage_configroot = portage_configroot
         self.logfile = logfile
 
-        year = str(datetime.now().year).zfill(4)
-        month = str(datetime.now().month).zfill(2)
-        day = str(datetime.now().day).zfill(2)
-        self.tarball_name = '%s-%s%s%s.tar.xz' % (name, year, month, day)
+        self.year = str(datetime.now().year).zfill(4)
+        self.month = str(datetime.now().month).zfill(2)
+        self.day = str(datetime.now().day).zfill(2)
+        self.tarball_name = '%s-%s%s%s.tar.xz' % (name, self.year, self.month, self.day)
         self.digest_name = '%s.DIGESTS' % self.tarball_name
 
-    def tarit(self):
+    def tarit(self, alt_name = None):
+        if alt_name:
+            self.tarball_name = '%s-%s%s%s.tar.xz' % (alt_name, self.year, self.month, self.day)
+            self.digest_name = '%s.DIGESTS' % self.tarball_name
         cwd = os.getcwd()
         os.chdir(self.portage_configroot)
         tarball_path = os.path.join('..', self.tarball_name)
+        # This needs to be generalized for systems that don't support xattrs
         xattr_opts = '--xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags'
         cmd = 'tar %s -Jcf %s .' % (xattr_opts, tarball_path)
         Execute(cmd, timeout=None, logfile=self.logfile)


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

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

commit:     716c072bea1aba043bdc9913b09267b42f837f80
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  7 20:51:31 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul  7 20:51:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=716c072b

grs/Interpret.py: fix typo

 grs/Interpret.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index ae9c858..b813766 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -199,10 +199,10 @@ class Interpret(Daemon):
                     # 'tarit' can either be just a verb,
                     # or a 'verb obj' pair.
                     if obj:
-                        smartlog(l, obj, True):
+                        smartlog(l, obj, True)
                         bi.tarit(obj)
                     else:
-                        smartlog(l, obj, False):
+                        smartlog(l, obj, False)
                         bi.tarit()
                 elif verb == 'hashit':
                     if smartlog(l, obj, False):


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

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

commit:     546e6d6e5654100b481b38e0b664602f5fb63a62
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  8 10:31:01 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  8 10:31:01 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=546e6d6e

grs/Populate.py: restore .keep files

 grs/Populate.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/grs/Populate.py b/grs/Populate.py
index b9c2323..620eaba 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -66,16 +66,18 @@ class Populate():
                     else:
                         os.remove(old_file)
 
-    def clean_subdirs(self, dirpath):
-        path = os.path.join(self.portage_configroot, dirpath)
-        if os.path.isdir(path):
-            uid = os.stat(path).st_uid
-            gid = os.stat(path).st_gid
-            mode = os.stat(path).st_mode
-            shutil.rmtree(path)
-            os.mkdir(path)
-            os.chown(path, uid, gid)
-            os.chmod(path, mode)
+    def clean_subdirs(self, reldir):
+        absdir = os.path.join(self.portage_configroot, reldir)
+        if not os.path.isdir(absdir):
+            return
+        uid = os.stat(absdir).st_uid
+        gid = os.stat(absdir).st_gid
+        mode = os.stat(absdir).st_mode
+        shutil.rmtree(absdir)
+        os.mkdir(absdir)
+        os.chown(absdir, uid, gid)
+        os.chmod(absdir, mode)
+        open(os.path.join(absdir, '.keep'),'w').close()
 
 
     def clean(self):


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

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

commit:     04f01e9c5211fd5eab96dfe03d0494e0cdc9806f
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  8 15:47:29 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  8 15:47:29 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=04f01e9c

grs/Populate.py: remove the clean build directive.

 grs/Interpret.py |  5 -----
 grs/Populate.py  | 21 ---------------------
 2 files changed, 26 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index b813766..bea0bf2 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -185,11 +185,6 @@ class Interpret(Daemon):
                         stampit(progress)
                         continue
                     pc.pivot(obj, md)
-                elif verb == 'clean':
-                    if smartlog(l, obj, False):
-                        stampit(progress)
-                        continue
-                    po.clean()
                 elif verb == 'kernel':
                     if smartlog(l, obj, False):
                         stampit(progress)

diff --git a/grs/Populate.py b/grs/Populate.py
index 620eaba..8511c53 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -65,24 +65,3 @@ class Populate():
                         os.rename(old_file, new_file)
                     else:
                         os.remove(old_file)
-
-    def clean_subdirs(self, reldir):
-        absdir = os.path.join(self.portage_configroot, reldir)
-        if not os.path.isdir(absdir):
-            return
-        uid = os.stat(absdir).st_uid
-        gid = os.stat(absdir).st_gid
-        mode = os.stat(absdir).st_mode
-        shutil.rmtree(absdir)
-        os.mkdir(absdir)
-        os.chown(absdir, uid, gid)
-        os.chmod(absdir, mode)
-        open(os.path.join(absdir, '.keep'),'w').close()
-
-
-    def clean(self):
-        self.clean_subdirs('tmp')
-        self.clean_subdirs('var/tmp')
-        self.clean_subdirs('var/log')
-        if os.path.isfile(self.resolv_conf):
-            os.unlink(self.resolv_conf)


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

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

commit:     32e34dbcc4b5054c42dfc3e8790dddf4c4211c96
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  9 01:46:46 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Jul  9 01:46:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=32e34dbc

grs/RunScript.py: check if the script exists before trying to unlink it.

 grs/RunScript.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/grs/RunScript.py b/grs/RunScript.py
index b49f4f1..0e5d48e 100644
--- a/grs/RunScript.py
+++ b/grs/RunScript.py
@@ -25,4 +25,7 @@ class RunScript():
         os.chmod(script_dst, 0o0755)
         cmd = 'chroot %s /tmp/script' % self.portage_configroot
         Execute(cmd, timeout=None, logfile=self.logfile)
-        os.unlink(script_dst)
+        # In the case of a clean script, it can delete itself, so
+        # check if the script exists before trying to delete it.
+        if os.path.isfile(script_dst):
+            os.unlink(script_dst)


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

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

commit:     2077c0fb889f144efad47ee7060932b47873b7c8
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  9 15:28:49 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Jul  9 15:28:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=2077c0fb

grs/__init__.py: import Rotator.

 grs/Log.py         | 2 ++
 grs/PivotChroot.py | 1 +
 grs/Rotator.py     | 2 +-
 grs/Seed.py        | 2 ++
 grs/__init__.py    | 1 +
 5 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/grs/Log.py b/grs/Log.py
index 81ac022..201eeb9 100644
--- a/grs/Log.py
+++ b/grs/Log.py
@@ -5,7 +5,9 @@ import glob
 import os
 import re
 import shutil
+
 from grs.Constants import CONST
+from grs.Rotator import Rotator
 
 class Log(Rotator):
 

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index 8ec0fc6..ff0fb69 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -7,6 +7,7 @@ import shutil
 
 from grs.Constants import CONST
 from grs.MountDirectories import MountDirectories
+from grs.Rotator import Rotator
 
 
 class PivotChroot(Rotator):

diff --git a/grs/Rotator.py b/grs/Rotator.py
index fb76274..d82c9fd 100644
--- a/grs/Rotator.py
+++ b/grs/Rotator.py
@@ -1,4 +1,4 @@
-i#!/usr/bin/env python
+#!/usr/bin/env python
 
 import glob
 import re

diff --git a/grs/Seed.py b/grs/Seed.py
index 493a32a..aad5d20 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -5,8 +5,10 @@ import os
 import re
 import shutil
 import urllib.request
+
 from grs.Constants import CONST
 from grs.Execute import Execute
+from grs.Rotator import Rotator
 
 
 class Seed(Rotator):

diff --git a/grs/__init__.py b/grs/__init__.py
index 383e5f2..10831e9 100644
--- a/grs/__init__.py
+++ b/grs/__init__.py
@@ -10,6 +10,7 @@ from grs.Kernel import Kernel
 from grs.MountDirectories import MountDirectories
 from grs.PivotChroot import PivotChroot
 from grs.Populate import Populate
+from grs.Rotator import Rotator
 from grs.RunScript import RunScript
 from grs.Synchronize import Synchronize
 from grs.Seed import Seed


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

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

commit:     5b7fbe02062796313ad094892f44aac73372f9f6
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 10 02:04:37 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jul 10 02:04:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=5b7fbe02

grs/Execute.py: document and add logging to stderr.

 grs/Execute.py | 46 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 15fe562..f740924 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -4,16 +4,24 @@ import os
 import signal
 import shlex
 import subprocess
+import sys
 from grs.Constants import CONST
 
 class Execute():
-    """ doc here
-        more doc
-    """
+    """ Execute a shell command """
 
     def __init__(self, cmd, timeout = 1, extra_env = {}, failok = False, logfile = CONST.LOGFILE):
-        """ doc here
-            more doc
+        """ Execute a shell command.
+
+            cmd         - Simple string of the command to be execute as a
+                          fork()-ed child.
+            timeout     - The time in seconds to wait() on the child before
+                          sending a SIGTERM.  timeout = None means wait indefinitely.
+            extra_env   - Dictionary of extra environment variables for the fork()-ed
+                          child.  Note that the child inherits all the env variables
+                          of the grandparent shell in which grsrun/grsup was spawned.
+            logfile     - A file to log output to.  If logfile = None, then we log
+                          to sys.stdout.
         """
         def signalexit():
             pid = os.getpid()
@@ -25,11 +33,15 @@ class Execute():
             except ProcessLookupError:
                 pass
 
-        f = open(logfile, 'a')
         args = shlex.split(cmd)
         extra_env = dict(os.environ, **extra_env)
 
-        proc = subprocess.Popen(args, stdout=f, stderr=f, env=extra_env)
+        if logfile:
+            f = open(logfile, 'a')
+            proc = subprocess.Popen(args, stdout=f, stderr=f, env=extra_env)
+        else:
+            f = sys.stderr
+            proc = subprocess.Popen(args, env=extra_env)
 
         try:
             proc.wait(timeout)
@@ -38,13 +50,19 @@ class Execute():
             proc.kill()
             timed_out = True
 
-        rc = proc.returncode
-        if rc != 0:
-            f.write('EXIT CODE: %d\n' % rc)
-            if not failok:
-                signalexit()
+        if not timed_out:
+            # rc = None if we had a timeout
+            rc = proc.returncode
+            if rc:
+                f.write('EXIT CODE: %d\n' % rc)
+                if not failok:
+                    signalexit()
 
         if timed_out:
-            f.write('TIMEOUT ERROR:  %s\n' % cmd)
+            f.write('TIMEOUT ERROR: %s\n' % cmd)
+            if not failok:
+                signalexit()
 
-        f.close()
+        # Only close a logfile, don't close sys.stderr!
+        if logfile:
+            f.close()


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

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

commit:     b215ad5537db9c861b6d424b248239cfe7641b17
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 10 02:39:31 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jul 10 02:39:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b215ad55

grs/Execute.py: improve signal exit code.

 grs/Execute.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index f740924..9f59a6f 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -5,6 +5,7 @@ import signal
 import shlex
 import subprocess
 import sys
+import time
 from grs.Constants import CONST
 
 class Execute():
@@ -28,8 +29,12 @@ class Execute():
             f.write('SENDING SIGTERM to pid = %d\n' % pid)
             f.close()
             try:
-                os.kill(pid, signal.SIGTERM)
-                os.kill(pid, signal.SIGKILL)
+                for i in range(10):
+                    os.kill(pid, signal.SIGTERM)
+                    time.sleep(0.2)
+                while True:
+                    os.kill(pid, signal.SIGKILL)
+                    time.sleep(0.2)
             except ProcessLookupError:
                 pass
 


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

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

commit:     6e1ca591c2dacde806a277773d16b603558b04a2
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 10 02:40:09 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jul 10 02:40:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=6e1ca591

grs/Daemon.py: document.

 grs/Daemon.py | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/grs/Daemon.py b/grs/Daemon.py
index 15290a5..0d2d988 100644
--- a/grs/Daemon.py
+++ b/grs/Daemon.py
@@ -7,22 +7,31 @@ import sys
 import time
 
 class Daemon:
-    """ doc here
-        more doc
-        Adopted from Sander Marechal's "A simple unix/linux daemon in Python"
+    """ Adopted from Sander Marechal's "A simple unix/linux daemon in Python"
         See: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
+
+        To use, inherit by a subclass which overrides run() and does all the
+        daemon work.  You start the daemon with
+
+            d = MyDaemon(pidfile, foo='1', bar='2')  # Any number for kwargs after pidfile
+            d.start()   # to start the daemon
+            d.restart() # to restart the daemon
+            d.stop()    # to stop the daemon
+
+        Note: This isn't completely general daemon code as it doesn't close stdout/stderr.
+        Rather these are redirected to /var/log/grs/grs-daemon-<pid>.err to capture any
+        exceptions for debugging.
     """
 
     def __init__(self, pidfile, **kwargs):
+        """ Since this will be used as a super class, we'll accept any **kwargs
+            and insert them to our internal __dict__.
+        """
         self.pidfile = pidfile
         for k in kwargs:
             self.__dict__[k] = kwargs[k]
 
     def daemonize(self):
-        """ doc here
-            more doc
-        """
-
         try:
             pid = os.fork()
             if pid > 0:
@@ -55,6 +64,9 @@ class Daemon:
         sys.stderr.flush()
         os.dup2(se.fileno(), sys.stderr.fileno())
 
+        # Use atexit to remove the pidfile when we shutdown.
+        # No matter where the exit is initiated, eg from Execute.py
+        # we are sure that atexit() will run and delete the pidfile.
         atexit.register(self.delpid)
         with open(self.pidfile,'w') as pf:
             pf.write('%d\n' % os.getpid())
@@ -65,6 +77,10 @@ class Daemon:
 
 
     def start(self):
+        # If there's a pidfile when we try to startup, then either
+        # its stale or we're already running.  If the pidfile is stale,
+        # remove it and startup as usual.  If we're already running,
+        # then don't start a second instance.
         try:
             with open(self.pidfile, 'r') as pf:
                 pid = int(pf.read().strip())
@@ -84,6 +100,13 @@ class Daemon:
 
 
     def stop(self):
+        # Try to open our pidfile and read our pid.  If you have a pid but
+        # there is no process at that pid, then we're not running and all
+        # we have to do is cleanup our stale pidfile.a  If we can't get a
+        # pid from our pidfile, then we've lost the original process.  Either
+        # it crashed or something else killed the pidfile.  We don't know.
+        # Finally if have a valid pid, send it a bunch of SIGTERMS followed
+        # by SIGKILLS just in case.
         try:
             with open(self.pidfile,'r') as pf:
                 pid = int(pf.read().strip())


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

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

commit:     1c5666dd6ae518dfd88409d248fdcc7fd4298b68
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 10 12:56:42 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jul 10 12:56:42 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=1c5666dd

grs/Interpret.py: more aggressively send TERM/KILL signals.

 grs/Interpret.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index bea0bf2..4749561 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -4,6 +4,8 @@ import os
 import re
 import signal
 import sys
+import time
+
 from grs.Constants import CONST
 from grs.Daemon import Daemon
 from grs.Log import Log
@@ -44,8 +46,12 @@ class Interpret(Daemon):
                         if mypid == pid:
                             continue
                         try:
-                            os.kill(pid, signal.SIGTERM)
-                            os.kill(pid, signal.SIGKILL)
+                            for i in range(10):
+                                os.kill(pid, signal.SIGTERM)
+                                time.sleep(0.2)
+                            while True:
+                                os.kill(pid, signal.SIGKILL)
+                                time.sleep(0.2)
                         except ProcessLookupError:
                             pass
             try:


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

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

commit:     af3901d60547e06f805dfc8ba22734d02ecfaf04
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 20:58:00 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 20:58:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=af3901d6

Interpret.py: add documentation.

 grs/Interpret.py | 49 ++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 9 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 4749561..a941f3e 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -20,15 +20,16 @@ from grs.TarIt import TarIt
 
 
 class Interpret(Daemon):
-    """ doc here
-        more doc
-    """
+    """ This is the main daemon class. """
 
     def run(self):
-        """ doc here
-            more doc
+        """ This overrides the empty Daemon run method and is started when .start()
+            is executed.  This first daemonizes the process and then runs this method.
+            Note that the Daemon class does not set up any signal handles and expects
+            that to be done in the subclass.
         """
 
+        # First we set up some inner methods:
         def handler(signum, frame):
             """ On SIGTERM, propagate the signal to all processes in the cgroup/subcgroup
                 except yourself.  If a process won't terminate nicely, then kill it.
@@ -60,10 +61,14 @@ class Interpret(Daemon):
                 pass
             sys.exit(signum + 128)
 
-        signal.signal(signal.SIGINT,  handler)
-        signal.signal(signal.SIGTERM, handler)
 
         def smartlog(l, obj, has_obj = True):
+            """ This logs whether or not we have a grammatically incorrect
+                directive, or we are doing a mock run, and returns whether
+                or not we should execute the directive:
+                    True  = skip this directive
+                    False = don't skip it
+            """
             if (has_obj and not obj) or (not has_obj and obj):
                 lo.log('Bad command: %s' % l)
                 return True
@@ -72,9 +77,19 @@ class Interpret(Daemon):
                 return True
             return False
 
+
         def stampit(progress):
+            """ Create an empty file to mark the progress through the
+                build script.
+            """
             open(progress, 'w').close()
 
+
+        # Register the signals to terminate the entire process cgroup
+        signal.signal(signal.SIGINT,  handler)
+        signal.signal(signal.SIGTERM, handler)
+
+        # Grab all the GRS namespace variables
         nameserver  = CONST.nameservers[self.run_number]
         repo_uri    = CONST.repo_uris[self.run_number]
         stage_uri   = CONST.stage_uris[self.run_number]
@@ -88,6 +103,9 @@ class Interpret(Daemon):
         kernelroot  = CONST.kernelroots[self.run_number]
         portage_configroot = CONST.portage_configroots[self.run_number]
 
+        # Initialize all the classes that will run the directives from
+        # the build script.  Note that we expect these classes to just
+        # initialize some variables but not do any work in their initializers.
         lo = Log(logfile)
         sy = Synchronize(repo_uri, name, libdir, logfile)
         se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile)
@@ -98,12 +116,15 @@ class Interpret(Daemon):
         ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         bi = TarIt(name, portage_configroot, logfile)
 
+        # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)
 
+        # Rotate any prevously existing logs and make unmount any existing
+        # bind mounts from a previous run that were not cleaned up.
         lo.rotate_logs()
         md.umount_all()
 
-        # Both sync() + seed() are not scripted steps.
+        # Both sync() + seed() do not need build script directives.
         # sync() is done unconditionally for an update run.
         progress = os.path.join(tmpdir, '.completed_sync')
         if not os.path.exists(progress) or self.update_run:
@@ -116,13 +137,14 @@ class Interpret(Daemon):
             se.seed()
             stampit(progress)
 
+        # Read the build script and execute a line at a time.
         build_script = os.path.join(libdir, 'build')
         with open(build_script, 'r') as s:
             line_number = 0
             for l in s.readlines():
                 line_number += 1
 
-                # Skip lines with initial # as comments
+                # Skip lines with initial # as comments.
                 m = re.search('^(#).*$', l)
                 if m:
                     continue
@@ -155,6 +177,8 @@ class Interpret(Daemon):
                     verb = l.strip()
                     obj = None
 
+                # This long concatenated if is where the semantics of the
+                # build script are implemented.
                 if verb == '':
                     stampit(progress)
                     continue
@@ -214,3 +238,10 @@ class Interpret(Daemon):
                     lo.log('Bad command: %s' % l)
 
                 stampit(progress)
+
+        # Just in case the build script lacks a final unmount, if we
+        # are done, then let's make sure we clean up after ourselves.
+        try:
+            md.umount_all()
+        except NameError:
+            pass


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

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

commit:     cbe8e606b84a9a2e028646a686565df5ccd48db4
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 20:58:00 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 21:03:59 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=cbe8e606

grs/Interpret.py: add documentation.

 grs/Interpret.py | 49 ++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 9 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 4749561..a941f3e 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -20,15 +20,16 @@ from grs.TarIt import TarIt
 
 
 class Interpret(Daemon):
-    """ doc here
-        more doc
-    """
+    """ This is the main daemon class. """
 
     def run(self):
-        """ doc here
-            more doc
+        """ This overrides the empty Daemon run method and is started when .start()
+            is executed.  This first daemonizes the process and then runs this method.
+            Note that the Daemon class does not set up any signal handles and expects
+            that to be done in the subclass.
         """
 
+        # First we set up some inner methods:
         def handler(signum, frame):
             """ On SIGTERM, propagate the signal to all processes in the cgroup/subcgroup
                 except yourself.  If a process won't terminate nicely, then kill it.
@@ -60,10 +61,14 @@ class Interpret(Daemon):
                 pass
             sys.exit(signum + 128)
 
-        signal.signal(signal.SIGINT,  handler)
-        signal.signal(signal.SIGTERM, handler)
 
         def smartlog(l, obj, has_obj = True):
+            """ This logs whether or not we have a grammatically incorrect
+                directive, or we are doing a mock run, and returns whether
+                or not we should execute the directive:
+                    True  = skip this directive
+                    False = don't skip it
+            """
             if (has_obj and not obj) or (not has_obj and obj):
                 lo.log('Bad command: %s' % l)
                 return True
@@ -72,9 +77,19 @@ class Interpret(Daemon):
                 return True
             return False
 
+
         def stampit(progress):
+            """ Create an empty file to mark the progress through the
+                build script.
+            """
             open(progress, 'w').close()
 
+
+        # Register the signals to terminate the entire process cgroup
+        signal.signal(signal.SIGINT,  handler)
+        signal.signal(signal.SIGTERM, handler)
+
+        # Grab all the GRS namespace variables
         nameserver  = CONST.nameservers[self.run_number]
         repo_uri    = CONST.repo_uris[self.run_number]
         stage_uri   = CONST.stage_uris[self.run_number]
@@ -88,6 +103,9 @@ class Interpret(Daemon):
         kernelroot  = CONST.kernelroots[self.run_number]
         portage_configroot = CONST.portage_configroots[self.run_number]
 
+        # Initialize all the classes that will run the directives from
+        # the build script.  Note that we expect these classes to just
+        # initialize some variables but not do any work in their initializers.
         lo = Log(logfile)
         sy = Synchronize(repo_uri, name, libdir, logfile)
         se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile)
@@ -98,12 +116,15 @@ class Interpret(Daemon):
         ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         bi = TarIt(name, portage_configroot, logfile)
 
+        # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)
 
+        # Rotate any prevously existing logs and make unmount any existing
+        # bind mounts from a previous run that were not cleaned up.
         lo.rotate_logs()
         md.umount_all()
 
-        # Both sync() + seed() are not scripted steps.
+        # Both sync() + seed() do not need build script directives.
         # sync() is done unconditionally for an update run.
         progress = os.path.join(tmpdir, '.completed_sync')
         if not os.path.exists(progress) or self.update_run:
@@ -116,13 +137,14 @@ class Interpret(Daemon):
             se.seed()
             stampit(progress)
 
+        # Read the build script and execute a line at a time.
         build_script = os.path.join(libdir, 'build')
         with open(build_script, 'r') as s:
             line_number = 0
             for l in s.readlines():
                 line_number += 1
 
-                # Skip lines with initial # as comments
+                # Skip lines with initial # as comments.
                 m = re.search('^(#).*$', l)
                 if m:
                     continue
@@ -155,6 +177,8 @@ class Interpret(Daemon):
                     verb = l.strip()
                     obj = None
 
+                # This long concatenated if is where the semantics of the
+                # build script are implemented.
                 if verb == '':
                     stampit(progress)
                     continue
@@ -214,3 +238,10 @@ class Interpret(Daemon):
                     lo.log('Bad command: %s' % l)
 
                 stampit(progress)
+
+        # Just in case the build script lacks a final unmount, if we
+        # are done, then let's make sure we clean up after ourselves.
+        try:
+            md.umount_all()
+        except NameError:
+            pass


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

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

commit:     f91d3c583c7b75663ea70c6248f156fe4540a861
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 21:23:50 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 21:23:50 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=f91d3c58

grs/Kernel.py: add documentation.

 grs/Kernel.py | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 16d2247..c04f5a5 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -9,8 +9,10 @@ from grs.Execute import Execute
 
 
 class Kernel():
+    """ Build a linux-image pkg and install when building a system. """
 
-    def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, kernelroot = CONST.KERNELROOT, package = CONST.PACKAGE, logfile = CONST.LOGFILE):
+    def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
+            kernelroot = CONST.KERNELROOT, package = CONST.PACKAGE, logfile = CONST.LOGFILE):
         self.libdir = libdir
         self.portage_configroot = portage_configroot
         self.kernelroot = kernelroot
@@ -20,18 +22,24 @@ class Kernel():
 
 
     def parse_kernel_config(self):
+        """ Parse the version to be built/installed from the kernel-config file. """
         with open(self.kernel_config, 'r') as f:
             for i in range(3):
                 line = f.readline()
+        # The version line looks like the following:
+        # Linux/x86 4.0.6-hardened-r2 Kernel Configuration
+        # The 2nd group contains the version.
         m = re.search('^#\s+(\S+)\s+(\S+).+$', line)
         gentoo_version = m.group(2)
         try:
+            # Either the verison is of the form '4.0.6-hardened-r2' with two -'s
             m = re.search('(\S+?)-(\S+?)-(\S+)', gentoo_version)
             vanilla_version = m.group(1)
             flavor = m.group(2)
             revision = m.group(3)
             pkg_name = flavor + '-sources-' + vanilla_version + '-' + revision
         except AttributeError:
+            # Or the verison is of the form '4.0.6-hardened' with one -
             m = re.search('(\S+?)-(\S+)', gentoo_version)
             vanilla_version = m.group(1)
             flavor = m.group(2)
@@ -41,25 +49,35 @@ class Kernel():
 
 
     def kernel(self):
+        """ This emerges the kernel sources to a directory outside of the
+            fledgeling system's portage configroot, builds and installs it
+            to yet another external directory, bundles the kernel and modules
+            as a .tar.xz in the packages directory for downloads via grsup,
+            and finally installs it to the system's portage configroot.
+        """
+        # Grab the parsed verison and pkg atom.
         (gentoo_version, pkg_name) = self.parse_kernel_config()
 
+        # Prepare the paths to where we'll emerge and build the kernel,
+        # as well as paths for genkernel.
         kernel_source = os.path.join(self.kernelroot, 'usr/src/linux')
         image_dir     = os.path.join(self.kernelroot, gentoo_version)
         boot_dir      = os.path.join(image_dir, 'boot')
         modprobe_dir  = os.path.join(image_dir, 'etc/modprobe.d')
         modules_dir   = os.path.join(image_dir, 'lib/modules')
 
-        # Remove any old image directory and create a boot directory
-        # wich genkernel assumes is present.
+        # Remove any old kernel image directory and create a boot directory.
+        # Note genkernel assumes a boot directory is present.
         shutil.rmtree(image_dir, ignore_errors=True)
         os.makedirs(boot_dir, mode=0o755, exist_ok=True)
 
+        # emerge the kernel source.
         cmd = 'emerge --nodeps -1n %s' % pkg_name
         emerge_env = { 'USE' : 'symlink', 'ROOT' : self.kernelroot, 'ACCEPT_KEYWORDS' : '**' }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
         # Build and install the image outside the portage configroot so
-        # we can both rsync it in *and* tarball it for downloads.
+        # we can both rsync it in *and* tarball it for downloads via grsup.
         # TODO: add more options (eg splash and firmware), which can be
         # specified vi the kernel line in the build script.
         cmd = 'genkernel '
@@ -77,6 +95,7 @@ class Kernel():
         cmd += 'all'
         Execute(cmd, timeout=None, logfile=self.logfile)
 
+        # Strip the modules to shrink their size enormously!
         for dirpath, dirnames, filenames in os.walk(modules_dir):
             for filename in filenames:
                 if filename.endswith('.ko'):


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

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

commit:     abf559d73cbb0a2e0e1092bf1d029ff8fe4ae21c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 21:47:37 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 21:47:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=abf559d7

grs/MountDirectories.py: add documentation.

 grs/MountDirectories.py | 51 +++++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/grs/MountDirectories.py b/grs/MountDirectories.py
index 737daf0..c55c2ca 100644
--- a/grs/MountDirectories.py
+++ b/grs/MountDirectories.py
@@ -6,15 +6,13 @@ from grs.Constants import CONST
 from grs.Execute import Execute
 
 class MountDirectories():
-    """ doc here
-        more doc
+    """ This controls the mounting/unmounting of directories under the system's
+        portage configroot.
     """
 
-    def __init__(self, portage_configroot = CONST.PORTAGE_CONFIGROOT, package = CONST.PACKAGE, logfile = CONST.LOGFILE):
-        """ doc here
-            more doc
-        """
-        # The order is respected
+    def __init__(self, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
+            package = CONST.PACKAGE, logfile = CONST.LOGFILE):
+        # The order is respected.  Note that 'dev' needs to be mounted beore 'dev/pts'.
         self.directories = [
             'dev',
             'dev/pts',
@@ -24,7 +22,7 @@ class MountDirectories():
             'usr/portage',
             [ package, 'usr/portage/packages' ]
         ]
-        # Once initiated, we'll only work with one portage_configroot
+        # Once initiated, we only work with one portage_configroot
         self.portage_configroot = portage_configroot
         self.package = package
         self.logfile = logfile
@@ -32,21 +30,22 @@ class MountDirectories():
         self.rev_directories = deepcopy(self.directories)
         self.rev_directories.reverse()
 
+
     def ismounted(self, mountpoint):
-        # Obtain all the current mountpoints.  os.path.ismount() fails for for bind mounts,
-        # so we obtain them all ourselves
+        """ Obtain all the current mountpoints.  Since python's os.path.ismount()
+            fails for for bind mounts, we obtain these ourselves from /proc/mounts.
+        """
         mountpoints = []
         for line in open('/proc/mounts', 'r').readlines():
             mountpoints.append(line.split()[1])
-        # Let's make sure mountoint is canonical real path, no sym links,
-        # since that's what /proc/mounts reports.
+        # Let's make sure mountoint is canonical real path, no sym links, since that's
+        # what /proc/mounts reports.  Otherwise we can get a false negative on matching.
         mountpoint = os.path.realpath(mountpoint)
         return mountpoint in mountpoints
 
+
     def are_mounted(self):
-        """ doc here
-            more doc
-        """
+        """ Return whether some or all of the self.directories[] are mounted.  """
         some_mounted = False
         all_mounted = True
         for mount in self.directories:
@@ -66,34 +65,38 @@ class MountDirectories():
 
 
     def mount_all(self):
-        """ doc here
-            more doc
-        """
-        # If any our mounted, let's first unmount all, then mount all
+        """ Mount all the self.directories[] under the system's portage configroot.  """
+        # If any are mounted, let's first unmount all, then mount all
         some_mounted, all_mounted = self.are_mounted()
         if some_mounted:
             self.umount_all()
-
+        # Now go through each of the self.directories[] to be mounted in order.
         for mount in self.directories:
             if isinstance(mount, str):
-                # Here source_directory is assumed to exist relative to /
+                # In this case, the source_directory is assumed to exist relative to /
+                # and we will just bind mount it in the system's portage configroot.
                 source_directory = mount
                 target_directory = mount
             elif isinstance(mount, list):
-                # Here source_directory is assumed to be an abspath
-                # and we create it if it doesn't exist
+                # In this case, the source_directory is assumed to be an abspath, and
+                # we create it if it doesn't already exist.
                 source_directory = mount[0]
                 os.makedirs(source_directory, mode=0o755, exist_ok=True)
                 target_directory = mount[1]
             elif isinstance(mount, dict):
+                # In this case, we are given the mountpoint, type and name,
+                # so we just go right ahead and mount -t type name mountpoint.
+                # This is useful for tmpfs filesystems.
                 tmp = list(mount.values())
                 tmp = tmp[0]
                 vfstype = tmp[0]
                 vfsname = tmp[1]
                 tmp = list(mount.keys())
                 target_directory = tmp[0]
+            # Let's make sure the target_directory exists.
             target_directory = os.path.join(self.portage_configroot, target_directory)
             os.makedirs(target_directory, mode=0o755, exist_ok=True)
+            # Okay now we're ready to do the actual mounting.
             if isinstance(mount, str):
                 cmd = 'mount --bind /%s %s' % (source_directory, target_directory)
             elif isinstance(mount, list):
@@ -104,6 +107,8 @@ class MountDirectories():
 
 
     def umount_all(self):
+        """ Unmount all the self.directories[]. """
+        # We must unmount in the opposite order that we mounted.
         for mount in self.rev_directories:
             if isinstance(mount, str):
                 target_directory = mount


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

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

commit:     e1386f9d15e72b02b4da5f8d8b5e3615df5da1c2
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 22:37:26 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 22:37:26 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=e1386f9d

grs/Log.py: add documentation.

 grs/Log.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/grs/Log.py b/grs/Log.py
index 5a87a92..7bca4f4 100644
--- a/grs/Log.py
+++ b/grs/Log.py
@@ -10,14 +10,16 @@ from grs.Constants import CONST
 from grs.Rotator import Rotator
 
 class Log(Rotator):
+    """ Initilize logs, log messages, or rotate logs.  """
 
     def __init__(self, logfile = CONST.LOGFILE):
         self.logfile = logfile
+        # Make sure the log directory exists
         os.makedirs(os.path.dirname(self.logfile), exist_ok=True)
         open(self.logfile, 'a').close()
 
-
     def log(self, msg, stamped = True):
+        # If requested, stamp a log message with the unix time.
         if stamped:
             current_time = datetime.datetime.now(datetime.timezone.utc)
             unix_timestamp = current_time.timestamp()
@@ -27,5 +29,6 @@ class Log(Rotator):
 
 
     def rotate_logs(self, upper_limit = 20):
+        # Rotate all the previous logs
         self.full_rotate(self.logfile, upper_limit=upper_limit)
-        open('%s' % self.logfile, 'a').close()
+        open(self.logfile, 'a').close()


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

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

commit:     163f81a7926dc10244bb05cb706ee489e5faa994
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 22:41:31 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 22:41:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=163f81a7

grs/PivotChroot.py: add documentation.

 grs/PivotChroot.py | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index cbfb29f..f73c3c8 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -11,33 +11,28 @@ from grs.Rotator import Rotator
 
 
 class PivotChroot(Rotator):
-    """ doc here
-        more doc
-    """
+    """ Move an inner chroot out to the new system portage configroot.  """
 
     def __init__(self, tmpdir = CONST.TMPDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
             logfile = CONST.LOGFILE):
-        """ doc here
-            more doc
-        """
         self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile
 
 
     def pivot(self, subchroot, md):
-        """ doc here
-            more doc
-        """
+        # If any directories are mounted, unmount them before pivoting.
         some_mounted, all_mounted = md.are_mounted()
         if some_mounted:
             md.umount_all()
 
-        # Move portage_configroot out of the way to system.0,
-        # then pivot out the inner chroot to system.
+        # Move the system's portage configroot out of the way to system.0,
+        # then pivot the inner chroot to system.
         self.full_rotate(self.portage_configroot)
         inner_chroot = os.path.join('%s.0' % self.portage_configroot, subchroot)
         shutil.move(inner_chroot, os.path.join(self.tmpdir, 'system'))
 
+        # Be conservative: only if all the directories were mounted on the old
+        # system portage configroot to we remount on the newly pivoted root.
         if all_mounted:
             md.mount_all()


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

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

commit:     c94dcf94107b408be23e78ce6c54763e57610b5a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 23:04:14 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 23:04:14 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=c94dcf94

grs/Populate.py: add documentation.

 grs/Populate.py | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/grs/Populate.py b/grs/Populate.py
index 8511c53..f37d70e 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -7,39 +7,54 @@ from grs.Constants import CONST
 from grs.Execute import Execute
 
 class Populate():
-    """ doc here
-        more doc
+    """ Copy the core files from the GRS repo to the system's portage configroot
+        for a particular cycle number.
     """
 
-    def __init__(self, nameserver, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
+    def __init__(self, nameserver, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \
+            portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
         self.nameserver = nameserver
         self.libdir = libdir
         self.workdir = workdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile
-
+        # We need /etc and /etc/resolv.conf for the system's portage configroot.
         self.etc = os.path.join(self.portage_configroot, 'etc')
         self.resolv_conf = os.path.join(self.etc, 'resolv.conf')
 
 
     def populate(self, cycle = True):
+        """ Copy the core files from the GRS repo, to a local workdir and
+            then to the system's portage configroot, selecting for a paricular
+            cycle number.
+        """
+        # rsync from the GRS repo to the workdir, removing the .git directory
         cmd = 'rsync -av --delete --exclude=\'.git*\' %s/core/ %s' % (self.libdir, self.workdir)
         Execute(cmd, timeout=60, logfile = self.logfile)
 
         # Select the cycle
         if cycle: self.select_cycle(cycle)
 
-        # Copy from /tmp/grs-work to /tmp/system
+        # Copy from the workdir to the system's portage configroot.
         cmd = 'rsync -av %s/ %s' % (self.workdir, self.portage_configroot)
         Execute(cmd, timeout=60, logfile = self. logfile)
 
-        # Add any extra files
+        # Add /etc/resolv.conf.  We need this when we emerge within the chroot.
         os.makedirs(self.etc, mode=0o755, exist_ok=True)
         with open(self.resolv_conf, 'w') as f:
             f.write('nameserver %s' % self.nameserver)
 
 
     def select_cycle(self, cycle):
+        """ Select files with the matching cycle number.  If a file has form
+                filename.CYCLE.d
+            where d is an integer, then we delete all the other filename.CYCLE.x
+            where x != d and we rename filename.CYCLE.d to just filename.
+            Note: if a cycle number is not given, then cycle default to True
+            and we choose the filename with the largest cycle number.
+        """
+        # The cycled_files dictionary will have form:
+        # { 1:['/path/to', 'a'], 1:['/path/to', 'b'], 2:...}
         cycled_files = {}
         for dirpath, dirnames, filenames in os.walk(self.workdir):
             for f in filenames:
@@ -49,11 +64,14 @@ class Populate():
                     cycle_no = int(m.group(2))
                     cycled_files.setdefault(cycle_no, [])
                     cycled_files[cycle_no].append([dirpath, filename])
-
+        # If cycle is just a boolean, then default to the maximum cycle number.
         if type(cycle) is bool:
             cycle_no = max(cycled_files)
         else:
             cycle_no = cycle
+        # Go through cycled_files dictionary and either
+        #     1. rename the file if it matches the desired cycle number,
+        #     2. delete the file otherwise.
         for c in cycled_files:
             for f in cycled_files[c]:
                 dirpath = f[0]


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

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

commit:     e84beb3237d2e966e3936eaa87e40a1a08a1e176
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 23:18:13 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 23:18:13 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=e84beb32

grs/RunScript.py: add documentation.

 grs/RunScript.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/grs/RunScript.py b/grs/RunScript.py
index 0e5d48e..33efd72 100644
--- a/grs/RunScript.py
+++ b/grs/RunScript.py
@@ -6,22 +6,21 @@ from grs.Constants import CONST
 from grs.Execute import Execute
 
 class RunScript():
-    """ doc here
-        more doc
-    """
+    """ Run a script within the chroot. """
 
-    def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
-        """ doc here
-            more doc
-        """
+    def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, 
+            logfile = CONST.LOGFILE):
         self.libdir = libdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile
 
     def runscript(self, script_name):
+        # Copy the script form the GRS repo to the system's portage configroot's /tmp.
+        # Don't add a suffix to the script since we will admit bash, python, etc.
         script_org = os.path.join(self.libdir, 'scripts/%s' % script_name)
         script_dst = os.path.join(self.portage_configroot, 'tmp/script')
         shutil.copy(script_org, script_dst)
+        # Mark the script as excutable and execute it.
         os.chmod(script_dst, 0o0755)
         cmd = 'chroot %s /tmp/script' % self.portage_configroot
         Execute(cmd, timeout=None, logfile=self.logfile)


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

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

commit:     ae46a8788abd80e1b367e63d2768b44a626799d5
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 23:21:26 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 23:21:26 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=ae46a878

grs/Seed.py: add documentation.

 grs/Seed.py | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/grs/Seed.py b/grs/Seed.py
index 1ce5f48..b5c9a6b 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -12,15 +12,10 @@ from grs.Rotator import Rotator
 
 
 class Seed(Rotator):
-    """ doc here
-        more doc
-    """
+    """ Download a stage tarball and unpack it into an empty system portage configroot. """
 
     def __init__(self, stage_uri, tmpdir = CONST.TMPDIR, portage_configroot = \
             CONST.PORTAGE_CONFIGROOT, package = CONST.PACKAGE, logfile = CONST.LOGFILE):
-        """ doc here
-            more doc
-        """
         self.stage_uri = stage_uri
         self.portage_configroot = portage_configroot
         self.package = package
@@ -30,9 +25,6 @@ class Seed(Rotator):
 
 
     def seed(self):
-        """ doc here
-            more doc
-        """
         # Rotate the old portage_configroot and package out of the way
         for directory in [self.portage_configroot, self.package]:
             self.full_rotate(directory)
@@ -47,4 +39,3 @@ class Seed(Rotator):
         # Because python's tarfile sucks
         cmd = 'tar --xattrs -xf %s -C %s' % (self.filepath, self.portage_configroot)
         Execute(cmd, timeout=120, logfile=self.logfile)
-        #os.unlink(self.filepath)


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

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

commit:     a2f107d19503a8ffca9de85c9e74ff59d21cadf6
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 23:32:05 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 23:32:05 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=a2f107d1

grs/Synchronize.py: add documentation.

 grs/Synchronize.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 1df8ce2..ed8209c 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -5,9 +5,7 @@ from grs.Constants import CONST
 from grs.Execute import Execute
 
 class Synchronize():
-    """ doc here
-        more doc
-    """
+    """ Either clone or pull a remote git repository for a GRS system.  """
 
     def __init__(self, remote_repo, branch, libdir = CONST.LIBDIR, logfile = CONST.LOGFILE):
         self.remote_repo = remote_repo
@@ -17,21 +15,23 @@ class Synchronize():
 
     def sync(self):
         if self.isgitdir():
+            # If the local repo exists, then make it pristine an pull
             cmd = 'git -C %s reset HEAD --hard' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
             cmd = 'git -C %s clean -f -x -d' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
             cmd = 'git -C %s pull' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
-            cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
-            Execute(cmd, timeout=60, logfile=self.logfile)
         else:
+            # else clone afresh.
             cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo)
             Execute(cmd, timeout=60, logfile=self.logfile)
-            cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
-            Execute(cmd, timeout=60, logfile=self.logfile)
+        # Make sure we're on the correct branch for the desired GRS system.
+        cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
+        Execute(cmd, timeout=60, logfile=self.logfile)
 
     def isgitdir(self):
+        """ If there is a .git/config file, assume its a local git repository. """
         git_configdir = os.path.join(self.local_repo, '.git')
         git_configfile = os.path.join(git_configdir, 'config')
         return os.path.isdir(git_configdir) and os.path.isfile(git_configfile)


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

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

commit:     02b84c23ce71cfc1d26d86967b95fde9d892ffe1
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 23:39:43 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 23:39:43 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=02b84c23

grs/TarIt.py: add documentation.

 grs/TarIt.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/grs/TarIt.py b/grs/TarIt.py
index b0b18e5..a8b21b3 100644
--- a/grs/TarIt.py
+++ b/grs/TarIt.py
@@ -6,31 +6,42 @@ from grs.Constants import CONST
 from grs.Execute import Execute
 
 class TarIt():
+    """ Create a tarball of the system and generate the hash values. """
 
     def __init__(self, name, portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
         self.portage_configroot = portage_configroot
         self.logfile = logfile
-
+        # Prepare a year, month and day for a tarball name timestamp.
         self.year = str(datetime.now().year).zfill(4)
         self.month = str(datetime.now().month).zfill(2)
         self.day = str(datetime.now().day).zfill(2)
         self.tarball_name = '%s-%s%s%s.tar.xz' % (name, self.year, self.month, self.day)
         self.digest_name = '%s.DIGESTS' % self.tarball_name
 
+
     def tarit(self, alt_name = None):
+        # Create the tarball with the default name unless an alt_name is given.
         if alt_name:
             self.tarball_name = '%s-%s%s%s.tar.xz' % (alt_name, self.year, self.month, self.day)
             self.digest_name = '%s.DIGESTS' % self.tarball_name
+        # We have to cd into the system's portage configroot and then out again.
         cwd = os.getcwd()
         os.chdir(self.portage_configroot)
         tarball_path = os.path.join('..', self.tarball_name)
-        # This needs to be generalized for systems that don't support xattrs
+        # TODO: This needs to be generalized for systems that don't support xattrs
         xattr_opts = '--xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags'
         cmd = 'tar %s -Jcf %s .' % (xattr_opts, tarball_path)
         Execute(cmd, timeout=None, logfile=self.logfile)
         os.chdir(cwd)
 
+
     def hashit(self):
+        """ Generate various hash values.  We hijack the 'logfile' which will
+            actually be the file containing the hashes.
+        """
+        # We need to be in the parent of the system's portage configroot because
+        # that's where we created the above tarball.  This should be the workdir,
+        # but its probably safer to be pedantic here.
         cwd = os.getcwd()
         os.chdir(os.path.join(self.portage_configroot, '..'))
 


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

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

commit:     b37e8b5ccd90b572871ca5714688125c7e24ce47
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 25 22:38:11 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Jul 25 22:38:22 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b37e8b5c

grs/Kernel.py: modules directory should be $(get_libdir)

 grs/Kernel.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index c04f5a5..c9a99d8 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -64,6 +64,8 @@ class Kernel():
         image_dir     = os.path.join(self.kernelroot, gentoo_version)
         boot_dir      = os.path.join(image_dir, 'boot')
         modprobe_dir  = os.path.join(image_dir, 'etc/modprobe.d')
+        # TODO: modules_dir really needs $(get_libdir), eg /lib64.
+        # For example, this breaks on amd64 multilib.
         modules_dir   = os.path.join(image_dir, 'lib/modules')
 
         # Remove any old kernel image directory and create a boot directory.


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

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

commit:     75fd42a5a8d40e8ef124526f20989c5a4ee39ce7
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 27 20:52:12 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jul 27 20:52:12 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=75fd42a5

grs/Kernel.py: dereference lib -> lib64, don't clobber it.

 grs/Kernel.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index c9a99d8..38b8644 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -119,6 +119,6 @@ class Kernel():
         os.chdir(image_dir)
         if os.path.isfile(tarball_path):
             os.unlink(tarball_path)
-        cmd = 'tar -Jcf %s .' % tarball_path
+        cmd = 'tar -Jchf %s .' % tarball_path
         Execute(cmd, timeout=600, logfile=self.logfile)
         os.chdir(cwd)


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

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

commit:     832278b3f3e505f04508f7a2aaafdfb9b7ab4452
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 28 22:47:21 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 28 22:47:21 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=832278b3

Revert "grs/Kernel.py: dereference lib -> lib64, don't clobber it."

This reverts commit 75fd42a5a8d40e8ef124526f20989c5a4ee39ce7.

 grs/Kernel.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 38b8644..c9a99d8 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -119,6 +119,6 @@ class Kernel():
         os.chdir(image_dir)
         if os.path.isfile(tarball_path):
             os.unlink(tarball_path)
-        cmd = 'tar -Jchf %s .' % tarball_path
+        cmd = 'tar -Jcf %s .' % tarball_path
         Execute(cmd, timeout=600, logfile=self.logfile)
         os.chdir(cwd)


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

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

commit:     a1053d8418f8496d0cffec41f57f801708577455
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 29 00:23:14 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul 29 00:23:14 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=a1053d84

grs/Kernel.py: rsync was clobbering lib -> lib64, not tar.

 grs/Kernel.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index c9a99d8..cec4a5f 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -106,7 +106,7 @@ class Kernel():
                     Execute(cmd)
 
         # Copy the newly compiled kernel image and modules to portage configroot
-        cmd = 'rsync -a %s/ %s' % (image_dir, self.portage_configroot)
+        cmd = 'rsync -aK %s/ %s' % (image_dir, self.portage_configroot)
         Execute(cmd, timeout=60, logfile=self.logfile)
 
         # Tar up the kernel image and modules and place them in package/linux-images


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-08-08 17:51 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-08-08 17:51 UTC (permalink / raw
  To: gentoo-commits

commit:     6a34bce8dbd3dd31caa62e2e44d7ae58dd609457
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  8 17:54:37 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Aug  8 17:54:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=6a34bce8

grs/Worldconf.py: clear out managed directories before installing.

 grs/WorldConf.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index b102e7d..63daace 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -9,15 +9,28 @@ import re
 from grs.Constants import CONST
 
 class WorldConf():
-    """ doc here
-        more doc
-    """
+    """ Manage files in /etc/portage based on /etc/grs/world.conf """
+
+    # TODO: This needs to be expanded.
+    manageddirs = ['env', 'package.env', 'package.accept_keywords', \
+        'package.use', 'package.mask', 'package.unmask']:
 
     @staticmethod
     def install():
-        """ doc here
-            more doc
+        """ Restore /etc/portage to a prestine stage (removing all files
+            in manageddirs, and copy in all files specified in world.conf.
         """
+        # This is harsh, but we need to start from a clean slate because
+        # world.conf can drop sections.  If it does, then those files are
+        # orphaned and can inject flags/envvars which are problematic.
+        for directory in WorldConf.manageddirs:
+            dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory)
+            for f in os.listdir(dpath):
+                fpath = os.path.join(dpath, f)
+                if os.path.isfile(fpath):
+                    os.remove(fpath)
+
+        # Now we can read world.conf and populate an empty /etc/portage.
         config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None)
         config.read(CONST.WORLD_CONFIG)
         for s in config.sections():
@@ -32,12 +45,14 @@ class WorldConf():
 
     @staticmethod
     def clean():
-        """ doc here
-            more doc
+        """ Remove any files from /etc/portage that are unnecessary, ie that
+            do not correspond to installed pkgs.
         """
+        # We need to look at all portage provide pkgs and all installed pkgs.
         portdb = portage.db[portage.root]["porttree"].dbapi
         vardb  = portage.db[portage.root]["vartree"].dbapi
 
+        # Remove all installed pkgs from the set of all portage packages.
         uninstalled = portdb.cp_all()
         for p in vardb.cp_all():
             try:
@@ -45,6 +60,7 @@ class WorldConf():
             except ValueError:
                 print('%s installed on local system, but not in portage repo anymore.' % p)
 
+        # Construct a list of canonical named files for uninstalled pkgs.
         slot_atoms = []
         for p in uninstalled:
             cpv = portdb.cp_list(p)[0]
@@ -56,12 +72,10 @@ class WorldConf():
                 slot = slotvar
             slot_atoms.append(re.sub('[/:]', '_', '%s:%s' % (p, slot)))
 
+        # Walk through all files in /etc/portage and remove any files for uninstalled pkgs.
         for dirpath, dirnames, filenames in os.walk(CONST.PORTAGE_CONFIGDIR):
             # Only look at select files and directories.
-            # TODO: This needs to be expanded.
-            if not os.path.basename(dirpath) in ['env', 'package.env', \
-                    'package.accept_keywords', 'package.use', \
-                    'package.mask', 'package.unmask']:
+            if not os.path.basename(dirpath) in WorldConf.manageddirs:
                 continue
 
             for f in filenames:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-08-08 18:01 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-08-08 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     eb55566218915335cbf9445b1c6176ce9023f025
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  8 18:04:08 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Aug  8 18:04:08 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=eb555662

grs/WorldConf.py: don't delete from non-existing directories.

 grs/WorldConf.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index 63daace..c496e5f 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -13,7 +13,7 @@ class WorldConf():
 
     # TODO: This needs to be expanded.
     manageddirs = ['env', 'package.env', 'package.accept_keywords', \
-        'package.use', 'package.mask', 'package.unmask']:
+        'package.use', 'package.mask', 'package.unmask']
 
     @staticmethod
     def install():
@@ -25,6 +25,8 @@ class WorldConf():
         # orphaned and can inject flags/envvars which are problematic.
         for directory in WorldConf.manageddirs:
             dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory)
+            if not os.path.isdir(dpath):
+                continue
             for f in os.listdir(dpath):
                 fpath = os.path.join(dpath, f)
                 if os.path.isfile(fpath):


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-08-08 20:06 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-08-08 20:06 UTC (permalink / raw
  To: gentoo-commits

commit:     c74e72983b4c0f34bd56f0d9b16857339cdda8b6
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  8 20:08:54 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Aug  8 20:08:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=c74e7298

grs/WorldConf.py: remove added files to managed dirs during clean.

 grs/WorldConf.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index c496e5f..b005f0e 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -74,13 +74,22 @@ class WorldConf():
                 slot = slotvar
             slot_atoms.append(re.sub('[/:]', '_', '%s:%s' % (p, slot)))
 
+        # Also let's get a list of all the possible canonical file names
+        config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None)
+        config.read(CONST.WORLD_CONFIG)
+        canon = []
+        for s in config.sections():
+            p_slot_atom = re.sub('[/:]', '_', s)
+            canon.append(p_slot_atom)
+
         # Walk through all files in /etc/portage and remove any files for uninstalled pkgs.
         for dirpath, dirnames, filenames in os.walk(CONST.PORTAGE_CONFIGDIR):
             # Only look at select files and directories.
             if not os.path.basename(dirpath) in WorldConf.manageddirs:
                 continue
 
+            # Remove all filenames that match uninstalled slot_atoms or are not in the canon
             for f in filenames:
                 fpath = os.path.realpath(os.path.join(dirpath, f))
-                if f in slot_atoms:
+                if f in slot_atoms or not f in canon:
                     os.remove(fpath)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-08-09 20:26 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-08-09 20:26 UTC (permalink / raw
  To: gentoo-commits

commit:     a41100e5a1c3514bf316e5e5982c3f749e203892
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  9 20:29:20 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Aug  9 20:29:20 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=a41100e5

grs/Kernel.py: don't rebuild/reinstall a kernel if its linux-image tarball exists.

 grs/Kernel.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index bb76b80..7f96d91 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -80,9 +80,16 @@ class Kernel():
         image_dir     = os.path.join(self.kernelroot, gentoo_version)
         boot_dir      = os.path.join(image_dir, 'boot')
         modprobe_dir  = os.path.join(image_dir, 'etc/modprobe.d')
-        # TODO: modules_dir really needs $(get_libdir), eg /lib64.
-        # For example, this breaks on amd64 multilib.
         modules_dir   = os.path.join(image_dir, 'lib/modules')
+        # Prepare tarball filename and path.  If the tarball already exists,
+        # don't rebuild/reinstall it.  Note: It should have been installed to
+        # the system's portage configroot when it was first built, so no need
+        # to reinstall it.
+        linux_images = os.path.join(self.package, 'linux-images')
+        tarball_name = 'linux-image-%s.tar.xz' % gentoo_version
+        tarball_path = os.path.join(linux_images, tarball_name)
+        if os.path.isfile(tarball_path):
+            return
 
         # Remove any old kernel image directory and create a boot directory.
         # Note genkernel assumes a boot directory is present.
@@ -126,15 +133,9 @@ class Kernel():
         Execute(cmd, timeout=60, logfile=self.logfile)
 
         # Tar up the kernel image and modules and place them in package/linux-images
-        linux_images = os.path.join(self.package, 'linux-images')
         os.makedirs(linux_images, mode=0o755, exist_ok=True)
-        tarball_name = 'linux-image-%s.tar.xz' % gentoo_version
-        tarball_path = os.path.join(linux_images, tarball_name)
-
         cwd = os.getcwd()
         os.chdir(image_dir)
-        if os.path.isfile(tarball_path):
-            os.unlink(tarball_path)
         cmd = 'tar -Jcf %s .' % tarball_path
         Execute(cmd, timeout=600, logfile=self.logfile)
         os.chdir(cwd)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-12 20:56 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-12 20:56 UTC (permalink / raw
  To: gentoo-commits

commit:     25eb96b12eabb19cceab7205696fc5d7fa90933b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 12 20:14:53 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Sep 12 21:01:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=25eb96b1

grs/ISOIt.py: initial commit of isoit directive.

 grs/ISOIt.py     | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 grs/Interpret.py | 25 ++++++++++++++++++--
 grs/__init__.py  |  1 +
 3 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
new file mode 100644
index 0000000..9b3a920
--- /dev/null
+++ b/grs/ISOIt.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+#    ISOIt.py: this file is part of the GRS suite
+#    Copyright (C) 2015  Anthony G. Basile
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+from datetime import datetime
+from grs.Constants import CONST
+from grs.Execute import Execute
+from grs.HashIt import HashIt
+
+class ISOIt(HashIt):
+    """ Create a bootable ISO of the system. """
+
+    def __init__(self, name, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \
+            portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
+        self.libdir = libdir
+        self.workdir = workdir
+        self.portage_configroot = portage_configroot
+        self.logfile = logfile
+        # Prepare a year, month and day for a ISO name timestamp.
+        self.year = str(datetime.now().year).zfill(4)
+        self.month = str(datetime.now().month).zfill(2)
+        self.day = str(datetime.now().day).zfill(2)
+        self.medium_name = '%s-%s%s%s.iso' % (name, self.year, self.month, self.day)
+        self.digest_name = '%s.DIGESTS' % self.medium_name
+
+
+    def isoit(self, alt_name = None):
+        # Create the ISO with the default name unless an alt_name is given.
+        if alt_name:
+            self.medium_name = '%s-%s%s%s.iso' % (alt_name, self.year, self.month, self.day)
+            self.digest_name = '%s.DIGESTS' % self.medium_name
+        iso_path = os.path.join(self.workdir, 'iso')
+        grub_path = os.path.join(iso_path, 'boot/grub')
+        os.makedirs(grub_path, mode=0o755, exist_ok=False)
+        #
+        # 1. build initramfs image and copy it in
+        #    locate a build script for the initramfs in self.libdir/scripts
+        #    locate a busybox config script in self.libdir/scripts
+        #    locate an init scripts in self.libdir/scripts
+        #    copy in any kernel modules(?)
+        #    find . | cpio -H newc -o | gzip -9 > iso/boot/initramfs.igz
+        #
+        # 2. make the squashfs image and copy it into the iso/boot
+        squashfs_path = os.path.join(iso_path, 'rootfs')
+        cmd = 'mksquashfs %s %s -xattrs -comp xz' % (self.portage_configroot, squashfs_path)
+        Execute(cmd, timeout=None, logfile=self.logfile)
+        #
+        # 3. prepare the grub bootloader
+        #    copy in stage2_eltorito into iso/boot/grub
+        #    copy in menu.lst into iso/boot/grub
+        #
+        # 4. create the iso image
+        #    mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 \
+        #        -boot-info-table -o medium_pathname.iso iso

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 5f06fe9..4fdb31b 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -24,6 +24,7 @@ import time
 
 from grs.Constants import CONST
 from grs.Daemon import Daemon
+from grs.ISOIt import ISOIt
 from grs.Log import Log
 from grs.Kernel import Kernel
 from grs.MountDirectories import MountDirectories
@@ -130,6 +131,7 @@ class Interpret(Daemon):
         pc = PivotChroot(tmpdir, portage_configroot, logfile)
         ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         bi = TarIt(name, portage_configroot, logfile)
+        io = ISOIt(name, libdir, workdir, portage_configroot, logfile)
 
         # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)
@@ -193,7 +195,10 @@ class Interpret(Daemon):
                     obj = None
 
                 # This long concatenated if is where the semantics of the
-                # build script are implemented.
+                # build script are implemented.  Note: 'hashit' can only come
+                # after 'tarit' or 'isoit' so that it knows the medium_name
+                # to hash, ie whether its a .tar.xz or a .iso
+                medium_type = None
                 if verb == '':
                     stampit(progress)
                     continue
@@ -244,11 +249,27 @@ class Interpret(Daemon):
                     else:
                         smartlog(l, obj, False)
                         bi.tarit()
+                    medium_type = 'tarit'
+                elif verb == 'isoit':
+                    # 'isoit' can either be just a verb,
+                    # or a 'verb obj' pair.
+                    if obj:
+                        smartlog(l, obj, True)
+                        io.isoit(obj)
+                    else:
+                        smartlog(l, obj, False)
+                        io.isoit()
+                    medium_type = 'isoit'
                 elif verb == 'hashit':
                     if smartlog(l, obj, False):
                         stampit(progress)
                         continue
-                    bi.hashit()
+                    if medium_type == 'tarit':
+                        bi.hashit()
+                    elif medium_type == 'isoit':
+                        io.hashit()
+                    else:
+                        raise Exception('Unknown medium to hash.')
                 else:
                     lo.log('Bad command: %s' % l)
 

diff --git a/grs/__init__.py b/grs/__init__.py
index 2ed47f7..fb1b64b 100644
--- a/grs/__init__.py
+++ b/grs/__init__.py
@@ -21,6 +21,7 @@ from grs.Daemon import Daemon
 from grs.Execute import Execute
 from grs.HashIt import HashIt
 from grs.Interpret import Interpret
+from grs.ISOIt import ISOIt
 from grs.Log import Log
 from grs.Kernel import Kernel
 from grs.MountDirectories import MountDirectories


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-12 20:56 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-12 20:56 UTC (permalink / raw
  To: gentoo-commits

commit:     cd8a1249340c70ea0fce5fd9a1fb7f02a3dcf511
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 12 18:17:49 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Sep 12 21:01:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=cd8a1249

grs/HashIt.py: make into inheritable class.

 grs/{TarIt.py => HashIt.py} | 46 +++++++++---------------------------------
 grs/TarIt.py                | 49 ++++++++-------------------------------------
 grs/__init__.py             |  3 ++-
 3 files changed, 20 insertions(+), 78 deletions(-)

diff --git a/grs/TarIt.py b/grs/HashIt.py
similarity index 51%
copy from grs/TarIt.py
copy to grs/HashIt.py
index b63258b..817364a 100644
--- a/grs/TarIt.py
+++ b/grs/HashIt.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-#    TarIt.py: this file is part of the GRS suite
+#    HashIt.py: this file is part of the GRS suite
 #    Copyright (C) 2015  Anthony G. Basile
 #
 #    This program is free software: you can redistribute it and/or modify
@@ -17,39 +17,13 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
-from datetime import datetime
-from grs.Constants import CONST
 from grs.Execute import Execute
 
-class TarIt():
-    """ Create a tarball of the system and generate the hash values. """
-
-    def __init__(self, name, portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
-        self.portage_configroot = portage_configroot
-        self.logfile = logfile
-        # Prepare a year, month and day for a tarball name timestamp.
-        self.year = str(datetime.now().year).zfill(4)
-        self.month = str(datetime.now().month).zfill(2)
-        self.day = str(datetime.now().day).zfill(2)
-        self.tarball_name = '%s-%s%s%s.tar.xz' % (name, self.year, self.month, self.day)
-        self.digest_name = '%s.DIGESTS' % self.tarball_name
-
-
-    def tarit(self, alt_name = None):
-        # Create the tarball with the default name unless an alt_name is given.
-        if alt_name:
-            self.tarball_name = '%s-%s%s%s.tar.xz' % (alt_name, self.year, self.month, self.day)
-            self.digest_name = '%s.DIGESTS' % self.tarball_name
-        # We have to cd into the system's portage configroot and then out again.
-        cwd = os.getcwd()
-        os.chdir(self.portage_configroot)
-        tarball_path = os.path.join('..', self.tarball_name)
-        # TODO: This needs to be generalized for systems that don't support xattrs
-        xattr_opts = '--xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags'
-        cmd = 'tar %s -Jcf %s .' % (xattr_opts, tarball_path)
-        Execute(cmd, timeout=None, logfile=self.logfile)
-        os.chdir(cwd)
-
+class HashIt():
+    """ Create a DIGEST file for certain tarballs, or ISOs.  This class must
+        be inherited by a class which sets the medium_name and digest_name,
+        else we'll get an AttributeError exception.
+    """
 
     def hashit(self):
         """ Generate various hash values.  We hijack the 'logfile' which will
@@ -64,22 +38,22 @@ class TarIt():
         # Note: this first cmd clobbers the contents
         cmd = 'echo "# MD5 HASH"'
         Execute(cmd, logfile=self.digest_name)
-        cmd = 'md5sum %s' % self.tarball_name
+        cmd = 'md5sum %s' % self.medium_name
         Execute(cmd, timeout=60, logfile=self.digest_name)
 
         cmd = 'echo "# SHA1 HASH"'
         Execute(cmd, logfile=self.digest_name)
-        cmd = 'sha1sum %s' % self.tarball_name
+        cmd = 'sha1sum %s' % self.medium_name
         Execute(cmd, timeout=60, logfile=self.digest_name)
 
         cmd = 'echo "# SHA512 HASH"'
         Execute(cmd, logfile=self.digest_name)
-        cmd = 'sha512sum %s' % self.tarball_name
+        cmd = 'sha512sum %s' % self.medium_name
         Execute(cmd, timeout=60, logfile=self.digest_name)
 
         cmd = 'echo "# WHIRLPOOL HASH"'
         Execute(cmd, logfile=self.digest_name)
-        cmd = 'whirlpooldeep %s' % self.tarball_name
+        cmd = 'whirlpooldeep %s' % self.medium_name
         Execute(cmd, timeout=60, logfile=self.digest_name)
 
         os.chdir(cwd)

diff --git a/grs/TarIt.py b/grs/TarIt.py
index b63258b..d421cf2 100644
--- a/grs/TarIt.py
+++ b/grs/TarIt.py
@@ -20,9 +20,10 @@ import os
 from datetime import datetime
 from grs.Constants import CONST
 from grs.Execute import Execute
+from grs.HashIt import HashIt
 
-class TarIt():
-    """ Create a tarball of the system and generate the hash values. """
+class TarIt(HashIt):
+    """ Create a tarball of the system. """
 
     def __init__(self, name, portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
         self.portage_configroot = portage_configroot
@@ -31,55 +32,21 @@ class TarIt():
         self.year = str(datetime.now().year).zfill(4)
         self.month = str(datetime.now().month).zfill(2)
         self.day = str(datetime.now().day).zfill(2)
-        self.tarball_name = '%s-%s%s%s.tar.xz' % (name, self.year, self.month, self.day)
-        self.digest_name = '%s.DIGESTS' % self.tarball_name
+        self.medium_name = '%s-%s%s%s.tar.xz' % (name, self.year, self.month, self.day)
+        self.digest_name = '%s.DIGESTS' % self.medium_name
 
 
     def tarit(self, alt_name = None):
         # Create the tarball with the default name unless an alt_name is given.
         if alt_name:
-            self.tarball_name = '%s-%s%s%s.tar.xz' % (alt_name, self.year, self.month, self.day)
-            self.digest_name = '%s.DIGESTS' % self.tarball_name
+            self.medium_name = '%s-%s%s%s.tar.xz' % (alt_name, self.year, self.month, self.day)
+            self.digest_name = '%s.DIGESTS' % self.medium_name
         # We have to cd into the system's portage configroot and then out again.
         cwd = os.getcwd()
         os.chdir(self.portage_configroot)
-        tarball_path = os.path.join('..', self.tarball_name)
+        tarball_path = os.path.join('..', self.medium_name)
         # TODO: This needs to be generalized for systems that don't support xattrs
         xattr_opts = '--xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags'
         cmd = 'tar %s -Jcf %s .' % (xattr_opts, tarball_path)
         Execute(cmd, timeout=None, logfile=self.logfile)
         os.chdir(cwd)
-
-
-    def hashit(self):
-        """ Generate various hash values.  We hijack the 'logfile' which will
-            actually be the file containing the hashes.
-        """
-        # We need to be in the parent of the system's portage configroot because
-        # that's where we created the above tarball.  This should be the workdir,
-        # but its probably safer to be pedantic here.
-        cwd = os.getcwd()
-        os.chdir(os.path.join(self.portage_configroot, '..'))
-
-        # Note: this first cmd clobbers the contents
-        cmd = 'echo "# MD5 HASH"'
-        Execute(cmd, logfile=self.digest_name)
-        cmd = 'md5sum %s' % self.tarball_name
-        Execute(cmd, timeout=60, logfile=self.digest_name)
-
-        cmd = 'echo "# SHA1 HASH"'
-        Execute(cmd, logfile=self.digest_name)
-        cmd = 'sha1sum %s' % self.tarball_name
-        Execute(cmd, timeout=60, logfile=self.digest_name)
-
-        cmd = 'echo "# SHA512 HASH"'
-        Execute(cmd, logfile=self.digest_name)
-        cmd = 'sha512sum %s' % self.tarball_name
-        Execute(cmd, timeout=60, logfile=self.digest_name)
-
-        cmd = 'echo "# WHIRLPOOL HASH"'
-        Execute(cmd, logfile=self.digest_name)
-        cmd = 'whirlpooldeep %s' % self.tarball_name
-        Execute(cmd, timeout=60, logfile=self.digest_name)
-
-        os.chdir(cwd)

diff --git a/grs/__init__.py b/grs/__init__.py
index a011b2e..2ed47f7 100644
--- a/grs/__init__.py
+++ b/grs/__init__.py
@@ -16,10 +16,10 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from grs.TarIt import TarIt
 from grs.Constants import CONST
 from grs.Daemon import Daemon
 from grs.Execute import Execute
+from grs.HashIt import HashIt
 from grs.Interpret import Interpret
 from grs.Log import Log
 from grs.Kernel import Kernel
@@ -30,4 +30,5 @@ from grs.Rotator import Rotator
 from grs.RunScript import RunScript
 from grs.Synchronize import Synchronize
 from grs.Seed import Seed
+from grs.TarIt import TarIt
 from grs.WorldConf import WorldConf


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-13 17:31 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-13 17:31 UTC (permalink / raw
  To: gentoo-commits

commit:     363fc06845b0666dda39b48c205aa382168acd7a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 13 17:35:51 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Sep 13 17:35:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=363fc068

grs/ISOIt.py: add in build for initramfs and iso.

 grs/ISOIt.py | 104 +++++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 83 insertions(+), 21 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index 9b3a920..2a0be81 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -39,31 +39,93 @@ class ISOIt(HashIt):
         self.digest_name = '%s.DIGESTS' % self.medium_name
 
 
+    def initramfs(self, isoboot_dir):
+        """ TODO """
+        # Paths to where we'll build busybox and the initramfs.
+        busybox_root     = os.path.join(self.workdir, 'busybox')
+        busybox_path     = os.path.join(busybox_root, 'bin/busybox')
+        savedconfig_path = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps/busybox')
+        busybox_config   = os.path.join(self.libdir, 'scripts/busybox-config')
+
+        # Remove any old busybox build directory and prepare new one.
+        shutil.rmtree(busybox_root, ignore_errors=True)
+        os.makedirs(savedconfig_dir, mode=0o755, exist_ok=True)
+        shutil.copyfile(busybox_config, savedconfig_path)
+
+        # Emerge busybox.
+        cmd = 'emerge --nodeps -1 busybox'
+        emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : busybox_root }
+        Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
+
+        # Remove any old initramfs root and prepare a new one.
+        initramfs_root = os.path.join(self.workdir, 'initramfs')
+        shutil.rmtree(initramfs_root, ignore_errors=True)
+        root_paths = ['bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs',
+            'proc', 'sbin', 'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run']
+        for p in root_paths:
+            d = os.path.join(initramfs_root, p)
+            os.makdirs(d, mode=0o755, exist_ok=True)
+
+        # Copy the static busybox to the initramfs root.
+        # TODO: we are assuming a static busybox, so we should check.
+        shutil.copyfile(busybox_path, os.join.path(initramfs_root, 'bin/busybox'))
+        cmd = 'chroot %s /bin/busybox --install -s' % initramfs_root
+        Execute(cmd, timeout=60, logfile=self.logfile)
+        initscript_path = os.path.join(self.libdir, 'scripts/initramfs-init')
+        shutil.copy(initscript_path, initramfs_root)
+
+        # TODO: we are assuming a static kernel and so not copying in
+        # any modules.  This is where we should copy in modules.
+
+        # cpio-gzip the initramfs root to the iso boot dir
+        initramfs_path = os.path.join(isoboot_dir, 'initramfs')
+        cwd = os.getcwd()
+        os.chdir(initramfs_root)
+        cmd = 'find . | cpio -H newc -o | gzip -9 > %s' % initramfs_path
+        Execute(cmd, timeout=600, logfile=self.logfile)
+        os.chdir(cwd)
+
+
     def isoit(self, alt_name = None):
         # Create the ISO with the default name unless an alt_name is given.
         if alt_name:
             self.medium_name = '%s-%s%s%s.iso' % (alt_name, self.year, self.month, self.day)
             self.digest_name = '%s.DIGESTS' % self.medium_name
-        iso_path = os.path.join(self.workdir, 'iso')
-        grub_path = os.path.join(iso_path, 'boot/grub')
-        os.makedirs(grub_path, mode=0o755, exist_ok=False)
-        #
+        iso_dir     = os.path.join(self.workdir, 'iso')
+        isoboot_dir = os.path.join(iso_dir, 'boot')
+        isogrub_dir = os.path.join(isoboot_dir, 'grub')
+        os.makedirs(isogrub_dir, mode=0o755, exist_ok=False)
+
         # 1. build initramfs image and copy it in
-        #    locate a build script for the initramfs in self.libdir/scripts
-        #    locate a busybox config script in self.libdir/scripts
-        #    locate an init scripts in self.libdir/scripts
-        #    copy in any kernel modules(?)
-        #    find . | cpio -H newc -o | gzip -9 > iso/boot/initramfs.igz
-        #
-        # 2. make the squashfs image and copy it into the iso/boot
-        squashfs_path = os.path.join(iso_path, 'rootfs')
+        self.initramfs(isoboot_dir)
+
+        # 2. Move the kernel image into the iso/boot directory.
+        # TODO: we are assuming a static kernel
+        kernelimage_dir  = os.path.join(self.portage_configroot, 'boot')
+        kernelimage_path = os.path.join(kernelimage_dir, 'kernel')
+        shutil.copy(kernelimage_path, isoboot_dir)
+        shutil.rmtree(kernelimage_dir, ignore_errors=True)
+
+        # 3. make the squashfs image and copy it into the iso/boot
+        squashfs_path = os.path.join(iso_dir, 'rootfs')
         cmd = 'mksquashfs %s %s -xattrs -comp xz' % (self.portage_configroot, squashfs_path)
-        Execute(cmd, timeout=None, logfile=self.logfile)
-        #
-        # 3. prepare the grub bootloader
-        #    copy in stage2_eltorito into iso/boot/grub
-        #    copy in menu.lst into iso/boot/grub
-        #
-        # 4. create the iso image
-        #    mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 \
-        #        -boot-info-table -o medium_pathname.iso iso
+        Execute(cmd, timeout=600, logfile=self.logfile)
+
+        # 4. Emerge grub:0 to grab stage2_eltorito
+        grub_root     = os.path.join(self.workdir, 'grub')
+        eltorito_path = os.path.join(grub_root, 'boot/grub/stage2_eltorito')
+        menulst_path  = os.path.join(self.libdir, 'scripts/menu.lst')
+        cmd = 'emerge --nodeps -1 grub:0'
+        emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : grub_root }
+        Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
+        shutil.copyfile(eltorito_path, isogrub_dir)
+        shutil.copyfile(menulst_path, isogrub_dir)
+
+        # 5. create the iso image
+        args  = '-R '                           # Rock Ridge protocol
+        args += '-b boot/grub/stage2_eltorito ' # El Torito boot image
+        args += '-no-emul-boot '                # No disk emulation for El Torito
+        args += '-boot-load-size 4 '            # 4x512-bit sectors for no-emulation mode
+        args += '-boot-info-table '             # Create El Torito boot info table
+        cmd = 'mkisofs %s -o %s %s' % (args, self.medium_pathname, iso_dir)
+        Execute(cmd, timeout=600, logfile=self.logfile)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-14  0:29 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-14  0:29 UTC (permalink / raw
  To: gentoo-commits

commit:     f94049b00db8ee54bb4d616570e372589efa5234
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 14 00:33:54 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Sep 14 00:33:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=f94049b0

grs/ISOIt.py: fix various path issues.

 grs/ISOIt.py     | 39 ++++++++++++++++++++++++---------------
 grs/Interpret.py |  2 +-
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index 2a0be81..7db86d3 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -17,6 +17,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
+import shutil
 from datetime import datetime
 from grs.Constants import CONST
 from grs.Execute import Execute
@@ -25,10 +26,10 @@ from grs.HashIt import HashIt
 class ISOIt(HashIt):
     """ Create a bootable ISO of the system. """
 
-    def __init__(self, name, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \
+    def __init__(self, name, libdir = CONST.LIBDIR, tmpdir = CONST.TMPDIR, \
             portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
         self.libdir = libdir
-        self.workdir = workdir
+        self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile
         # Prepare a year, month and day for a ISO name timestamp.
@@ -42,9 +43,10 @@ class ISOIt(HashIt):
     def initramfs(self, isoboot_dir):
         """ TODO """
         # Paths to where we'll build busybox and the initramfs.
-        busybox_root     = os.path.join(self.workdir, 'busybox')
+        busybox_root     = os.path.join(self.tmpdir, 'busybox')
         busybox_path     = os.path.join(busybox_root, 'bin/busybox')
-        savedconfig_path = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps/busybox')
+        savedconfig_dir  = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps')
+        savedconfig_path = os.path.join(savedconfig_dir, 'busybox')
         busybox_config   = os.path.join(self.libdir, 'scripts/busybox-config')
 
         # Remove any old busybox build directory and prepare new one.
@@ -53,26 +55,30 @@ class ISOIt(HashIt):
         shutil.copyfile(busybox_config, savedconfig_path)
 
         # Emerge busybox.
-        cmd = 'emerge --nodeps -1 busybox'
+        cmd = 'emerge --nodeps -1q busybox'
         emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : busybox_root }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
         # Remove any old initramfs root and prepare a new one.
-        initramfs_root = os.path.join(self.workdir, 'initramfs')
+        initramfs_root = os.path.join(self.tmpdir, 'initramfs')
         shutil.rmtree(initramfs_root, ignore_errors=True)
         root_paths = ['bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs',
             'proc', 'sbin', 'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run']
         for p in root_paths:
             d = os.path.join(initramfs_root, p)
-            os.makdirs(d, mode=0o755, exist_ok=True)
+            os.makedirs(d, mode=0o755, exist_ok=True)
 
         # Copy the static busybox to the initramfs root.
         # TODO: we are assuming a static busybox, so we should check.
-        shutil.copyfile(busybox_path, os.join.path(initramfs_root, 'bin/busybox'))
+        busybox_initramfs_path = os.path.join(initramfs_root, 'bin/busybox')
+        shutil.copyfile(busybox_path, busybox_initramfs_path)
+        os.chmod(busybox_initramfs_path, 0o0755)
         cmd = 'chroot %s /bin/busybox --install -s' % initramfs_root
         Execute(cmd, timeout=60, logfile=self.logfile)
         initscript_path = os.path.join(self.libdir, 'scripts/initramfs-init')
-        shutil.copy(initscript_path, initramfs_root)
+        init_initramfs_path = os.path.join(initramfs_root, 'init')
+        shutil.copy(initscript_path, init_initramfs_path)
+        os.chmod(init_initramfs_path, 0o0755)
 
         # TODO: we are assuming a static kernel and so not copying in
         # any modules.  This is where we should copy in modules.
@@ -81,8 +87,9 @@ class ISOIt(HashIt):
         initramfs_path = os.path.join(isoboot_dir, 'initramfs')
         cwd = os.getcwd()
         os.chdir(initramfs_root)
-        cmd = 'find . | cpio -H newc -o | gzip -9 > %s' % initramfs_path
-        Execute(cmd, timeout=600, logfile=self.logfile)
+        cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_path
+        # Can't pipe commands, so we'll have to find another way
+        #Execute(cmd, timeout=600, logfile=self.logfile)
         os.chdir(cwd)
 
 
@@ -91,9 +98,10 @@ class ISOIt(HashIt):
         if alt_name:
             self.medium_name = '%s-%s%s%s.iso' % (alt_name, self.year, self.month, self.day)
             self.digest_name = '%s.DIGESTS' % self.medium_name
-        iso_dir     = os.path.join(self.workdir, 'iso')
+        iso_dir     = os.path.join(self.tmpdir, 'iso')
         isoboot_dir = os.path.join(iso_dir, 'boot')
         isogrub_dir = os.path.join(isoboot_dir, 'grub')
+        shutil.rmtree(iso_dir, ignore_errors=True)
         os.makedirs(isogrub_dir, mode=0o755, exist_ok=False)
 
         # 1. build initramfs image and copy it in
@@ -112,10 +120,10 @@ class ISOIt(HashIt):
         Execute(cmd, timeout=600, logfile=self.logfile)
 
         # 4. Emerge grub:0 to grab stage2_eltorito
-        grub_root     = os.path.join(self.workdir, 'grub')
+        grub_root     = os.path.join(self.tmpdir, 'grub')
         eltorito_path = os.path.join(grub_root, 'boot/grub/stage2_eltorito')
         menulst_path  = os.path.join(self.libdir, 'scripts/menu.lst')
-        cmd = 'emerge --nodeps -1 grub:0'
+        cmd = 'emerge --nodeps -1q grub:0'
         emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : grub_root }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
         shutil.copyfile(eltorito_path, isogrub_dir)
@@ -127,5 +135,6 @@ class ISOIt(HashIt):
         args += '-no-emul-boot '                # No disk emulation for El Torito
         args += '-boot-load-size 4 '            # 4x512-bit sectors for no-emulation mode
         args += '-boot-info-table '             # Create El Torito boot info table
-        cmd = 'mkisofs %s -o %s %s' % (args, self.medium_pathname, iso_dir)
+        medium_path = os.path.join(self.tmpdir, self.medium_name)
+        cmd = 'mkisofs %s -o %s %s' % (args, medium_path, iso_dir)
         Execute(cmd, timeout=600, logfile=self.logfile)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 4fdb31b..05fdc64 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -131,7 +131,7 @@ class Interpret(Daemon):
         pc = PivotChroot(tmpdir, portage_configroot, logfile)
         ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         bi = TarIt(name, portage_configroot, logfile)
-        io = ISOIt(name, libdir, workdir, portage_configroot, logfile)
+        io = ISOIt(name, libdir, tmpdir, portage_configroot, logfile)
 
         # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-14  5:25 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-14  5:25 UTC (permalink / raw
  To: gentoo-commits

commit:     cd2eb679f30ce189d8951f8f8982538e3fa9eb1d
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 14 05:30:04 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Sep 14 05:30:04 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=cd2eb679

grs/ISOIt.py: fix build of busybox.

 grs/ISOIt.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index 7db86d3..dcf05fe 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -45,6 +45,7 @@ class ISOIt(HashIt):
         # Paths to where we'll build busybox and the initramfs.
         busybox_root     = os.path.join(self.tmpdir, 'busybox')
         busybox_path     = os.path.join(busybox_root, 'bin/busybox')
+        makeprofile_path = os.path.join(busybox_root, 'etc/portage/make.profile')
         savedconfig_dir  = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps')
         savedconfig_path = os.path.join(savedconfig_dir, 'busybox')
         busybox_config   = os.path.join(self.libdir, 'scripts/busybox-config')
@@ -52,11 +53,13 @@ class ISOIt(HashIt):
         # Remove any old busybox build directory and prepare new one.
         shutil.rmtree(busybox_root, ignore_errors=True)
         os.makedirs(savedconfig_dir, mode=0o755, exist_ok=True)
-        shutil.copyfile(busybox_config, savedconfig_path)
+        shutil.copy(busybox_config, savedconfig_path)
 
         # Emerge busybox.
+        os.symlink('/usr/portage/profiles/hardened/linux/amd64', makeprofile_path)
         cmd = 'emerge --nodeps -1q busybox'
-        emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : busybox_root }
+        emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : busybox_root,
+            'PORTAGE_CONFIGROOT' : busybox_root }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
         # Remove any old initramfs root and prepare a new one.
@@ -71,10 +74,12 @@ class ISOIt(HashIt):
         # Copy the static busybox to the initramfs root.
         # TODO: we are assuming a static busybox, so we should check.
         busybox_initramfs_path = os.path.join(initramfs_root, 'bin/busybox')
-        shutil.copyfile(busybox_path, busybox_initramfs_path)
+        shutil.copy(busybox_path, busybox_initramfs_path)
         os.chmod(busybox_initramfs_path, 0o0755)
         cmd = 'chroot %s /bin/busybox --install -s' % initramfs_root
         Execute(cmd, timeout=60, logfile=self.logfile)
+
+        # Copy the init script to the initramfs root.
         initscript_path = os.path.join(self.libdir, 'scripts/initramfs-init')
         init_initramfs_path = os.path.join(initramfs_root, 'init')
         shutil.copy(initscript_path, init_initramfs_path)
@@ -126,8 +131,8 @@ class ISOIt(HashIt):
         cmd = 'emerge --nodeps -1q grub:0'
         emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : grub_root }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
-        shutil.copyfile(eltorito_path, isogrub_dir)
-        shutil.copyfile(menulst_path, isogrub_dir)
+        shutil.copy(eltorito_path, isogrub_dir)
+        shutil.copy(menulst_path, isogrub_dir)
 
         # 5. create the iso image
         args  = '-R '                           # Rock Ridge protocol


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-14  5:32 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-14  5:32 UTC (permalink / raw
  To: gentoo-commits

commit:     efdd9595bd4af8e636b46f4eb10a7f75637d4b6e
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 14 05:37:12 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Sep 14 05:37:12 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=efdd9595

grs/ISOIt.py: do not remove /boot from system root.

 grs/ISOIt.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index dcf05fe..ff63506 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -117,7 +117,8 @@ class ISOIt(HashIt):
         kernelimage_dir  = os.path.join(self.portage_configroot, 'boot')
         kernelimage_path = os.path.join(kernelimage_dir, 'kernel')
         shutil.copy(kernelimage_path, isoboot_dir)
-        shutil.rmtree(kernelimage_dir, ignore_errors=True)
+        # If this fails, we'll have to rebuild the kernel!
+        #shutil.rmtree(kernelimage_dir, ignore_errors=True)
 
         # 3. make the squashfs image and copy it into the iso/boot
         squashfs_path = os.path.join(iso_dir, 'rootfs')


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-14  7:17 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-14  7:17 UTC (permalink / raw
  To: gentoo-commits

commit:     b4b3090dd905c7f0323c446bae1155b5c4f59710
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 14 07:21:42 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Sep 14 07:21:42 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b4b3090d

grs/Interpret.py: fix medium_type for hashit.

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 05fdc64..b99fd35 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -158,6 +158,7 @@ class Interpret(Daemon):
         build_script = os.path.join(libdir, 'build')
         with open(build_script, 'r') as s:
             line_number = 0
+            medium_type = None
             for l in s.readlines():
                 line_number += 1
 
@@ -198,7 +199,6 @@ class Interpret(Daemon):
                 # build script are implemented.  Note: 'hashit' can only come
                 # after 'tarit' or 'isoit' so that it knows the medium_name
                 # to hash, ie whether its a .tar.xz or a .iso
-                medium_type = None
                 if verb == '':
                     stampit(progress)
                     continue


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-16  0:32 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-16  0:32 UTC (permalink / raw
  To: gentoo-commits

commit:     8b6bca504dd7ef66426c50f8d510987021f872ad
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 16 00:37:10 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Sep 16 00:37:10 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=8b6bca50

grs/Execute.py: allow running of a cmd in a shell.

 grs/Execute.py | 12 ++++++++----
 grs/ISOIt.py   |  4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 25f618f..32286ec 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -27,7 +27,8 @@ from grs.Constants import CONST
 class Execute():
     """ Execute a shell command """
 
-    def __init__(self, cmd, timeout = 1, extra_env = {}, failok = False, logfile = CONST.LOGFILE):
+    def __init__(self, cmd, timeout = 1, extra_env = {}, failok = False, shell = False \
+        logfile = CONST.LOGFILE):
         """ Execute a shell command.
 
             cmd         - Simple string of the command to be execute as a
@@ -54,15 +55,18 @@ class Execute():
             except ProcessLookupError:
                 pass
 
-        args = shlex.split(cmd)
+        if shell:
+            args = cmd
+        else:
+            args = shlex.split(cmd)
         extra_env = dict(os.environ, **extra_env)
 
         if logfile:
             f = open(logfile, 'a')
-            proc = subprocess.Popen(args, stdout=f, stderr=f, env=extra_env)
+            proc = subprocess.Popen(args, stdout=f, stderr=f, env=extra_env, shell=shell)
         else:
             f = sys.stderr
-            proc = subprocess.Popen(args, env=extra_env)
+            proc = subprocess.Popen(args, env=extra_env, shell=shell)
 
         try:
             proc.wait(timeout)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index ff63506..49b97bf 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -93,8 +93,8 @@ class ISOIt(HashIt):
         cwd = os.getcwd()
         os.chdir(initramfs_root)
         cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_path
-        # Can't pipe commands, so we'll have to find another way
-        #Execute(cmd, timeout=600, logfile=self.logfile)
+        # Piped commands must be run in a shell.
+        Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
         os.chdir(cwd)
 
 


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

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

commit:     9d17125630f15b8219a5b967c14fae1a4a4936bc
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 16 00:42:25 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Sep 16 00:42:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=9d171256

grs/Execute.py: fix typo.

 grs/Execute.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 32286ec..355fbe8 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -27,7 +27,7 @@ from grs.Constants import CONST
 class Execute():
     """ Execute a shell command """
 
-    def __init__(self, cmd, timeout = 1, extra_env = {}, failok = False, shell = False \
+    def __init__(self, cmd, timeout = 1, extra_env = {}, failok = False, shell = False, \
         logfile = CONST.LOGFILE):
         """ Execute a shell command.
 


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-16  5:16 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-16  5:16 UTC (permalink / raw
  To: gentoo-commits

commit:     7fd80a5aacbcae4eb5d2526b9d9a831eb089fcdb
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 16 05:21:18 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Sep 16 05:21:18 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=7fd80a5a

grs/Kernel.py: build either modular or static kernel.

 grs/Kernel.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 7f96d91..7ec5615 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -40,12 +40,15 @@ class Kernel():
     def parse_kernel_config(self):
         """ Parse the version to be built/installed from the kernel-config file. """
         with open(self.kernel_config, 'r') as f:
-            for i in range(3):
-                line = f.readline()
+            lines = f.readlines()
+        # Are we building a modular kernel or statically linked?
+        has_modules = 'CONFIG_MODULES=y\n' in lines
+        # The third line is the version line in the kernel config file.
+        version_line = lines[2]
         # The version line looks like the following:
         # Linux/x86 4.0.6-hardened-r2 Kernel Configuration
         # The 2nd group contains the version.
-        m = re.search('^#\s+(\S+)\s+(\S+).+$', line)
+        m = re.search('^#\s+(\S+)\s+(\S+).+$', version_line)
         gentoo_version = m.group(2)
         try:
             # Either the verison is of the form '4.0.6-hardened-r2' with two -'s
@@ -61,7 +64,7 @@ class Kernel():
             flavor = m.group(2)
             pkg_name = flavor + '-sources-' + vanilla_version
         pkg_name = '=sys-kernel/' + pkg_name
-        return (gentoo_version, pkg_name)
+        return (gentoo_version, pkg_name, has_modules)
 
 
     def kernel(self):
@@ -72,7 +75,7 @@ class Kernel():
             and finally installs it to the system's portage configroot.
         """
         # Grab the parsed verison and pkg atom.
-        (gentoo_version, pkg_name) = self.parse_kernel_config()
+        (gentoo_version, pkg_name, has_modules) = self.parse_kernel_config()
 
         # Prepare the paths to where we'll emerge and build the kernel,
         # as well as paths for genkernel.
@@ -117,10 +120,14 @@ class Kernel():
         cmd += '--bootdir=%s '       % boot_dir
         cmd += '--module-prefix=%s ' % image_dir
         cmd += '--modprobedir=%s '   % modprobe_dir
-        cmd += 'all'
+        if has_modules:
+            cmd += 'all'
+        else:
+            cmd += 'bzImage'
         Execute(cmd, timeout=None, logfile=self.logfile)
 
         # Strip the modules to shrink their size enormously!
+        # This will do nothing if there is not modules_dir
         for dirpath, dirnames, filenames in os.walk(modules_dir):
             for filename in filenames:
                 if filename.endswith('.ko'):


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-09-16 22:08 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-09-16 22:08 UTC (permalink / raw
  To: gentoo-commits

commit:     f496edb2c69a19f25f5398c144ef84608b9dce1a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 16 22:13:06 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Sep 16 22:13:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=f496edb2

grs/ISOIt.py: mksquashfs and mkisofs can take a long time.

 grs/ISOIt.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index 49b97bf..a8973c6 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -120,10 +120,11 @@ class ISOIt(HashIt):
         # If this fails, we'll have to rebuild the kernel!
         #shutil.rmtree(kernelimage_dir, ignore_errors=True)
 
-        # 3. make the squashfs image and copy it into the iso/boot
+        # 3. Make the squashfs image and copy it into the iso/boot.
+        # This can take a long time.
         squashfs_path = os.path.join(iso_dir, 'rootfs')
         cmd = 'mksquashfs %s %s -xattrs -comp xz' % (self.portage_configroot, squashfs_path)
-        Execute(cmd, timeout=600, logfile=self.logfile)
+        Execute(cmd, timeout=None, logfile=self.logfile)
 
         # 4. Emerge grub:0 to grab stage2_eltorito
         grub_root     = os.path.join(self.tmpdir, 'grub')
@@ -135,7 +136,7 @@ class ISOIt(HashIt):
         shutil.copy(eltorito_path, isogrub_dir)
         shutil.copy(menulst_path, isogrub_dir)
 
-        # 5. create the iso image
+        # 5. Create the iso image.  This can take a long time.
         args  = '-R '                           # Rock Ridge protocol
         args += '-b boot/grub/stage2_eltorito ' # El Torito boot image
         args += '-no-emul-boot '                # No disk emulation for El Torito
@@ -143,4 +144,4 @@ class ISOIt(HashIt):
         args += '-boot-info-table '             # Create El Torito boot info table
         medium_path = os.path.join(self.tmpdir, self.medium_name)
         cmd = 'mkisofs %s -o %s %s' % (args, medium_path, iso_dir)
-        Execute(cmd, timeout=600, logfile=self.logfile)
+        Execute(cmd, timeout=None, logfile=self.logfile)


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

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

commit:     b14969c273f930374d8c5f6211619c0190752377
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  6 10:13:21 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Oct  6 10:13:21 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b14969c2

lint: fix white spaces

 grs/Constants.py        | 44 ++++++++++++++++++++++----------------------
 grs/Daemon.py           |  2 +-
 grs/Execute.py          |  3 +--
 grs/ISOIt.py            | 31 ++++++++++++++-----------------
 grs/Interpret.py        | 25 ++++++++++++-------------
 grs/Kernel.py           | 13 ++++++-------
 grs/Log.py              |  6 +++---
 grs/MountDirectories.py |  8 ++++----
 grs/PivotChroot.py      |  3 +--
 grs/Populate.py         |  9 ++++-----
 grs/Rotator.py          |  6 +++---
 grs/RunScript.py        |  3 +--
 grs/Seed.py             |  3 +--
 grs/Synchronize.py      |  2 +-
 grs/TarIt.py            |  4 ++--
 grs/WorldConf.py        |  2 +-
 16 files changed, 77 insertions(+), 87 deletions(-)

diff --git a/grs/Constants.py b/grs/Constants.py
index 0025eb4..669f086 100644
--- a/grs/Constants.py
+++ b/grs/Constants.py
@@ -57,21 +57,21 @@ class Constants():
         a GRS namespace.
     """
 
-    def __init__(self, configfile = '/etc/grs/systems.conf'):
+    def __init__(self, configfile='/etc/grs/systems.conf'):
         # If there's no config file, we're dead in the water.
         if not os.path.isfile(configfile):
             raise Exception('Configuration file %s not found\n' % configfile)
 
-        self.config = configparser.ConfigParser(delimiters = ':', comment_prefixes = '#')
+        self.config = configparser.ConfigParser(delimiters=':', comment_prefixes='#')
         self.config.read(configfile)
 
         # These values will probably fail in the future, but that's okay
         # because they really should never be used.  They live outside of
         # any GRS namespace and are just 'defaults'.
-        server    = 'http://distfiles.gentoo.org/'
-        stagedir  = 'releases/amd64/autobuilds/current-stage3-amd64-uclibc-hardened/'
+        server = 'http://distfiles.gentoo.org/'
+        stagedir = 'releases/amd64/autobuilds/current-stage3-amd64-uclibc-hardened/'
         stagefile = 'stage3-amd64-uclibc-hardened-20150510.tar.bz2'
-        default_stage_uri =  server + stagedir + stagefile
+        default_stage_uri = server + stagedir + stagefile
 
         # This is the space of all possible constants for any given GRS namespace
         space = {
@@ -129,7 +129,7 @@ class Constants():
 
     # Don't retrieve the original else you can overwrite it,
     # rather deep copy it.
-    def __getattr__(self, key, value = None):
+    def __getattr__(self, key, value=None):
         if key in self.__dict__:
             return deepcopy(self.__dict__[key])
 
@@ -143,26 +143,26 @@ class Constants():
 CONST = Constants()
 
 # Constants outside any GRS namespace.
-CONST.PACKAGE_NAME        = "Gentoo Reference System"
-CONST.PACKAGE_VERSION     = 0.0
+CONST.PACKAGE_NAME = "Gentoo Reference System"
+CONST.PACKAGE_VERSION = 0.0
 CONST.PACKAGE_DESCRIPTION = "Update a GRS by cloning a predefined system."
-CONST.BUG_REPORTS         = 'http://bugs.gentoo.org'
+CONST.BUG_REPORTS = 'http://bugs.gentoo.org'
 
 # The are defaults in case objects of other classes which depend on values
 # of libdir, logfile, etc. are instantiated outside of any namespaces.
 # They should not be needed under normal working condidtions.
-CONST.LIBDIR              = '/var/lib/grs'
-CONST.LOGFILE             = '/var/log/grs.log'
-CONST.TMPDIR              = '/var/tmp/grs'
-CONST.WORKDIR             = '/var/tmp/grs/work'
-CONST.PACKAGE             = '/var/tmp/grs/package'
-CONST.KERNELROOT          = '/var/tmp/grs/kernel'
-CONST.PORTAGE_CONFIGROOT  = '/var/tmp/grs/system'
-CONST.PIDFILE             = '/run/grs.pid'
+CONST.LIBDIR = '/var/lib/grs'
+CONST.LOGFILE = '/var/log/grs.log'
+CONST.TMPDIR = '/var/tmp/grs'
+CONST.WORKDIR = '/var/tmp/grs/work'
+CONST.PACKAGE = '/var/tmp/grs/package'
+CONST.KERNELROOT = '/var/tmp/grs/kernel'
+CONST.PORTAGE_CONFIGROOT = '/var/tmp/grs/system'
+CONST.PIDFILE = '/run/grs.pid'
 
 # These are used by grsup and are hard coded values.
-CONST.PORTAGE_CONFIGDIR   = '/etc/portage'
-CONST.PORTAGE_DIRTYFILE   = '/etc/portage/.grs_dirty'
-CONST.WORLD_CONFIG        = '/etc/grs/world.conf'
-CONST.GRS_CGROUP          = 'grs'
-CONST.GRS_CGROUPDIR       = '/sys/fs/cgroup/grs'
+CONST.PORTAGE_CONFIGDIR = '/etc/portage'
+CONST.PORTAGE_DIRTYFILE = '/etc/portage/.grs_dirty'
+CONST.WORLD_CONFIG = '/etc/grs/world.conf'
+CONST.GRS_CGROUP = 'grs'
+CONST.GRS_CGROUPDIR = '/sys/fs/cgroup/grs'

diff --git a/grs/Daemon.py b/grs/Daemon.py
index 58927f8..79aaa42 100644
--- a/grs/Daemon.py
+++ b/grs/Daemon.py
@@ -84,7 +84,7 @@ class Daemon:
         # No matter where the exit is initiated, eg from Execute.py
         # we are sure that atexit() will run and delete the pidfile.
         atexit.register(self.delpid)
-        with open(self.pidfile,'w') as pf:
+        with open(self.pidfile, 'w') as pf:
             pf.write('%d\n' % os.getpid())
 
 

diff --git a/grs/Execute.py b/grs/Execute.py
index 355fbe8..1220a53 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -27,8 +27,7 @@ from grs.Constants import CONST
 class Execute():
     """ Execute a shell command """
 
-    def __init__(self, cmd, timeout = 1, extra_env = {}, failok = False, shell = False, \
-        logfile = CONST.LOGFILE):
+    def __init__(self, cmd, timeout=1, extra_env={}, failok=False, shell=False, logfile=CONST.LOGFILE):
         """ Execute a shell command.
 
             cmd         - Simple string of the command to be execute as a

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index a8973c6..d5a410c 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -26,8 +26,7 @@ from grs.HashIt import HashIt
 class ISOIt(HashIt):
     """ Create a bootable ISO of the system. """
 
-    def __init__(self, name, libdir = CONST.LIBDIR, tmpdir = CONST.TMPDIR, \
-            portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
+    def __init__(self, name, libdir=CONST.LIBDIR, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
         self.libdir = libdir
         self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
@@ -43,12 +42,12 @@ class ISOIt(HashIt):
     def initramfs(self, isoboot_dir):
         """ TODO """
         # Paths to where we'll build busybox and the initramfs.
-        busybox_root     = os.path.join(self.tmpdir, 'busybox')
-        busybox_path     = os.path.join(busybox_root, 'bin/busybox')
+        busybox_root = os.path.join(self.tmpdir, 'busybox')
+        busybox_path = os.path.join(busybox_root, 'bin/busybox')
         makeprofile_path = os.path.join(busybox_root, 'etc/portage/make.profile')
-        savedconfig_dir  = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps')
+        savedconfig_dir = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps')
         savedconfig_path = os.path.join(savedconfig_dir, 'busybox')
-        busybox_config   = os.path.join(self.libdir, 'scripts/busybox-config')
+        busybox_config = os.path.join(self.libdir, 'scripts/busybox-config')
 
         # Remove any old busybox build directory and prepare new one.
         shutil.rmtree(busybox_root, ignore_errors=True)
@@ -58,15 +57,13 @@ class ISOIt(HashIt):
         # Emerge busybox.
         os.symlink('/usr/portage/profiles/hardened/linux/amd64', makeprofile_path)
         cmd = 'emerge --nodeps -1q busybox'
-        emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : busybox_root,
-            'PORTAGE_CONFIGROOT' : busybox_root }
+        emerge_env = {'USE' : '-* savedconfig', 'ROOT' : busybox_root, 'PORTAGE_CONFIGROOT' : busybox_root}
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
         # Remove any old initramfs root and prepare a new one.
         initramfs_root = os.path.join(self.tmpdir, 'initramfs')
         shutil.rmtree(initramfs_root, ignore_errors=True)
-        root_paths = ['bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs',
-            'proc', 'sbin', 'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run']
+        root_paths = ['bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs', 'proc', 'sbin', 'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run']
         for p in root_paths:
             d = os.path.join(initramfs_root, p)
             os.makedirs(d, mode=0o755, exist_ok=True)
@@ -98,12 +95,12 @@ class ISOIt(HashIt):
         os.chdir(cwd)
 
 
-    def isoit(self, alt_name = None):
+    def isoit(self, alt_name=None):
         # Create the ISO with the default name unless an alt_name is given.
         if alt_name:
             self.medium_name = '%s-%s%s%s.iso' % (alt_name, self.year, self.month, self.day)
             self.digest_name = '%s.DIGESTS' % self.medium_name
-        iso_dir     = os.path.join(self.tmpdir, 'iso')
+        iso_dir = os.path.join(self.tmpdir, 'iso')
         isoboot_dir = os.path.join(iso_dir, 'boot')
         isogrub_dir = os.path.join(isoboot_dir, 'grub')
         shutil.rmtree(iso_dir, ignore_errors=True)
@@ -114,7 +111,7 @@ class ISOIt(HashIt):
 
         # 2. Move the kernel image into the iso/boot directory.
         # TODO: we are assuming a static kernel
-        kernelimage_dir  = os.path.join(self.portage_configroot, 'boot')
+        kernelimage_dir = os.path.join(self.portage_configroot, 'boot')
         kernelimage_path = os.path.join(kernelimage_dir, 'kernel')
         shutil.copy(kernelimage_path, isoboot_dir)
         # If this fails, we'll have to rebuild the kernel!
@@ -127,17 +124,17 @@ class ISOIt(HashIt):
         Execute(cmd, timeout=None, logfile=self.logfile)
 
         # 4. Emerge grub:0 to grab stage2_eltorito
-        grub_root     = os.path.join(self.tmpdir, 'grub')
+        grub_root = os.path.join(self.tmpdir, 'grub')
         eltorito_path = os.path.join(grub_root, 'boot/grub/stage2_eltorito')
-        menulst_path  = os.path.join(self.libdir, 'scripts/menu.lst')
+        menulst_path = os.path.join(self.libdir, 'scripts/menu.lst')
         cmd = 'emerge --nodeps -1q grub:0'
-        emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : grub_root }
+        emerge_env = {'USE' : '-* savedconfig', 'ROOT' : grub_root}
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
         shutil.copy(eltorito_path, isogrub_dir)
         shutil.copy(menulst_path, isogrub_dir)
 
         # 5. Create the iso image.  This can take a long time.
-        args  = '-R '                           # Rock Ridge protocol
+        args = '-R '                            # Rock Ridge protocol
         args += '-b boot/grub/stage2_eltorito ' # El Torito boot image
         args += '-no-emul-boot '                # No disk emulation for El Torito
         args += '-boot-load-size 4 '            # 4x512-bit sectors for no-emulation mode

diff --git a/grs/Interpret.py b/grs/Interpret.py
index b99fd35..fd36650 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -79,7 +79,7 @@ class Interpret(Daemon):
             sys.exit(signum + 128)
 
 
-        def smartlog(l, obj, has_obj = True):
+        def smartlog(l, obj, has_obj=True):
             """ This logs whether or not we have a grammatically incorrect
                 directive, or we are doing a mock run, and returns whether
                 or not we should execute the directive:
@@ -103,20 +103,19 @@ class Interpret(Daemon):
 
 
         # Register the signals to terminate the entire process cgroup
-        signal.signal(signal.SIGINT,  handler)
+        signal.signal(signal.SIGINT, handler)
         signal.signal(signal.SIGTERM, handler)
 
         # Grab all the GRS namespace variables
-        repo_uri    = CONST.repo_uris[self.run_number]
-        stage_uri   = CONST.stage_uris[self.run_number]
-
-        name        = CONST.names[self.run_number]
-        libdir      = CONST.libdirs[self.run_number]
-        logfile     = CONST.logfiles[self.run_number]
-        tmpdir      = CONST.tmpdirs[self.run_number]
-        workdir     = CONST.workdirs[self.run_number]
-        package     = CONST.packages[self.run_number]
-        kernelroot  = CONST.kernelroots[self.run_number]
+        repo_uri = CONST.repo_uris[self.run_number]
+        stage_uri = CONST.stage_uris[self.run_number]
+        name = CONST.names[self.run_number]
+        libdir = CONST.libdirs[self.run_number]
+        logfile = CONST.logfiles[self.run_number]
+        tmpdir = CONST.tmpdirs[self.run_number]
+        workdir = CONST.workdirs[self.run_number]
+        package = CONST.packages[self.run_number]
+        kernelroot = CONST.kernelroots[self.run_number]
         portage_configroot = CONST.portage_configroots[self.run_number]
 
         # Initialize all the classes that will run the directives from
@@ -190,7 +189,7 @@ class Interpret(Daemon):
                 try:
                     m = re.search('(\S+)\s+(\S+)', l)
                     verb = m.group(1)
-                    obj  = m.group(2)
+                    obj = m.group(2)
                 except AttributeError:
                     verb = l.strip()
                     obj = None

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 7ec5615..559aa57 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -27,8 +27,7 @@ from grs.Execute import Execute
 class Kernel():
     """ Build a linux-image pkg and install when building a system. """
 
-    def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
-            kernelroot = CONST.KERNELROOT, package = CONST.PACKAGE, logfile = CONST.LOGFILE):
+    def __init__(self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, kernelroot=CONST.KERNELROOT, package=CONST.PACKAGE, logfile=CONST.LOGFILE):
         self.libdir = libdir
         self.portage_configroot = portage_configroot
         self.kernelroot = kernelroot
@@ -80,10 +79,10 @@ class Kernel():
         # Prepare the paths to where we'll emerge and build the kernel,
         # as well as paths for genkernel.
         kernel_source = os.path.join(self.kernelroot, 'usr/src/linux')
-        image_dir     = os.path.join(self.kernelroot, gentoo_version)
-        boot_dir      = os.path.join(image_dir, 'boot')
-        modprobe_dir  = os.path.join(image_dir, 'etc/modprobe.d')
-        modules_dir   = os.path.join(image_dir, 'lib/modules')
+        image_dir = os.path.join(self.kernelroot, gentoo_version)
+        boot_dir = os.path.join(image_dir, 'boot')
+        modprobe_dir = os.path.join(image_dir, 'etc/modprobe.d')
+        modules_dir = os.path.join(image_dir, 'lib/modules')
         # Prepare tarball filename and path.  If the tarball already exists,
         # don't rebuild/reinstall it.  Note: It should have been installed to
         # the system's portage configroot when it was first built, so no need
@@ -101,7 +100,7 @@ class Kernel():
 
         # emerge the kernel source.
         cmd = 'emerge --nodeps -1n %s' % pkg_name
-        emerge_env = { 'USE' : 'symlink', 'ROOT' : self.kernelroot, 'ACCEPT_KEYWORDS' : '**' }
+        emerge_env = {'USE' : 'symlink', 'ROOT' : self.kernelroot, 'ACCEPT_KEYWORDS' : '**'}
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
         # Build and install the image outside the portage configroot so

diff --git a/grs/Log.py b/grs/Log.py
index 7bca4f4..aa49b12 100644
--- a/grs/Log.py
+++ b/grs/Log.py
@@ -12,13 +12,13 @@ from grs.Rotator import Rotator
 class Log(Rotator):
     """ Initilize logs, log messages, or rotate logs.  """
 
-    def __init__(self, logfile = CONST.LOGFILE):
+    def __init__(self, logfile=CONST.LOGFILE):
         self.logfile = logfile
         # Make sure the log directory exists
         os.makedirs(os.path.dirname(self.logfile), exist_ok=True)
         open(self.logfile, 'a').close()
 
-    def log(self, msg, stamped = True):
+    def log(self, msg, stamped=True):
         # If requested, stamp a log message with the unix time.
         if stamped:
             current_time = datetime.datetime.now(datetime.timezone.utc)
@@ -28,7 +28,7 @@ class Log(Rotator):
             f.write('%s\n' % msg)
 
 
-    def rotate_logs(self, upper_limit = 20):
+    def rotate_logs(self, upper_limit=20):
         # Rotate all the previous logs
         self.full_rotate(self.logfile, upper_limit=upper_limit)
         open(self.logfile, 'a').close()

diff --git a/grs/MountDirectories.py b/grs/MountDirectories.py
index 37d0f5e..692c320 100644
--- a/grs/MountDirectories.py
+++ b/grs/MountDirectories.py
@@ -26,17 +26,17 @@ class MountDirectories():
         portage configroot.
     """
 
-    def __init__(self, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
-            package = CONST.PACKAGE, logfile = CONST.LOGFILE):
+    def __init__(self, portage_configroot=CONST.PORTAGE_CONFIGROOT, \
+            package=CONST.PACKAGE, logfile=CONST.LOGFILE):
         # The order is respected.  Note that 'dev' needs to be mounted beore 'dev/pts'.
         self.directories = [
             'dev',
             'dev/pts',
-            { 'dev/shm' : ( 'tmpfs', 'shm' ) },
+            {'dev/shm' : ('tmpfs', 'shm')},
             'proc',
             'sys',
             'usr/portage',
-            [ package, 'usr/portage/packages' ]
+            [package, 'usr/portage/packages']
         ]
         # Once initiated, we only work with one portage_configroot
         self.portage_configroot = portage_configroot

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index 962f8fa..6324b6e 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -29,8 +29,7 @@ from grs.Rotator import Rotator
 class PivotChroot(Rotator):
     """ Move an inner chroot out to the new system portage configroot.  """
 
-    def __init__(self, tmpdir = CONST.TMPDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, \
-            logfile = CONST.LOGFILE):
+    def __init__(self, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
         self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile

diff --git a/grs/Populate.py b/grs/Populate.py
index fc7e799..a1822ee 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -27,29 +27,28 @@ class Populate():
         for a particular cycle number.
     """
 
-    def __init__(self, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \
-            portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
+    def __init__(self, libdir=CONST.LIBDIR, workdir=CONST.WORKDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
         self.libdir = libdir
         self.workdir = workdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile
 
 
-    def populate(self, cycle = True):
+    def populate(self, cycle=True):
         """ Copy the core files from the GRS repo, to a local workdir and
             then to the system's portage configroot, selecting for a paricular
             cycle number.
         """
         # rsync from the GRS repo to the workdir, removing the .git directory
         cmd = 'rsync -av --delete --exclude=\'.git*\' %s/core/ %s' % (self.libdir, self.workdir)
-        Execute(cmd, timeout=60, logfile = self.logfile)
+        Execute(cmd, timeout=60, logfile=self.logfile)
 
         # Select the cycle
         if cycle: self.select_cycle(cycle)
 
         # Copy from the workdir to the system's portage configroot.
         cmd = 'rsync -av %s/ %s' % (self.workdir, self.portage_configroot)
-        Execute(cmd, timeout=60, logfile = self. logfile)
+        Execute(cmd, timeout=60, logfile=self.logfile)
 
 
     def select_cycle(self, cycle):

diff --git a/grs/Rotator.py b/grs/Rotator.py
index faa49aa..a1282b2 100644
--- a/grs/Rotator.py
+++ b/grs/Rotator.py
@@ -24,7 +24,7 @@ import shutil
 class Rotator():
     """ Super class for rotating files or directories.  """
 
-    def rotate(self, obj, upper_limit = 20):
+    def rotate(self, obj, upper_limit=20):
         """ Does the work of rotating objects fitting the pattern obj.(d+).
 
             obj -> The absolute path to the objects to be rotated.  The
@@ -63,8 +63,8 @@ class Rotator():
             shutil.move(current_obj, next_obj)
 
 
-    def full_rotate(self, obj, upper_limit = 20):
+    def full_rotate(self, obj, upper_limit=20):
         """ Rotate both obj and obj.(d+). """
-        self.rotate(obj, upper_limit = upper_limit)
+        self.rotate(obj, upper_limit=upper_limit)
         if os.path.exists(obj):
             shutil.move(obj, '%s.0' % obj)

diff --git a/grs/RunScript.py b/grs/RunScript.py
index bd8d4f9..3818fa1 100644
--- a/grs/RunScript.py
+++ b/grs/RunScript.py
@@ -24,8 +24,7 @@ from grs.Execute import Execute
 class RunScript():
     """ Run a script within the chroot. """
 
-    def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, 
-            logfile = CONST.LOGFILE):
+    def __init__(self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
         self.libdir = libdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile

diff --git a/grs/Seed.py b/grs/Seed.py
index ec6fb77..7978d12 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -30,8 +30,7 @@ from grs.Rotator import Rotator
 class Seed(Rotator):
     """ Download a stage tarball and unpack it into an empty system portage configroot. """
 
-    def __init__(self, stage_uri, tmpdir = CONST.TMPDIR, portage_configroot = \
-            CONST.PORTAGE_CONFIGROOT, package = CONST.PACKAGE, logfile = CONST.LOGFILE):
+    def __init__(self, stage_uri, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, package=CONST.PACKAGE, logfile=CONST.LOGFILE):
         self.stage_uri = stage_uri
         self.portage_configroot = portage_configroot
         self.package = package

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 3890196..3ce7d5c 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -23,7 +23,7 @@ from grs.Execute import Execute
 class Synchronize():
     """ Either clone or pull a remote git repository for a GRS system.  """
 
-    def __init__(self, remote_repo, branch, libdir = CONST.LIBDIR, logfile = CONST.LOGFILE):
+    def __init__(self, remote_repo, branch, libdir=CONST.LIBDIR, logfile=CONST.LOGFILE):
         self.remote_repo = remote_repo
         self.branch = branch
         self.local_repo = libdir

diff --git a/grs/TarIt.py b/grs/TarIt.py
index d421cf2..b3d3b32 100644
--- a/grs/TarIt.py
+++ b/grs/TarIt.py
@@ -25,7 +25,7 @@ from grs.HashIt import HashIt
 class TarIt(HashIt):
     """ Create a tarball of the system. """
 
-    def __init__(self, name, portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
+    def __init__(self, name, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
         self.portage_configroot = portage_configroot
         self.logfile = logfile
         # Prepare a year, month and day for a tarball name timestamp.
@@ -36,7 +36,7 @@ class TarIt(HashIt):
         self.digest_name = '%s.DIGESTS' % self.medium_name
 
 
-    def tarit(self, alt_name = None):
+    def tarit(self, alt_name=None):
         # Create the tarball with the default name unless an alt_name is given.
         if alt_name:
             self.medium_name = '%s-%s%s%s.tar.xz' % (alt_name, self.year, self.month, self.day)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index 5930d19..c5882bf 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -68,7 +68,7 @@ class WorldConf():
         """
         # We need to look at all portage provide pkgs and all installed pkgs.
         portdb = portage.db[portage.root]["porttree"].dbapi
-        vardb  = portage.db[portage.root]["vartree"].dbapi
+        vardb = portage.db[portage.root]["vartree"].dbapi
 
         # Remove all installed pkgs from the set of all portage packages.
         uninstalled = portdb.cp_all()


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

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

commit:     31e872a14e53e87a1788dd96cbae1e11683a6487
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  7 08:07:06 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 08:07:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=31e872a1

lint: remove unused imports.

 grs/Daemon.py      | 2 --
 grs/PivotChroot.py | 3 ---
 2 files changed, 5 deletions(-)

diff --git a/grs/Daemon.py b/grs/Daemon.py
index 79aaa42..0cefaef 100644
--- a/grs/Daemon.py
+++ b/grs/Daemon.py
@@ -18,9 +18,7 @@
 
 import atexit
 import os
-import signal
 import sys
-import time
 
 class Daemon:
     """ Adopted from Sander Marechal's "A simple unix/linux daemon in Python"

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index 6324b6e..248bbac 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -16,13 +16,10 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import glob
-import re
 import os
 import shutil
 
 from grs.Constants import CONST
-from grs.MountDirectories import MountDirectories
 from grs.Rotator import Rotator
 
 


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

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

commit:     56bfb6c2fbb15dbc1b9bd2b618a47cc82d5f9a6c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  7 08:37:09 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 08:37:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=56bfb6c2

lint: use raw strings with regexes.

 grs/Interpret.py | 6 +++---
 grs/Kernel.py    | 6 +++---
 grs/Populate.py  | 2 +-
 grs/Rotator.py   | 4 ++--
 grs/WorldConf.py | 8 ++++----
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index fd36650..db5bdd4 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -162,14 +162,14 @@ class Interpret(Daemon):
                 line_number += 1
 
                 # Skip lines with initial # as comments.
-                m = re.search('^(#).*$', l)
+                m = re.search(r'^(#).*$', l)
                 if m:
                     continue
 
                 # For a release run, execute every line of the build script.
                 # For an update run, exexute only lines with a leading +.
                 ignore_stamp = False
-                m = re.search('^(\+)(.*)$', l)
+                m = re.search(r'^(\+)(.*)$', l)
                 if m:
                     # There is a leading +, so remove it and skip if doing an update run
                     ignore_stamp = self.update_run
@@ -187,7 +187,7 @@ class Interpret(Daemon):
                 # single 'verb', or a 'verb obj' pair.  While restrictive,
                 # its good enough for now.
                 try:
-                    m = re.search('(\S+)\s+(\S+)', l)
+                    m = re.search(r'(\S+)\s+(\S+)', l)
                     verb = m.group(1)
                     obj = m.group(2)
                 except AttributeError:

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 559aa57..a8205ba 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -47,18 +47,18 @@ class Kernel():
         # The version line looks like the following:
         # Linux/x86 4.0.6-hardened-r2 Kernel Configuration
         # The 2nd group contains the version.
-        m = re.search('^#\s+(\S+)\s+(\S+).+$', version_line)
+        m = re.search(r'^#\s+(\S+)\s+(\S+).+$', version_line)
         gentoo_version = m.group(2)
         try:
             # Either the verison is of the form '4.0.6-hardened-r2' with two -'s
-            m = re.search('(\S+?)-(\S+?)-(\S+)', gentoo_version)
+            m = re.search(r'(\S+?)-(\S+?)-(\S+)', gentoo_version)
             vanilla_version = m.group(1)
             flavor = m.group(2)
             revision = m.group(3)
             pkg_name = flavor + '-sources-' + vanilla_version + '-' + revision
         except AttributeError:
             # Or the verison is of the form '4.0.6-hardened' with one -
-            m = re.search('(\S+?)-(\S+)', gentoo_version)
+            m = re.search(r'(\S+?)-(\S+)', gentoo_version)
             vanilla_version = m.group(1)
             flavor = m.group(2)
             pkg_name = flavor + '-sources-' + vanilla_version

diff --git a/grs/Populate.py b/grs/Populate.py
index a1822ee..3271cb7 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -64,7 +64,7 @@ class Populate():
         cycled_files = {}
         for dirpath, dirnames, filenames in os.walk(self.workdir):
             for f in filenames:
-                m = re.search('^(.+)\.CYCLE\.(\d+)', f)
+                m = re.search(r'^(.+)\.CYCLE\.(\d+)', f)
                 if m:
                     filename = m.group(1)
                     cycle_no = int(m.group(2))

diff --git a/grs/Rotator.py b/grs/Rotator.py
index a1282b2..9daf7d2 100644
--- a/grs/Rotator.py
+++ b/grs/Rotator.py
@@ -45,7 +45,7 @@ class Rotator():
         objs = glob.glob('%s.*' % obj)
         indexed_obj = {}
         for o in objs:
-            m = re.search('^.+\.(\d+)$', o)
+            m = re.search(r'^.+\.(\d+)$', o)
             indexed_obj[int(m.group(1))] = o
         count = list(indexed_obj.keys())
         count.sort()
@@ -58,7 +58,7 @@ class Rotator():
                 except NotADirectoryError:
                     os.unlink(current_obj)
                 continue
-            m = re.search('^(.+)\.\d+$', current_obj)
+            m = re.search(r'^(.+)\.\d+$', current_obj)
             next_obj = '%s.%d' % (m.group(1), c+1)
             shutil.move(current_obj, next_obj)
 

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index c5882bf..b55110f 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -53,7 +53,7 @@ class WorldConf():
         config.read(CONST.WORLD_CONFIG)
         for s in config.sections():
             for (directory, value) in config[s].items():
-                p_slot_atom = re.sub('[/:]', '_', s)
+                p_slot_atom = re.sub(r'[/:]', '_', s)
                 dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory)
                 fpath = os.path.join(dpath, p_slot_atom)
                 os.makedirs(dpath, mode=0o755, exist_ok=True)
@@ -84,18 +84,18 @@ class WorldConf():
             cpv = portdb.cp_list(p)[0]
             slotvar = portdb.aux_get(cpv, ['SLOT'])[0]
             try:
-                m = re.search('(.+?)\/(.+)', slotvar)
+                m = re.search(r'(.+?)\/(.+)', slotvar)
                 slot = m.group(1)
             except AttributeError:
                 slot = slotvar
-            slot_atoms.append(re.sub('[/:]', '_', '%s:%s' % (p, slot)))
+            slot_atoms.append(re.sub(r'[/:]', '_', '%s:%s' % (p, slot)))
 
         # Also let's get a list of all the possible canonical file names
         config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None)
         config.read(CONST.WORLD_CONFIG)
         canon = []
         for s in config.sections():
-            p_slot_atom = re.sub('[/:]', '_', s)
+            p_slot_atom = re.sub(r'[/:]', '_', s)
             canon.append(p_slot_atom)
 
         # Walk through all files in /etc/portage and remove any files for uninstalled pkgs.


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

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

commit:     5261e5a0b373c0484fb0ec0fcde2a5f91ffbd5c0
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  7 11:03:02 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 11:03:02 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=5261e5a0

lint: fix line length.

 grs/Execute.py     |  4 +++-
 grs/ISOIt.py       | 20 ++++++++++++++++----
 grs/Kernel.py      |  5 ++++-
 grs/PivotChroot.py |  5 ++++-
 grs/Populate.py    |  5 ++++-
 grs/RunScript.py   |  5 ++++-
 grs/Seed.py        |  5 ++++-
 grs/WorldConf.py   |  8 ++++++--
 8 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 1220a53..c42cab2 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -27,7 +27,9 @@ from grs.Constants import CONST
 class Execute():
     """ Execute a shell command """
 
-    def __init__(self, cmd, timeout=1, extra_env={}, failok=False, shell=False, logfile=CONST.LOGFILE):
+    def __init__(
+            self, cmd, timeout=1, extra_env={}, failok=False, shell=False, logfile=CONST.LOGFILE
+    ):
         """ Execute a shell command.
 
             cmd         - Simple string of the command to be execute as a

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index d5a410c..e64e9d3 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -26,7 +26,10 @@ from grs.HashIt import HashIt
 class ISOIt(HashIt):
     """ Create a bootable ISO of the system. """
 
-    def __init__(self, name, libdir=CONST.LIBDIR, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
+    def __init__(
+            self, name, libdir=CONST.LIBDIR, tmpdir=CONST.TMPDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE
+    ):
         self.libdir = libdir
         self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
@@ -55,15 +58,24 @@ class ISOIt(HashIt):
         shutil.copy(busybox_config, savedconfig_path)
 
         # Emerge busybox.
-        os.symlink('/usr/portage/profiles/hardened/linux/amd64', makeprofile_path)
+        os.symlink(
+                '/usr/portage/profiles/hardened/linux/amd64',
+                makeprofile_path
+        )
         cmd = 'emerge --nodeps -1q busybox'
-        emerge_env = {'USE' : '-* savedconfig', 'ROOT' : busybox_root, 'PORTAGE_CONFIGROOT' : busybox_root}
+        emerge_env = {
+                'USE' : '-* savedconfig', 'ROOT' : busybox_root,
+                'PORTAGE_CONFIGROOT' : busybox_root
+        }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
         # Remove any old initramfs root and prepare a new one.
         initramfs_root = os.path.join(self.tmpdir, 'initramfs')
         shutil.rmtree(initramfs_root, ignore_errors=True)
-        root_paths = ['bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs', 'proc', 'sbin', 'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run']
+        root_paths = [
+                'bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs', 'proc', 'sbin',
+                'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run'
+        ]
         for p in root_paths:
             d = os.path.join(initramfs_root, p)
             os.makedirs(d, mode=0o755, exist_ok=True)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index a8205ba..326b56c 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -27,7 +27,10 @@ from grs.Execute import Execute
 class Kernel():
     """ Build a linux-image pkg and install when building a system. """
 
-    def __init__(self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, kernelroot=CONST.KERNELROOT, package=CONST.PACKAGE, logfile=CONST.LOGFILE):
+    def __init__(
+            self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            kernelroot=CONST.KERNELROOT, package=CONST.PACKAGE, logfile=CONST.LOGFILE
+    ):
         self.libdir = libdir
         self.portage_configroot = portage_configroot
         self.kernelroot = kernelroot

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index 248bbac..ce9a35c 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -26,7 +26,10 @@ from grs.Rotator import Rotator
 class PivotChroot(Rotator):
     """ Move an inner chroot out to the new system portage configroot.  """
 
-    def __init__(self, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
+    def __init__(
+            self, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            logfile=CONST.LOGFILE
+    ):
         self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile

diff --git a/grs/Populate.py b/grs/Populate.py
index 3271cb7..1c3f08e 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -27,7 +27,10 @@ class Populate():
         for a particular cycle number.
     """
 
-    def __init__(self, libdir=CONST.LIBDIR, workdir=CONST.WORKDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
+    def __init__(
+            self, libdir=CONST.LIBDIR, workdir=CONST.WORKDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE
+    ):
         self.libdir = libdir
         self.workdir = workdir
         self.portage_configroot = portage_configroot

diff --git a/grs/RunScript.py b/grs/RunScript.py
index 3818fa1..ff45aed 100644
--- a/grs/RunScript.py
+++ b/grs/RunScript.py
@@ -24,7 +24,10 @@ from grs.Execute import Execute
 class RunScript():
     """ Run a script within the chroot. """
 
-    def __init__(self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
+    def __init__(
+            self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            logfile=CONST.LOGFILE
+    ):
         self.libdir = libdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile

diff --git a/grs/Seed.py b/grs/Seed.py
index 7978d12..e2c65c8 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -30,7 +30,10 @@ from grs.Rotator import Rotator
 class Seed(Rotator):
     """ Download a stage tarball and unpack it into an empty system portage configroot. """
 
-    def __init__(self, stage_uri, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT, package=CONST.PACKAGE, logfile=CONST.LOGFILE):
+    def __init__(
+            self, stage_uri, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            package=CONST.PACKAGE, logfile=CONST.LOGFILE
+    ):
         self.stage_uri = stage_uri
         self.portage_configroot = portage_configroot
         self.package = package

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index b55110f..5cc7672 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -49,7 +49,9 @@ class WorldConf():
                     os.remove(fpath)
 
         # Now we can read world.conf and populate an empty /etc/portage.
-        config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None)
+        config = configparser.RawConfigParser(
+                delimiters=':', allow_no_value=True, comment_prefixes=None
+        )
         config.read(CONST.WORLD_CONFIG)
         for s in config.sections():
             for (directory, value) in config[s].items():
@@ -91,7 +93,9 @@ class WorldConf():
             slot_atoms.append(re.sub(r'[/:]', '_', '%s:%s' % (p, slot)))
 
         # Also let's get a list of all the possible canonical file names
-        config = configparser.RawConfigParser(delimiters=':', allow_no_value=True, comment_prefixes=None)
+        config = configparser.RawConfigParser(
+                delimiters=':', allow_no_value=True, comment_prefixes=None
+        )
         config.read(CONST.WORLD_CONFIG)
         canon = []
         for s in config.sections():


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

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

commit:     2e2d3ef3dc540b756bcbddd3d2f871367b297c59
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  7 11:09:09 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 11:09:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=2e2d3ef3

lint: fix indentations.

 grs/ISOIt.py     | 12 ++++++------
 grs/WorldConf.py |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index e64e9d3..ae6b217 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -59,13 +59,13 @@ class ISOIt(HashIt):
 
         # Emerge busybox.
         os.symlink(
-                '/usr/portage/profiles/hardened/linux/amd64',
-                makeprofile_path
+            '/usr/portage/profiles/hardened/linux/amd64',
+            makeprofile_path
         )
         cmd = 'emerge --nodeps -1q busybox'
         emerge_env = {
-                'USE' : '-* savedconfig', 'ROOT' : busybox_root,
-                'PORTAGE_CONFIGROOT' : busybox_root
+            'USE' : '-* savedconfig', 'ROOT' : busybox_root,
+            'PORTAGE_CONFIGROOT' : busybox_root
         }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
@@ -73,8 +73,8 @@ class ISOIt(HashIt):
         initramfs_root = os.path.join(self.tmpdir, 'initramfs')
         shutil.rmtree(initramfs_root, ignore_errors=True)
         root_paths = [
-                'bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs', 'proc', 'sbin',
-                'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run'
+            'bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs', 'proc', 'sbin', 'sys',
+            'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run'
         ]
         for p in root_paths:
             d = os.path.join(initramfs_root, p)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index 5cc7672..e196338 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -50,7 +50,7 @@ class WorldConf():
 
         # Now we can read world.conf and populate an empty /etc/portage.
         config = configparser.RawConfigParser(
-                delimiters=':', allow_no_value=True, comment_prefixes=None
+            delimiters=':', allow_no_value=True, comment_prefixes=None
         )
         config.read(CONST.WORLD_CONFIG)
         for s in config.sections():
@@ -94,7 +94,7 @@ class WorldConf():
 
         # Also let's get a list of all the possible canonical file names
         config = configparser.RawConfigParser(
-                delimiters=':', allow_no_value=True, comment_prefixes=None
+            delimiters=':', allow_no_value=True, comment_prefixes=None
         )
         config.read(CONST.WORLD_CONFIG)
         canon = []


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

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

commit:     10b901b228bbb3667719e0b430cf3bf9d98197b2
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  7 11:12:46 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 11:12:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=10b901b2

lint: more unused imports.

 grs/Log.py       | 3 ---
 grs/WorldConf.py | 1 -
 2 files changed, 4 deletions(-)

diff --git a/grs/Log.py b/grs/Log.py
index aa49b12..a7ac1a3 100644
--- a/grs/Log.py
+++ b/grs/Log.py
@@ -1,10 +1,7 @@
 #!/usr/bin/env python
 
 import datetime
-import glob
 import os
-import re
-import shutil
 
 from grs.Constants import CONST
 from grs.Rotator import Rotator

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index e196338..d28f300 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -17,7 +17,6 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import configparser
-import copy
 import os
 import portage
 import re


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

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

commit:     c4b3254ab91a2079a9fdc657462489215f7b4e0b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  7 11:12:46 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 11:20:40 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=c4b3254a

lint: more unused imports.

 grs/Constants.py | 1 -
 grs/Log.py       | 3 ---
 grs/Populate.py  | 1 -
 grs/Seed.py      | 2 --
 grs/WorldConf.py | 1 -
 5 files changed, 8 deletions(-)

diff --git a/grs/Constants.py b/grs/Constants.py
index 669f086..ecbac40 100644
--- a/grs/Constants.py
+++ b/grs/Constants.py
@@ -17,7 +17,6 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
-import sys
 import configparser
 from copy import deepcopy
 

diff --git a/grs/Log.py b/grs/Log.py
index aa49b12..a7ac1a3 100644
--- a/grs/Log.py
+++ b/grs/Log.py
@@ -1,10 +1,7 @@
 #!/usr/bin/env python
 
 import datetime
-import glob
 import os
-import re
-import shutil
 
 from grs.Constants import CONST
 from grs.Rotator import Rotator

diff --git a/grs/Populate.py b/grs/Populate.py
index 1c3f08e..db35ee2 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -18,7 +18,6 @@
 
 import os
 import re
-import shutil
 from grs.Constants import CONST
 from grs.Execute import Execute
 

diff --git a/grs/Seed.py b/grs/Seed.py
index e2c65c8..2bc429f 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -16,9 +16,7 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import glob
 import os
-import re
 import shutil
 import urllib.request
 

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index e196338..d28f300 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -17,7 +17,6 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import configparser
-import copy
 import os
 import portage
 import re


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

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

commit:     665fc43168025d76c7c474df1835beaa5088589f
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  7 11:34:01 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 11:34:01 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=665fc431

grs/Populate.py: use isinstance() instead of type().

 grs/Populate.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grs/Populate.py b/grs/Populate.py
index db35ee2..c6dce8d 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -46,7 +46,8 @@ class Populate():
         Execute(cmd, timeout=60, logfile=self.logfile)
 
         # Select the cycle
-        if cycle: self.select_cycle(cycle)
+        if cycle:
+            self.select_cycle(cycle)
 
         # Copy from the workdir to the system's portage configroot.
         cmd = 'rsync -av %s/ %s' % (self.workdir, self.portage_configroot)
@@ -73,7 +74,7 @@ class Populate():
                     cycled_files.setdefault(cycle_no, [])
                     cycled_files[cycle_no].append([dirpath, filename])
         # If cycle is just a boolean, then default to the maximum cycle number.
-        if type(cycle) is bool:
+        if isinstance(cycle, bool):
             cycle_no = max(cycled_files)
         else:
             cycle_no = cycle


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-08 17:20 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-08 17:20 UTC (permalink / raw
  To: gentoo-commits

commit:     ddfe7d46bafa8875b43f86c8310e22bf7243e7a1
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  8 17:26:01 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Oct  8 17:26:01 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=ddfe7d46

lint: rename internal variables.

 grs/Daemon.py      |  18 ++++----
 grs/Execute.py     |  22 +++++-----
 grs/ISOIt.py       |   6 +--
 grs/Interpret.py   | 122 ++++++++++++++++++++++++++---------------------------
 grs/Kernel.py      |  22 +++++-----
 grs/Log.py         |   4 +-
 grs/PivotChroot.py |   8 ++--
 grs/Populate.py    |  22 +++++-----
 grs/Rotator.py     |  16 +++----
 grs/Seed.py        |   4 +-
 grs/WorldConf.py   |  40 +++++++++---------
 11 files changed, 142 insertions(+), 142 deletions(-)

diff --git a/grs/Daemon.py b/grs/Daemon.py
index 0cefaef..b97f4e0 100644
--- a/grs/Daemon.py
+++ b/grs/Daemon.py
@@ -67,23 +67,23 @@ class Daemon:
             sys.exit(1)
 
         # Dup stdin to /dev/null, and stdout and stderr to grs-daemon-<pid>.err
-        si = open(os.devnull, 'r')
-        os.dup2(si.fileno(), sys.stdin.fileno())
+        _si = open(os.devnull, 'r')
+        os.dup2(_si.fileno(), sys.stdin.fileno())
 
         os.makedirs('/var/log/grs', mode=0o755, exist_ok=True)
-        se = open('/var/log/grs/grs-daemon-%d.err' % os.getpid(), 'a+')
+        _se = open('/var/log/grs/grs-daemon-%d.err' % os.getpid(), 'a+')
 
         sys.stdout.flush()
-        os.dup2(se.fileno(), sys.stdout.fileno())
+        os.dup2(_se.fileno(), sys.stdout.fileno())
         sys.stderr.flush()
-        os.dup2(se.fileno(), sys.stderr.fileno())
+        os.dup2(_se.fileno(), sys.stderr.fileno())
 
         # Use atexit to remove the pidfile when we shutdown.
         # No matter where the exit is initiated, eg from Execute.py
         # we are sure that atexit() will run and delete the pidfile.
         atexit.register(self.delpid)
-        with open(self.pidfile, 'w') as pf:
-            pf.write('%d\n' % os.getpid())
+        with open(self.pidfile, 'w') as _pf:
+            _pf.write('%d\n' % os.getpid())
 
 
     def delpid(self):
@@ -99,8 +99,8 @@ class Daemon:
         # 1) If the pidfile is stale, remove it and startup as usual.
         # 2) If we're already running, then don't start a second instance.
         try:
-            with open(self.pidfile, 'r') as pf:
-                pid = int(pf.read().strip())
+            with open(self.pidfile, 'r') as _pf:
+                pid = int(_pf.read().strip())
         except IOError:
             pid = None
 

diff --git a/grs/Execute.py b/grs/Execute.py
index c42cab2..3afbecc 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -44,8 +44,8 @@ class Execute():
         """
         def signalexit():
             pid = os.getpid()
-            f.write('SENDING SIGTERM to pid = %d\n' % pid)
-            f.close()
+            _file.write('SENDING SIGTERM to pid = %d\n' % pid)
+            _file.close()
             try:
                 for i in range(10):
                     os.kill(pid, signal.SIGTERM)
@@ -63,10 +63,10 @@ class Execute():
         extra_env = dict(os.environ, **extra_env)
 
         if logfile:
-            f = open(logfile, 'a')
-            proc = subprocess.Popen(args, stdout=f, stderr=f, env=extra_env, shell=shell)
+            _file = open(logfile, 'a')
+            proc = subprocess.Popen(args, stdout=_file, stderr=_file, env=extra_env, shell=shell)
         else:
-            f = sys.stderr
+            _file = sys.stderr
             proc = subprocess.Popen(args, env=extra_env, shell=shell)
 
         try:
@@ -77,18 +77,18 @@ class Execute():
             timed_out = True
 
         if not timed_out:
-            # rc = None if we had a timeout
-            rc = proc.returncode
-            if rc:
-                f.write('EXIT CODE: %d\n' % rc)
+            # _rc = None if we had a timeout
+            _rc = proc.returncode
+            if _rc:
+                _file.write('EXIT CODE: %d\n' % _rc)
                 if not failok:
                     signalexit()
 
         if timed_out:
-            f.write('TIMEOUT ERROR: %s\n' % cmd)
+            _file.write('TIMEOUT ERROR: %s\n' % cmd)
             if not failok:
                 signalexit()
 
         # Only close a logfile, don't close sys.stderr!
         if logfile:
-            f.close()
+            _file.close()

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index ae6b217..d24a542 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -76,9 +76,9 @@ class ISOIt(HashIt):
             'bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs', 'proc', 'sbin', 'sys',
             'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run'
         ]
-        for p in root_paths:
-            d = os.path.join(initramfs_root, p)
-            os.makedirs(d, mode=0o755, exist_ok=True)
+        for _path in root_paths:
+            _dir = os.path.join(initramfs_root, _path)
+            os.makedirs(_dir, mode=0o755, exist_ok=True)
 
         # Copy the static busybox to the initramfs root.
         # TODO: we are assuming a static busybox, so we should check.

diff --git a/grs/Interpret.py b/grs/Interpret.py
index db5bdd4..4e411fd 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -55,12 +55,12 @@ class Interpret(Daemon):
             """
             mypid = os.getpid()
             while True:
-                with open(os.path.join(self.subcgroupdir, 'tasks'), 'r') as f:
-                    lines = f.readlines()
+                with open(os.path.join(self.subcgroupdir, 'tasks'), 'r') as _file:
+                    lines = _file.readlines()
                     if len(lines) <= 1:
                         break
-                    for p in lines:
-                        pid = int(p.strip())
+                    for _pid in lines:
+                        pid = int(_pid.strip())
                         if mypid == pid:
                             continue
                         try:
@@ -73,13 +73,13 @@ class Interpret(Daemon):
                         except ProcessLookupError:
                             pass
             try:
-                md.umount_all()
+                _md.umount_all()
             except NameError:
                 pass
             sys.exit(signum + 128)
 
 
-        def smartlog(l, obj, has_obj=True):
+        def smartlog(_log, obj, has_obj=True):
             """ This logs whether or not we have a grammatically incorrect
                 directive, or we are doing a mock run, and returns whether
                 or not we should execute the directive:
@@ -87,10 +87,10 @@ class Interpret(Daemon):
                     False = don't skip it
             """
             if (has_obj and not obj) or (not has_obj and obj):
-                lo.log('Bad command: %s' % l)
+                _lo.log('Bad command: %s' % _log)
                 return True
             if self.mock_run:
-                lo.log(l)
+                _lo.log(_log)
                 return True
             return False
 
@@ -121,59 +121,59 @@ class Interpret(Daemon):
         # Initialize all the classes that will run the directives from
         # the build script.  Note that we expect these classes to just
         # initialize some variables but not do any work in their initializers.
-        lo = Log(logfile)
-        sy = Synchronize(repo_uri, name, libdir, logfile)
-        se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile)
-        md = MountDirectories(portage_configroot, package, logfile)
-        po = Populate(libdir, workdir, portage_configroot, logfile)
-        ru = RunScript(libdir, portage_configroot, logfile)
-        pc = PivotChroot(tmpdir, portage_configroot, logfile)
-        ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
-        bi = TarIt(name, portage_configroot, logfile)
-        io = ISOIt(name, libdir, tmpdir, portage_configroot, logfile)
+        _lo = Log(logfile)
+        _sy = Synchronize(repo_uri, name, libdir, logfile)
+        _se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile)
+        _md = MountDirectories(portage_configroot, package, logfile)
+        _po = Populate(libdir, workdir, portage_configroot, logfile)
+        _ru = RunScript(libdir, portage_configroot, logfile)
+        _pc = PivotChroot(tmpdir, portage_configroot, logfile)
+        _ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
+        _bi = TarIt(name, portage_configroot, logfile)
+        _io = ISOIt(name, libdir, tmpdir, portage_configroot, logfile)
 
         # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)
 
         # Rotate any prevously existing logs and make unmount any existing
         # bind mounts from a previous run that were not cleaned up.
-        lo.rotate_logs()
-        md.umount_all()
+        _lo.rotate_logs()
+        _md.umount_all()
 
         # Both sync() + seed() do not need build script directives.
         # sync() is done unconditionally for an update run.
         progress = os.path.join(tmpdir, '.completed_sync')
         if not os.path.exists(progress) or self.update_run:
-            sy.sync()
+            _sy.sync()
             stampit(progress)
 
         # seed() is never done for an update run
         progress = os.path.join(tmpdir, '.completed_seed')
         if not os.path.exists(progress) and not self.update_run:
-            se.seed()
+            _se.seed()
             stampit(progress)
 
         # Read the build script and execute a line at a time.
         build_script = os.path.join(libdir, 'build')
-        with open(build_script, 'r') as s:
+        with open(build_script, 'r') as _file:
             line_number = 0
             medium_type = None
-            for l in s.readlines():
+            for _line in _file.readlines():
                 line_number += 1
 
                 # Skip lines with initial # as comments.
-                m = re.search(r'^(#).*$', l)
-                if m:
+                _match = re.search(r'^(#).*$', _line)
+                if _match:
                     continue
 
                 # For a release run, execute every line of the build script.
                 # For an update run, exexute only lines with a leading +.
                 ignore_stamp = False
-                m = re.search(r'^(\+)(.*)$', l)
-                if m:
+                _match = re.search(r'^(\+)(.*)$', _line)
+                if _match:
                     # There is a leading +, so remove it and skip if doing an update run
                     ignore_stamp = self.update_run
-                    l = m.group(2)
+                    _line = _match.group(2)
                 else:
                     # There is no leading +, so skip if this is an update run
                     if self.update_run:
@@ -187,11 +187,11 @@ class Interpret(Daemon):
                 # single 'verb', or a 'verb obj' pair.  While restrictive,
                 # its good enough for now.
                 try:
-                    m = re.search(r'(\S+)\s+(\S+)', l)
-                    verb = m.group(1)
-                    obj = m.group(2)
+                    _match = re.search(r'(\S+)\s+(\S+)', _line)
+                    verb = _match.group(1)
+                    obj = _match.group(2)
                 except AttributeError:
-                    verb = l.strip()
+                    verb = _line.strip()
                     obj = None
 
                 # This long concatenated if is where the semantics of the
@@ -202,81 +202,81 @@ class Interpret(Daemon):
                     stampit(progress)
                     continue
                 if verb == 'log':
-                    if smartlog(l, obj):
+                    if smartlog(_line, obj):
                         stampit(progress)
                         continue
                     if obj == 'stamp':
-                        lo.log('='*80)
+                        _lo.log('='*80)
                     else:
-                        lo.log(obj)
+                        _lo.log(obj)
                 elif verb == 'mount':
-                    if smartlog(l, obj, False):
+                    if smartlog(_line, obj, False):
                         stampit(progress)
                         continue
-                    md.mount_all()
+                    _md.mount_all()
                 elif verb == 'unmount':
-                    if smartlog(l, obj, False):
+                    if smartlog(_line, obj, False):
                         stampit(progress)
                         continue
-                    md.umount_all()
+                    _md.umount_all()
                 elif verb == 'populate':
-                    if smartlog(l, obj):
+                    if smartlog(_line, obj):
                         stampit(progress)
                         continue
-                    po.populate(cycle=int(obj))
+                    _po.populate(cycle=int(obj))
                 elif verb == 'runscript':
-                    if smartlog(l, obj):
+                    if smartlog(_line, obj):
                         stampit(progress)
                         continue
-                    ru.runscript(obj)
+                    _ru.runscript(obj)
                 elif verb == 'pivot':
-                    if smartlog(l, obj):
+                    if smartlog(_line, obj):
                         stampit(progress)
                         continue
-                    pc.pivot(obj, md)
+                    _pc.pivot(obj, _md)
                 elif verb == 'kernel':
-                    if smartlog(l, obj, False):
+                    if smartlog(_line, obj, False):
                         stampit(progress)
                         continue
-                    ke.kernel()
+                    _ke.kernel()
                 elif verb == 'tarit':
                     # 'tarit' can either be just a verb,
                     # or a 'verb obj' pair.
                     if obj:
-                        smartlog(l, obj, True)
-                        bi.tarit(obj)
+                        smartlog(_line, obj, True)
+                        _bi.tarit(obj)
                     else:
-                        smartlog(l, obj, False)
-                        bi.tarit()
+                        smartlog(_line, obj, False)
+                        _bi.tarit()
                     medium_type = 'tarit'
                 elif verb == 'isoit':
                     # 'isoit' can either be just a verb,
                     # or a 'verb obj' pair.
                     if obj:
-                        smartlog(l, obj, True)
-                        io.isoit(obj)
+                        smartlog(_line, obj, True)
+                        _io.isoit(obj)
                     else:
-                        smartlog(l, obj, False)
-                        io.isoit()
+                        smartlog(_line, obj, False)
+                        _io.isoit()
                     medium_type = 'isoit'
                 elif verb == 'hashit':
-                    if smartlog(l, obj, False):
+                    if smartlog(_line, obj, False):
                         stampit(progress)
                         continue
                     if medium_type == 'tarit':
-                        bi.hashit()
+                        _bi.hashit()
                     elif medium_type == 'isoit':
-                        io.hashit()
+                        _io.hashit()
                     else:
                         raise Exception('Unknown medium to hash.')
                 else:
-                    lo.log('Bad command: %s' % l)
+                    _lo.log('Bad command: %s' % _line)
 
                 stampit(progress)
 
         # Just in case the build script lacks a final unmount, if we
         # are done, then let's make sure we clean up after ourselves.
         try:
-            md.umount_all()
+            _md.umount_all()
         except NameError:
             pass

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 326b56c..cd2ecee 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -41,8 +41,8 @@ class Kernel():
 
     def parse_kernel_config(self):
         """ Parse the version to be built/installed from the kernel-config file. """
-        with open(self.kernel_config, 'r') as f:
-            lines = f.readlines()
+        with open(self.kernel_config, 'r') as _file:
+            lines = _file.readlines()
         # Are we building a modular kernel or statically linked?
         has_modules = 'CONFIG_MODULES=y\n' in lines
         # The third line is the version line in the kernel config file.
@@ -50,20 +50,20 @@ class Kernel():
         # The version line looks like the following:
         # Linux/x86 4.0.6-hardened-r2 Kernel Configuration
         # The 2nd group contains the version.
-        m = re.search(r'^#\s+(\S+)\s+(\S+).+$', version_line)
-        gentoo_version = m.group(2)
+        _match = re.search(r'^#\s+(\S+)\s+(\S+).+$', version_line)
+        gentoo_version = _match.group(2)
         try:
             # Either the verison is of the form '4.0.6-hardened-r2' with two -'s
-            m = re.search(r'(\S+?)-(\S+?)-(\S+)', gentoo_version)
-            vanilla_version = m.group(1)
-            flavor = m.group(2)
-            revision = m.group(3)
+            _match = re.search(r'(\S+?)-(\S+?)-(\S+)', gentoo_version)
+            vanilla_version = _match.group(1)
+            flavor = _match.group(2)
+            revision = _match.group(3)
             pkg_name = flavor + '-sources-' + vanilla_version + '-' + revision
         except AttributeError:
             # Or the verison is of the form '4.0.6-hardened' with one -
-            m = re.search(r'(\S+?)-(\S+)', gentoo_version)
-            vanilla_version = m.group(1)
-            flavor = m.group(2)
+            _match = re.search(r'(\S+?)-(\S+)', gentoo_version)
+            vanilla_version = _match.group(1)
+            flavor = _match.group(2)
             pkg_name = flavor + '-sources-' + vanilla_version
         pkg_name = '=sys-kernel/' + pkg_name
         return (gentoo_version, pkg_name, has_modules)

diff --git a/grs/Log.py b/grs/Log.py
index a7ac1a3..3a8ec8a 100644
--- a/grs/Log.py
+++ b/grs/Log.py
@@ -21,8 +21,8 @@ class Log(Rotator):
             current_time = datetime.datetime.now(datetime.timezone.utc)
             unix_timestamp = current_time.timestamp()
             msg = '[%f] %s' % (unix_timestamp, msg)
-        with open(self.logfile, 'a') as f:
-            f.write('%s\n' % msg)
+        with open(self.logfile, 'a') as _file:
+            _file.write('%s\n' % msg)
 
 
     def rotate_logs(self, upper_limit=20):

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index ce9a35c..8958c99 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -35,11 +35,11 @@ class PivotChroot(Rotator):
         self.logfile = logfile
 
 
-    def pivot(self, subchroot, md):
+    def pivot(self, subchroot, _md):
         # If any directories are mounted, unmount them before pivoting.
-        some_mounted, all_mounted = md.are_mounted()
+        some_mounted, all_mounted = _md.are_mounted()
         if some_mounted:
-            md.umount_all()
+            _md.umount_all()
 
         # Move the system's portage configroot out of the way to system.0,
         # then pivot the inner chroot to system.
@@ -50,4 +50,4 @@ class PivotChroot(Rotator):
         # Be conservative: only if all the directories were mounted on the old
         # system portage configroot to we remount on the newly pivoted root.
         if all_mounted:
-            md.mount_all()
+            _md.mount_all()

diff --git a/grs/Populate.py b/grs/Populate.py
index c6dce8d..8232c36 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -66,11 +66,11 @@ class Populate():
         # { 1:['/path/to', 'a'], 1:['/path/to', 'b'], 2:...}
         cycled_files = {}
         for dirpath, dirnames, filenames in os.walk(self.workdir):
-            for f in filenames:
-                m = re.search(r'^(.+)\.CYCLE\.(\d+)', f)
-                if m:
-                    filename = m.group(1)
-                    cycle_no = int(m.group(2))
+            for _file in filenames:
+                _match = re.search(r'^(.+)\.CYCLE\.(\d+)', _file)
+                if _match:
+                    filename = _match.group(1)
+                    cycle_no = int(_match.group(2))
                     cycled_files.setdefault(cycle_no, [])
                     cycled_files[cycle_no].append([dirpath, filename])
         # If cycle is just a boolean, then default to the maximum cycle number.
@@ -81,14 +81,14 @@ class Populate():
         # Go through cycled_files dictionary and either
         #     1. rename the file if it matches the desired cycle number,
         #     2. delete the file otherwise.
-        for c in cycled_files:
-            for f in cycled_files[c]:
-                dirpath = f[0]
-                filename = f[1]
+        for _cycle in cycled_files:
+            for _file in cycled_files[_cycle]:
+                dirpath = _file[0]
+                filename = _file[1]
                 new_file = os.path.join(dirpath, filename)
-                old_file = "%s.CYCLE.%d" % (new_file, c)
+                old_file = "%s.CYCLE.%d" % (new_file, _cycle)
                 if os.path.isfile(old_file):
-                    if c == cycle_no:
+                    if _cycle == cycle_no:
                         os.rename(old_file, new_file)
                     else:
                         os.remove(old_file)

diff --git a/grs/Rotator.py b/grs/Rotator.py
index 9daf7d2..a3684a9 100644
--- a/grs/Rotator.py
+++ b/grs/Rotator.py
@@ -44,22 +44,22 @@ class Rotator():
         """
         objs = glob.glob('%s.*' % obj)
         indexed_obj = {}
-        for o in objs:
-            m = re.search(r'^.+\.(\d+)$', o)
-            indexed_obj[int(m.group(1))] = o
+        for _obj in objs:
+            _match = re.search(r'^.+\.(\d+)$', _obj)
+            indexed_obj[int(_match.group(1))] = _obj
         count = list(indexed_obj.keys())
         count.sort()
         count.reverse()
-        for c in count:
-            current_obj = indexed_obj[c]
-            if c >= upper_limit:
+        for _count in count:
+            current_obj = indexed_obj[_count]
+            if _count >= upper_limit:
                 try:
                     shutil.rmtree(current_obj)
                 except NotADirectoryError:
                     os.unlink(current_obj)
                 continue
-            m = re.search(r'^(.+)\.\d+$', current_obj)
-            next_obj = '%s.%d' % (m.group(1), c+1)
+            _match = re.search(r'^(.+)\.\d+$', current_obj)
+            next_obj = '%s.%d' % (_match.group(1), _count+1)
             shutil.move(current_obj, next_obj)
 
 

diff --git a/grs/Seed.py b/grs/Seed.py
index 2bc429f..f610228 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -49,8 +49,8 @@ class Seed(Rotator):
         # Download a stage tarball if we don't have one
         if not os.path.isfile(self.filepath):
             request = urllib.request.urlopen(self.stage_uri)
-            with open(self.filepath, 'wb') as f:
-                shutil.copyfileobj(request, f)
+            with open(self.filepath, 'wb') as _file:
+                shutil.copyfileobj(request, _file)
 
         # Because python's tarfile sucks
         cmd = 'tar --xattrs -xf %s -C %s' % (self.filepath, self.portage_configroot)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index d28f300..bad4f83 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -42,8 +42,8 @@ class WorldConf():
             dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory)
             if not os.path.isdir(dpath):
                 continue
-            for f in os.listdir(dpath):
-                fpath = os.path.join(dpath, f)
+            for _file in os.listdir(dpath):
+                fpath = os.path.join(dpath, _file)
                 if os.path.isfile(fpath):
                     os.remove(fpath)
 
@@ -52,14 +52,14 @@ class WorldConf():
             delimiters=':', allow_no_value=True, comment_prefixes=None
         )
         config.read(CONST.WORLD_CONFIG)
-        for s in config.sections():
+        for _section in config.sections():
             for (directory, value) in config[s].items():
-                p_slot_atom = re.sub(r'[/:]', '_', s)
+                p_slot_atom = re.sub(r'[/:]', '_', _section)
                 dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory)
                 fpath = os.path.join(dpath, p_slot_atom)
                 os.makedirs(dpath, mode=0o755, exist_ok=True)
-                with open(fpath, 'w') as g:
-                    g.write('%s\n' % value)
+                with open(fpath, 'w') as _file:
+                    _file.write('%s\n' % value)
 
 
     @staticmethod
@@ -73,23 +73,23 @@ class WorldConf():
 
         # Remove all installed pkgs from the set of all portage packages.
         uninstalled = portdb.cp_all()
-        for p in vardb.cp_all():
+        for _cp in vardb.cp_all():
             try:
-                uninstalled.remove(p)
+                uninstalled.remove(_cp)
             except ValueError:
-                print('%s installed on local system, but not in portage repo anymore.' % p)
+                print('%s installed on local system, but not in portage repo anymore.' % _cp)
 
         # Construct a list of canonical named files for uninstalled pkgs.
         slot_atoms = []
-        for p in uninstalled:
-            cpv = portdb.cp_list(p)[0]
-            slotvar = portdb.aux_get(cpv, ['SLOT'])[0]
+        for _cp in uninstalled:
+            _cpv = portdb.cp_list(_cp)[0]
+            slotvar = portdb.aux_get(_cpv, ['SLOT'])[0]
             try:
-                m = re.search(r'(.+?)\/(.+)', slotvar)
-                slot = m.group(1)
+                _match = re.search(r'(.+?)\/(.+)', slotvar)
+                slot = _match.group(1)
             except AttributeError:
                 slot = slotvar
-            slot_atoms.append(re.sub(r'[/:]', '_', '%s:%s' % (p, slot)))
+            slot_atoms.append(re.sub(r'[/:]', '_', '%s:%s' % (_cp, slot)))
 
         # Also let's get a list of all the possible canonical file names
         config = configparser.RawConfigParser(
@@ -97,8 +97,8 @@ class WorldConf():
         )
         config.read(CONST.WORLD_CONFIG)
         canon = []
-        for s in config.sections():
-            p_slot_atom = re.sub(r'[/:]', '_', s)
+        for _section in config.sections():
+            p_slot_atom = re.sub(r'[/:]', '_', _section)
             canon.append(p_slot_atom)
 
         # Walk through all files in /etc/portage and remove any files for uninstalled pkgs.
@@ -108,7 +108,7 @@ class WorldConf():
                 continue
 
             # Remove all filenames that match uninstalled slot_atoms or are not in the canon
-            for f in filenames:
-                fpath = os.path.realpath(os.path.join(dirpath, f))
-                if f in slot_atoms or not f in canon:
+            for _file in filenames:
+                fpath = os.path.realpath(os.path.join(dirpath, _file))
+                if _file in slot_atoms or not _file in canon:
                     os.remove(fpath)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-08 18:03 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-08 18:03 UTC (permalink / raw
  To: gentoo-commits

commit:     2b87ad4ab4658b834f9cb0683ea3f7fb75781719
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  8 18:08:39 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Oct  8 18:08:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=2b87ad4a

grs/Interpret.py: prepare for refactoring large if clause.

 grs/Interpret.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 4e411fd..072574e 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -79,7 +79,7 @@ class Interpret(Daemon):
             sys.exit(signum + 128)
 
 
-        def smartlog(_log, obj, has_obj=True):
+        def smartlog(_log, obj, has_obj):
             """ This logs whether or not we have a grammatically incorrect
                 directive, or we are doing a mock run, and returns whether
                 or not we should execute the directive:
@@ -202,7 +202,7 @@ class Interpret(Daemon):
                     stampit(progress)
                     continue
                 if verb == 'log':
-                    if smartlog(_line, obj):
+                    if smartlog(_line, obj, True):
                         stampit(progress)
                         continue
                     if obj == 'stamp':
@@ -220,17 +220,17 @@ class Interpret(Daemon):
                         continue
                     _md.umount_all()
                 elif verb == 'populate':
-                    if smartlog(_line, obj):
+                    if smartlog(_line, obj, True):
                         stampit(progress)
                         continue
                     _po.populate(cycle=int(obj))
                 elif verb == 'runscript':
-                    if smartlog(_line, obj):
+                    if smartlog(_line, obj, True):
                         stampit(progress)
                         continue
                     _ru.runscript(obj)
                 elif verb == 'pivot':
-                    if smartlog(_line, obj):
+                    if smartlog(_line, obj, True):
                         stampit(progress)
                         continue
                     _pc.pivot(obj, _md)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-08 23:52 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-08 23:52 UTC (permalink / raw
  To: gentoo-commits

commit:     aad8f61094ca20dcad007e6ab97b94c9f8efcfc5
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  8 23:58:04 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Oct  8 23:58:04 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=aad8f610

grs/WorldConf.py: fix renaming s -> _section.

 grs/WorldConf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index bad4f83..48b93af 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -53,7 +53,7 @@ class WorldConf():
         )
         config.read(CONST.WORLD_CONFIG)
         for _section in config.sections():
-            for (directory, value) in config[s].items():
+            for (directory, value) in config[_section].items():
                 p_slot_atom = re.sub(r'[/:]', '_', _section)
                 dpath = os.path.join(CONST.PORTAGE_CONFIGDIR, directory)
                 fpath = os.path.join(dpath, p_slot_atom)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-09 23:06 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-09 23:06 UTC (permalink / raw
  To: gentoo-commits

commit:     b0f3ea3a17df523436e82fb0629eeb458dcd0025
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 23:12:06 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 23:12:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b0f3ea3a

grs/Interpret.py: skip non-functional build lines

 grs/Interpret.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 072574e..744c3cc 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -161,9 +161,9 @@ class Interpret(Daemon):
             for _line in _file.readlines():
                 line_number += 1
 
-                # Skip lines with initial # as comments.
-                _match = re.search(r'^(#).*$', _line)
-                if _match:
+                # Skip lines with initial # or blank lines.
+                if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
+                    stampit(progress)
                     continue
 
                 # For a release run, execute every line of the build script.
@@ -198,9 +198,6 @@ class Interpret(Daemon):
                 # build script are implemented.  Note: 'hashit' can only come
                 # after 'tarit' or 'isoit' so that it knows the medium_name
                 # to hash, ie whether its a .tar.xz or a .iso
-                if verb == '':
-                    stampit(progress)
-                    continue
                 if verb == 'log':
                     if smartlog(_line, obj, True):
                         stampit(progress)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-09 23:11 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-09 23:11 UTC (permalink / raw
  To: gentoo-commits

commit:     b9a608b54d31deae83cac1d7143c245472211861
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 23:12:06 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 23:16:50 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b9a608b5

grs/Interpret.py: skip non-functional build lines

 grs/Interpret.py |  11 +-
 grs/zzz.lint     | 363 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 368 insertions(+), 6 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 072574e..43c0e48 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -161,9 +161,11 @@ class Interpret(Daemon):
             for _line in _file.readlines():
                 line_number += 1
 
-                # Skip lines with initial # as comments.
-                _match = re.search(r'^(#).*$', _line)
-                if _match:
+                # Do nothing for lines with initial # or blank lines.
+                # Create a progress stamp only if we are not doing an update run.
+                if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
+                    if not self.update_run:
+                        stampit(progress)
                     continue
 
                 # For a release run, execute every line of the build script.
@@ -198,9 +200,6 @@ class Interpret(Daemon):
                 # build script are implemented.  Note: 'hashit' can only come
                 # after 'tarit' or 'isoit' so that it knows the medium_name
                 # to hash, ie whether its a .tar.xz or a .iso
-                if verb == '':
-                    stampit(progress)
-                    continue
                 if verb == 'log':
                     if smartlog(_line, obj, True):
                         stampit(progress)

diff --git a/grs/zzz.lint b/grs/zzz.lint
new file mode 100644
index 0000000..f2845ed
--- /dev/null
+++ b/grs/zzz.lint
@@ -0,0 +1,363 @@
+************* Module grs
+C:  1, 0: Missing module docstring (missing-docstring)
+************* Module grs.Daemon
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 48, 4: Missing method docstring (missing-docstring)
+C: 89, 4: Missing method docstring (missing-docstring)
+C: 93, 4: Missing method docstring (missing-docstring)
+C: 97, 4: Missing method docstring (missing-docstring)
+************* Module grs.Interpret
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 42, 4: Too many local variables (34/15) (too-many-locals)
+E: 58,39: Instance of 'Interpret' has no 'subcgroupdir' member (no-member)
+W: 67,32: Unused variable 'i' (unused-variable)
+W: 50,28: Unused argument 'frame' (unused-argument)
+E: 92,15: Instance of 'Interpret' has no 'mock_run' member (no-member)
+E:110,35: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:111,37: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:112,27: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:113,31: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:114,33: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:115,31: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:116,33: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:117,33: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:118,39: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:119,55: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:146,43: Instance of 'Interpret' has no 'update_run' member (no-member)
+E:152,48: Instance of 'Interpret' has no 'update_run' member (no-member)
+E:175,35: Instance of 'Interpret' has no 'update_run' member (no-member)
+E:179,23: Instance of 'Interpret' has no 'update_run' member (no-member)
+R: 42, 4: Too many branches (38/12) (too-many-branches)
+R: 42, 4: Too many statements (134/50) (too-many-statements)
+************* Module grs.Synchronize
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 32, 4: Missing method docstring (missing-docstring)
+************* Module grs.RunScript
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 35, 4: Missing method docstring (missing-docstring)
+R: 24, 0: Too few public methods (1/2) (too-few-public-methods)
+************* Module grs.MountDirectories
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 50, 4: Method could be a function (no-self-use)
+W: 86,22: Unused variable 'all_mounted' (unused-variable)
+************* Module grs.Rotator
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 27, 4: Method could be a function (no-self-use)
+************* Module grs.PivotChroot
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 38, 4: Missing method docstring (missing-docstring)
+************* Module grs.HashIt
+C:  1, 0: Missing module docstring (missing-docstring)
+E: 36,30: Instance of 'HashIt' has no 'portage_configroot' member (no-member)
+E: 40,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 41,28: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 42,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 45,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 46,29: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 47,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 50,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 51,31: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 52,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 55,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 56,35: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 57,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+R: 22, 0: Too few public methods (1/2) (too-few-public-methods)
+************* Module grs.ISOIt
+W: 84, 0: TODO: we are assuming a static busybox, so we should check. (fixme)
+W: 97, 0: TODO: we are assuming a static kernel and so not copying in (fixme)
+W:125, 0: TODO: we are assuming a static kernel (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 26, 0: Too many instance attributes (9/7) (too-many-instance-attributes)
+R: 29, 4: Too many arguments (6/5) (too-many-arguments)
+R: 45, 4: Too many local variables (19/15) (too-many-locals)
+C:110, 4: Missing method docstring (missing-docstring)
+************* Module grs.Kernel
+W:111, 0: TODO: add more options (eg splash and firmware), which can be (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 30, 4: Too many arguments (6/5) (too-many-arguments)
+R: 72, 4: Too many local variables (20/15) (too-many-locals)
+W:133,21: Unused variable 'dirnames' (unused-variable)
+************* Module grs.Log
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 18, 4: Missing method docstring (missing-docstring)
+C: 28, 4: Missing method docstring (missing-docstring)
+************* Module grs.WorldConf
+W: 29, 0: TODO: This needs to be expanded. (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 66, 4: Too many local variables (18/15) (too-many-locals)
+E: 71,17: Module 'portage' has no 'db' member (no-member)
+E: 71,28: Module 'portage' has no 'root' member (no-member)
+E: 72,16: Module 'portage' has no 'db' member (no-member)
+E: 72,27: Module 'portage' has no 'root' member (no-member)
+W:105,21: Unused variable 'dirnames' (unused-variable)
+************* Module grs.Constants
+C:  1, 0: Missing module docstring (missing-docstring)
+C:153, 0: Invalid attribute name "LIBDIR" (invalid-name)
+C:159, 0: Invalid attribute name "PORTAGE_CONFIGROOT" (invalid-name)
+C:158, 0: Invalid attribute name "KERNELROOT" (invalid-name)
+C:167, 0: Invalid attribute name "GRS_CGROUPDIR" (invalid-name)
+C:145, 0: Invalid attribute name "PACKAGE_NAME" (invalid-name)
+C:155, 0: Invalid attribute name "TMPDIR" (invalid-name)
+C:165, 0: Invalid attribute name "WORLD_CONFIG" (invalid-name)
+C:148, 0: Invalid attribute name "BUG_REPORTS" (invalid-name)
+C:154, 0: Invalid attribute name "LOGFILE" (invalid-name)
+C:163, 0: Invalid attribute name "PORTAGE_CONFIGDIR" (invalid-name)
+C:147, 0: Invalid attribute name "PACKAGE_DESCRIPTION" (invalid-name)
+C:160, 0: Invalid attribute name "PIDFILE" (invalid-name)
+C:156, 0: Invalid attribute name "WORKDIR" (invalid-name)
+C:146, 0: Invalid attribute name "PACKAGE_VERSION" (invalid-name)
+C:164, 0: Invalid attribute name "PORTAGE_DIRTYFILE" (invalid-name)
+C:157, 0: Invalid attribute name "PACKAGE" (invalid-name)
+C:166, 0: Invalid attribute name "GRS_CGROUP" (invalid-name)
+R: 24, 0: Too many instance attributes (19/7) (too-many-instance-attributes)
+W:153, 0: Attribute 'LIBDIR' defined outside __init__ (attribute-defined-outside-init)
+W:159, 0: Attribute 'PORTAGE_CONFIGROOT' defined outside __init__ (attribute-defined-outside-init)
+W:158, 0: Attribute 'KERNELROOT' defined outside __init__ (attribute-defined-outside-init)
+W:167, 0: Attribute 'GRS_CGROUPDIR' defined outside __init__ (attribute-defined-outside-init)
+W:145, 0: Attribute 'PACKAGE_NAME' defined outside __init__ (attribute-defined-outside-init)
+W:155, 0: Attribute 'TMPDIR' defined outside __init__ (attribute-defined-outside-init)
+W:165, 0: Attribute 'WORLD_CONFIG' defined outside __init__ (attribute-defined-outside-init)
+W:148, 0: Attribute 'BUG_REPORTS' defined outside __init__ (attribute-defined-outside-init)
+W:154, 0: Attribute 'LOGFILE' defined outside __init__ (attribute-defined-outside-init)
+W:163, 0: Attribute 'PORTAGE_CONFIGDIR' defined outside __init__ (attribute-defined-outside-init)
+W:147, 0: Attribute 'PACKAGE_DESCRIPTION' defined outside __init__ (attribute-defined-outside-init)
+W:160, 0: Attribute 'PIDFILE' defined outside __init__ (attribute-defined-outside-init)
+W:156, 0: Attribute 'WORKDIR' defined outside __init__ (attribute-defined-outside-init)
+W:146, 0: Attribute 'PACKAGE_VERSION' defined outside __init__ (attribute-defined-outside-init)
+W:164, 0: Attribute 'PORTAGE_DIRTYFILE' defined outside __init__ (attribute-defined-outside-init)
+W:157, 0: Attribute 'PACKAGE' defined outside __init__ (attribute-defined-outside-init)
+W:166, 0: Attribute 'GRS_CGROUP' defined outside __init__ (attribute-defined-outside-init)
+R: 24, 0: Too few public methods (0/2) (too-few-public-methods)
+************* Module grs.Execute
+C:  1, 0: Missing module docstring (missing-docstring)
+W: 30, 4: Dangerous default value {} as argument (dangerous-default-value)
+R: 30, 4: Too many arguments (7/5) (too-many-arguments)
+C: 45, 8: Missing function docstring (missing-docstring)
+W: 50,20: Unused variable 'i' (unused-variable)
+R: 27, 0: Too few public methods (0/2) (too-few-public-methods)
+************* Module grs.Populate
+C:  1, 0: Missing module docstring (missing-docstring)
+W: 68,21: Unused variable 'dirnames' (unused-variable)
+************* Module grs.Seed
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 31, 4: Too many arguments (6/5) (too-many-arguments)
+C: 43, 4: Missing method docstring (missing-docstring)
+************* Module grs.TarIt
+W: 48, 0: TODO: This needs to be generalized for systems that don't support xattrs (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 39, 4: Missing method docstring (missing-docstring)
+R:  1, 0: Similar lines in 2 files
+==grs.Execute:48
+==grs.Interpret:65
+            try:
+                for i in range(10):
+                    os.kill(pid, signal.SIGTERM)
+                    time.sleep(0.2)
+                while True:
+                    os.kill(pid, signal.SIGKILL)
+                    time.sleep(0.2)
+            except ProcessLookupError:
+                pass (duplicate-code)
+R:  1, 0: Similar lines in 2 files
+==grs.ISOIt:34
+==grs.TarIt:28
+        self.portage_configroot = portage_configroot
+        self.logfile = logfile
+        # Prepare a year, month and day for a tarball name timestamp.
+        self.year = str(datetime.now().year).zfill(4)
+        self.month = str(datetime.now().month).zfill(2)
+        self.day = str(datetime.now().day).zfill(2) (duplicate-code)
+R:  1, 0: Similar lines in 2 files
+==grs.Interpret:26
+==grs:23
+from grs.ISOIt import ISOIt
+from grs.Log import Log
+from grs.Kernel import Kernel
+from grs.MountDirectories import MountDirectories
+from grs.PivotChroot import PivotChroot
+from grs.Populate import Populate (duplicate-code)
+
+
+Report
+======
+877 statements analysed.
+
+Statistics by type
+------------------
+
++---------+-------+-----------+-----------+------------+---------+
+|type     |number |old number |difference |%documented |%badname |
++=========+=======+===========+===========+============+=========+
+|module   |18     |18         |=          |0.00        |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|class    |17     |17         |=          |100.00      |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|method   |44     |44         |=          |72.73       |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|function |4      |4          |=          |75.00       |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+
+
+
+External dependencies
+---------------------
+::
+
+    grs 
+      \-Constants (grs.RunScript,grs.Interpret,grs,grs.Kernel,grs.WorldConf,grs.ISOIt,grs.Seed,grs.Synchronize,grs.Execute,grs.TarIt,grs.MountDirectories,grs.Populate,grs.PivotChroot,grs.Log)
+      \-Daemon (grs.Interpret,grs)
+      \-Execute (grs.RunScript,grs,grs.Kernel,grs.ISOIt,grs.Seed,grs.Synchronize,grs.TarIt,grs.MountDirectories,grs.HashIt,grs.Populate)
+      \-HashIt (grs.ISOIt,grs,grs.TarIt)
+      \-ISOIt (grs.Interpret,grs)
+      \-Interpret (grs)
+      \-Kernel (grs.Interpret,grs)
+      \-Log (grs.Interpret,grs)
+      \-MountDirectories (grs.Interpret,grs)
+      \-PivotChroot (grs.Interpret,grs)
+      \-Populate (grs.Interpret,grs)
+      \-Rotator (grs.Log,grs.Seed,grs,grs.PivotChroot)
+      \-RunScript (grs.Interpret,grs)
+      \-Seed (grs.Interpret,grs)
+      \-Synchronize (grs.Interpret,grs)
+      \-WorldConf (grs)
+    portage (grs.WorldConf)
+
+
+
+Raw metrics
+-----------
+
++----------+-------+------+---------+-----------+
+|type      |number |%     |previous |difference |
++==========+=======+======+=========+===========+
+|code      |951    |56.47 |951      |=          |
++----------+-------+------+---------+-----------+
+|docstring |175    |10.39 |175      |=          |
++----------+-------+------+---------+-----------+
+|comment   |422    |25.06 |422      |=          |
++----------+-------+------+---------+-----------+
+|empty     |136    |8.08  |136      |=          |
++----------+-------+------+---------+-----------+
+
+
+
+Duplication
+-----------
+
++-------------------------+------+---------+-----------+
+|                         |now   |previous |difference |
++=========================+======+=========+===========+
+|nb duplicated lines      |21    |21       |=          |
++-------------------------+------+---------+-----------+
+|percent duplicated lines |1.186 |1.186    |=          |
++-------------------------+------+---------+-----------+
+
+
+
+Messages by category
+--------------------
+
++-----------+-------+---------+-----------+
+|type       |number |previous |difference |
++===========+=======+=========+===========+
+|convention |48     |48       |=          |
++-----------+-------+---------+-----------+
+|refactor   |21     |21       |=          |
++-----------+-------+---------+-----------+
+|warning    |31     |31       |=          |
++-----------+-------+---------+-----------+
+|error      |33     |33       |=          |
++-----------+-------+---------+-----------+
+
+
+
+% errors / warnings by module
+-----------------------------
+
++---------------------+------+--------+---------+-----------+
+|module               |error |warning |refactor |convention |
++=====================+======+========+=========+===========+
+|grs.Interpret        |48.48 |6.45    |14.29    |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.HashIt           |39.39 |0.00    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.WorldConf        |12.12 |6.45    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Constants        |0.00  |54.84   |9.52     |37.50      |
++---------------------+------+--------+---------+-----------+
+|grs.ISOIt            |0.00  |9.68    |14.29    |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.Execute          |0.00  |6.45    |9.52     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.Kernel           |0.00  |6.45    |9.52     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.TarIt            |0.00  |3.23    |14.29    |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.MountDirectories |0.00  |3.23    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Populate         |0.00  |3.23    |0.00     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Seed             |0.00  |0.00    |4.76     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.RunScript        |0.00  |0.00    |4.76     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.Rotator          |0.00  |0.00    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Daemon           |0.00  |0.00    |0.00     |10.42      |
++---------------------+------+--------+---------+-----------+
+|grs.Log              |0.00  |0.00    |0.00     |6.25       |
++---------------------+------+--------+---------+-----------+
+|grs.Synchronize      |0.00  |0.00    |0.00     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.PivotChroot      |0.00  |0.00    |0.00     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs                  |0.00  |0.00    |0.00     |2.08       |
++---------------------+------+--------+---------+-----------+
+
+
+
+Messages
+--------
+
++-------------------------------+------------+
+|message id                     |occurrences |
++===============================+============+
+|no-member                      |33          |
++-------------------------------+------------+
+|missing-docstring              |31          |
++-------------------------------+------------+
+|invalid-name                   |17          |
++-------------------------------+------------+
+|attribute-defined-outside-init |17          |
++-------------------------------+------------+
+|unused-variable                |6           |
++-------------------------------+------------+
+|fixme                          |6           |
++-------------------------------+------------+
+|too-many-locals                |4           |
++-------------------------------+------------+
+|too-many-arguments             |4           |
++-------------------------------+------------+
+|too-few-public-methods         |4           |
++-------------------------------+------------+
+|duplicate-code                 |3           |
++-------------------------------+------------+
+|too-many-instance-attributes   |2           |
++-------------------------------+------------+
+|no-self-use                    |2           |
++-------------------------------+------------+
+|unused-argument                |1           |
++-------------------------------+------------+
+|too-many-statements            |1           |
++-------------------------------+------------+
+|too-many-branches              |1           |
++-------------------------------+------------+
+|dangerous-default-value        |1           |
++-------------------------------+------------+
+
+
+
+Global evaluation
+-----------------
+Your code has been rated at 6.98/10 (previous run: 6.98/10, +0.00)
+


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-09 23:30 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-09 23:30 UTC (permalink / raw
  To: gentoo-commits

commit:     d6f40c5fbf0b53a069359a0d0ad6adefa509b8c2
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 23:36:28 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 23:36:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=d6f40c5f

grs/Interpret.py: clean up parsing a line.

 grs/Interpret.py | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 43c0e48..7add215 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -159,10 +159,13 @@ class Interpret(Daemon):
             line_number = 0
             medium_type = None
             for _line in _file.readlines():
+                # Increment the line number by one and create the name of the
+                # file for the progress stamp.
                 line_number += 1
+                progress = os.path.join(tmpdir, '.completed_%02d' % line_number)
 
-                # Do nothing for lines with initial # or blank lines.
-                # Create a progress stamp only if we are not doing an update run.
+                # Do nothing for lines with initial # or blank lines.  Create
+                # a progress stamp only if we are not doing an update run.
                 if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
                     if not self.update_run:
                         stampit(progress)
@@ -173,7 +176,8 @@ class Interpret(Daemon):
                 ignore_stamp = False
                 _match = re.search(r'^(\+)(.*)$', _line)
                 if _match:
-                    # There is a leading +, so remove it and skip if doing an update run
+                    # There is a leading +, so remove it and ignore any progress
+                    # stamp if its an update run.
                     ignore_stamp = self.update_run
                     _line = _match.group(2)
                 else:
@@ -181,20 +185,17 @@ class Interpret(Daemon):
                     if self.update_run:
                         continue
 
-                progress = os.path.join(tmpdir, '.completed_%02d' % line_number)
+                # Skip a line if the progres stamp exists, or ignore it
+                # because its an update run.
                 if os.path.exists(progress) and not ignore_stamp:
                     continue
 
-                # This is pretty simple interpretive logic, either its a
-                # single 'verb', or a 'verb obj' pair.  While restrictive,
-                # its good enough for now.
-                try:
-                    _match = re.search(r'(\S+)\s+(\S+)', _line)
-                    verb = _match.group(1)
-                    obj = _match.group(2)
-                except AttributeError:
-                    verb = _line.strip()
-                    obj = None
+                # This is pretty simple syntax.  The first word on a line
+                # is a verb.  The remaining words are objcts.
+                sentence = _line.split()
+                verb = sentence[0]
+                objs = sentence[1:]
+                obj = objs[0]
 
                 # This long concatenated if is where the semantics of the
                 # build script are implemented.  Note: 'hashit' can only come


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-09 23:33 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-09 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     0fbe9351d3aa7571cc1b01679e2dd3f86dee40ed
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 23:36:28 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 23:38:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=0fbe9351

grs/Interpret.py: clean up parsing a line.

 grs/Interpret.py | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 43c0e48..7add215 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -159,10 +159,13 @@ class Interpret(Daemon):
             line_number = 0
             medium_type = None
             for _line in _file.readlines():
+                # Increment the line number by one and create the name of the
+                # file for the progress stamp.
                 line_number += 1
+                progress = os.path.join(tmpdir, '.completed_%02d' % line_number)
 
-                # Do nothing for lines with initial # or blank lines.
-                # Create a progress stamp only if we are not doing an update run.
+                # Do nothing for lines with initial # or blank lines.  Create
+                # a progress stamp only if we are not doing an update run.
                 if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
                     if not self.update_run:
                         stampit(progress)
@@ -173,7 +176,8 @@ class Interpret(Daemon):
                 ignore_stamp = False
                 _match = re.search(r'^(\+)(.*)$', _line)
                 if _match:
-                    # There is a leading +, so remove it and skip if doing an update run
+                    # There is a leading +, so remove it and ignore any progress
+                    # stamp if its an update run.
                     ignore_stamp = self.update_run
                     _line = _match.group(2)
                 else:
@@ -181,20 +185,17 @@ class Interpret(Daemon):
                     if self.update_run:
                         continue
 
-                progress = os.path.join(tmpdir, '.completed_%02d' % line_number)
+                # Skip a line if the progres stamp exists, or ignore it
+                # because its an update run.
                 if os.path.exists(progress) and not ignore_stamp:
                     continue
 
-                # This is pretty simple interpretive logic, either its a
-                # single 'verb', or a 'verb obj' pair.  While restrictive,
-                # its good enough for now.
-                try:
-                    _match = re.search(r'(\S+)\s+(\S+)', _line)
-                    verb = _match.group(1)
-                    obj = _match.group(2)
-                except AttributeError:
-                    verb = _line.strip()
-                    obj = None
+                # This is pretty simple syntax.  The first word on a line
+                # is a verb.  The remaining words are objcts.
+                sentence = _line.split()
+                verb = sentence[0]
+                objs = sentence[1:]
+                obj = objs[0]
 
                 # This long concatenated if is where the semantics of the
                 # build script are implemented.  Note: 'hashit' can only come


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-09 23:33 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-09 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     3a1205cfcc515ac07fa63e20c8c9988731cbc3fb
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 23:12:06 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 23:38:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=3a1205cf

grs/Interpret.py: skip non-functional build lines

 grs/Interpret.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 072574e..43c0e48 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -161,9 +161,11 @@ class Interpret(Daemon):
             for _line in _file.readlines():
                 line_number += 1
 
-                # Skip lines with initial # as comments.
-                _match = re.search(r'^(#).*$', _line)
-                if _match:
+                # Do nothing for lines with initial # or blank lines.
+                # Create a progress stamp only if we are not doing an update run.
+                if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
+                    if not self.update_run:
+                        stampit(progress)
                     continue
 
                 # For a release run, execute every line of the build script.
@@ -198,9 +200,6 @@ class Interpret(Daemon):
                 # build script are implemented.  Note: 'hashit' can only come
                 # after 'tarit' or 'isoit' so that it knows the medium_name
                 # to hash, ie whether its a .tar.xz or a .iso
-                if verb == '':
-                    stampit(progress)
-                    continue
                 if verb == 'log':
                     if smartlog(_line, obj, True):
                         stampit(progress)


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

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

commit:     438583d1e40fd764d491974d1b0ebd75cacf2148
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 00:35:08 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 00:35:15 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=438583d1

grs/Interpret.py: restructure semantic actions.

 grs/Interpret.py | 106 ++++++++++++++++++++++---------------------------------
 1 file changed, 42 insertions(+), 64 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 7add215..15b6cfa 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -79,20 +79,27 @@ class Interpret(Daemon):
             sys.exit(signum + 128)
 
 
-        def smartlog(_log, obj, has_obj):
-            """ This logs whether or not we have a grammatically incorrect
-                directive, or we are doing a mock run, and returns whether
-                or not we should execute the directive:
-                    True  = skip this directive
-                    False = don't skip it
-            """
-            if (has_obj and not obj) or (not has_obj and obj):
-                _lo.log('Bad command: %s' % _log)
-                return True
+        def signalexit():
+            pid = os.getpid()
+            while True:
+                os.kill(pid, signal.SIGTERM)
+                time.sleep(2.0)
+
+
+        def semantic_action(_line, objs, n, execstr):
+            """ Execute the directive """
             if self.mock_run:
-                _lo.log(_log)
-                return True
-            return False
+                _lo.log(_line)
+                return
+            try:
+                if len(objs) < n:
+                    raise Exception('Number of objs for verb incorrect.')
+                exec(execstr)
+            except Exception as e:
+                _lo.log('Bad command: %s' % _line)
+                _lo.log('Exception throw: %s' % e)
+                _lo.log('SENDING SIGTERM to pid = %d\n' % pid)
+                signalexit()
 
 
         def stampit(progress):
@@ -195,82 +202,53 @@ class Interpret(Daemon):
                 sentence = _line.split()
                 verb = sentence[0]
                 objs = sentence[1:]
-                obj = objs[0]
 
                 # This long concatenated if is where the semantics of the
                 # build script are implemented.  Note: 'hashit' can only come
                 # after 'tarit' or 'isoit' so that it knows the medium_name
                 # to hash, ie whether its a .tar.xz or a .iso
                 if verb == 'log':
-                    if smartlog(_line, obj, True):
-                        stampit(progress)
-                        continue
-                    if obj == 'stamp':
-                        _lo.log('='*80)
-                    else:
-                        _lo.log(obj)
+                    if objs[0] == 'stamp':
+                        objs[0] = '='*80
+                    semantic_action(_line, objs, 1, '_lo.log(\' \'.join(objs))')
                 elif verb == 'mount':
-                    if smartlog(_line, obj, False):
-                        stampit(progress)
-                        continue
-                    _md.mount_all()
+                    semantic_action(_line, objs, 0, '_md.mount_all()')
                 elif verb == 'unmount':
-                    if smartlog(_line, obj, False):
-                        stampit(progress)
-                        continue
-                    _md.umount_all()
+                    semantic_action(_line, objs, 0, '_md.umount_all()')
                 elif verb == 'populate':
-                    if smartlog(_line, obj, True):
-                        stampit(progress)
-                        continue
-                    _po.populate(cycle=int(obj))
+                    semantic_action(_line, objs, 1, '_po.populate(cycle=int(objs[0]))')
                 elif verb == 'runscript':
-                    if smartlog(_line, obj, True):
-                        stampit(progress)
-                        continue
-                    _ru.runscript(obj)
+                    semantic_action(_line, objs, 1, '_ru.runscript(objs[0])')
                 elif verb == 'pivot':
-                    if smartlog(_line, obj, True):
-                        stampit(progress)
-                        continue
-                    _pc.pivot(obj, _md)
+                    semantic_action(_line, objs, 1, '_pc.pivot(objs[0], _md)')
                 elif verb == 'kernel':
-                    if smartlog(_line, obj, False):
-                        stampit(progress)
-                        continue
-                    _ke.kernel()
+                    semantic_action(_line, objs, 0, '_ke.kernel()')
                 elif verb == 'tarit':
-                    # 'tarit' can either be just a verb,
-                    # or a 'verb obj' pair.
-                    if obj:
-                        smartlog(_line, obj, True)
-                        _bi.tarit(obj)
+                    # 'tarit' can either be just a verb, or a 'verb obj' pair.
+                    if len(objs):
+                        semantic_action(_line, objs, 1, '_bi.tarit(objs[0])')
                     else:
-                        smartlog(_line, obj, False)
-                        _bi.tarit()
+                        semantic_action(_line, objs, 0, '_bi.tarit()')
                     medium_type = 'tarit'
                 elif verb == 'isoit':
-                    # 'isoit' can either be just a verb,
-                    # or a 'verb obj' pair.
-                    if obj:
-                        smartlog(_line, obj, True)
-                        _io.isoit(obj)
+                    # 'isoit' can either be just a verb, or a 'verb obj' pair.
+                    if len(objs):
+                        semantic_action(_line, objs, 1, '_io.isoit(objs[1])')
                     else:
-                        smartlog(_line, obj, False)
-                        _io.isoit()
+                        semantic_action(_line, objs, 0, '_io.isoit()')
                     medium_type = 'isoit'
                 elif verb == 'hashit':
-                    if smartlog(_line, obj, False):
-                        stampit(progress)
-                        continue
                     if medium_type == 'tarit':
-                        _bi.hashit()
+                        semantic_action(_line, objs, 0, '_bi.hashit()')
                     elif medium_type == 'isoit':
-                        _io.hashit()
+                        semantic_action(_line, objs, 0, '_io.hashit()')
                     else:
                         raise Exception('Unknown medium to hash.')
                 else:
                     _lo.log('Bad command: %s' % _line)
+                    _lo.log('Unknown verb: %s' % verb)
+                    _lo.log('SENDING SIGTERM to pid = %d\n' % pid)
+                    signalexit()
 
                 stampit(progress)
 


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

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

commit:     fb73cabb4a601a8172d6de653851c4a348b6abc1
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 00:39:49 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 00:39:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=fb73cabb

grs/Execute.py: refactor signalexit().

 grs/Execute.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 3afbecc..0690e8e 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -44,17 +44,9 @@ class Execute():
         """
         def signalexit():
             pid = os.getpid()
-            _file.write('SENDING SIGTERM to pid = %d\n' % pid)
-            _file.close()
-            try:
-                for i in range(10):
-                    os.kill(pid, signal.SIGTERM)
-                    time.sleep(0.2)
-                while True:
-                    os.kill(pid, signal.SIGKILL)
-                    time.sleep(0.2)
-            except ProcessLookupError:
-                pass
+            while True:
+                os.kill(pid, signal.SIGTERM)
+                time.sleep(2.0)
 
         if shell:
             args = cmd
@@ -82,11 +74,15 @@ class Execute():
             if _rc:
                 _file.write('EXIT CODE: %d\n' % _rc)
                 if not failok:
+                    _file.write('SENDING SIGTERM to pid = %d\n' % pid)
+                    _file.close()
                     signalexit()
 
         if timed_out:
             _file.write('TIMEOUT ERROR: %s\n' % cmd)
             if not failok:
+                _file.write('SENDING SIGTERM to pid = %d\n' % pid)
+                _file.close()
                 signalexit()
 
         # Only close a logfile, don't close sys.stderr!


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10  1:18 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10  1:18 UTC (permalink / raw
  To: gentoo-commits

commit:     94db11827e4de100f00b168da884b7e18d7d9b0c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 01:24:17 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 01:24:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=94db1182

grs/Interpret.py: skip blank lines with leading +

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 15b6cfa..f678050 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -173,7 +173,7 @@ class Interpret(Daemon):
 
                 # Do nothing for lines with initial # or blank lines.  Create
                 # a progress stamp only if we are not doing an update run.
-                if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
+                if re.search(r'^(#).*$', _line) of _line.strip == '' or _line.strip() == '+':
                     if not self.update_run:
                         stampit(progress)
                     continue


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10  1:23 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10  1:23 UTC (permalink / raw
  To: gentoo-commits

commit:     752975a56d7af79197aa26154d6977401561d51b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 01:24:17 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 01:29:24 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=752975a5

grs/Interpret.py: skip blank lines with leading +

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 15b6cfa..799d794 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -173,7 +173,7 @@ class Interpret(Daemon):
 
                 # Do nothing for lines with initial # or blank lines.  Create
                 # a progress stamp only if we are not doing an update run.
-                if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
+                if re.search(r'^(#).*$', _line) or _line.strip == '' or _line.strip() == '+':
                     if not self.update_run:
                         stampit(progress)
                     continue


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10  1:26 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10  1:26 UTC (permalink / raw
  To: gentoo-commits

commit:     dfbc38ca93e107146c24121cade975789a7e984a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 01:24:17 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 01:31:50 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=dfbc38ca

grs/Interpret.py: skip blank lines with leading +

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 15b6cfa..d326d9c 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -173,7 +173,7 @@ class Interpret(Daemon):
 
                 # Do nothing for lines with initial # or blank lines.  Create
                 # a progress stamp only if we are not doing an update run.
-                if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
+                if re.search(r'^(#).*$', _line) or _line.strip() == '' or _line.strip() == '+':
                     if not self.update_run:
                         stampit(progress)
                     continue


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10  1:34 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10  1:34 UTC (permalink / raw
  To: gentoo-commits

commit:     685abf8bc45f4ad28fc7668c5464f114c0d9740d
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 01:40:35 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 01:40:35 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=685abf8b

grs/Interpret.py: clean up white space padding on _line.

 grs/Interpret.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index d326d9c..4f184a0 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -166,6 +166,9 @@ class Interpret(Daemon):
             line_number = 0
             medium_type = None
             for _line in _file.readlines():
+                # Get rid of whitespace padding immediately
+                _line = _line.strip()
+
                 # Increment the line number by one and create the name of the
                 # file for the progress stamp.
                 line_number += 1
@@ -173,7 +176,7 @@ class Interpret(Daemon):
 
                 # Do nothing for lines with initial # or blank lines.  Create
                 # a progress stamp only if we are not doing an update run.
-                if re.search(r'^(#).*$', _line) or _line.strip() == '' or _line.strip() == '+':
+                if re.search(r'^(#).*$', _line) or _line == '' or _line == '+':
                     if not self.update_run:
                         stampit(progress)
                     continue


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10  1:40 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10  1:40 UTC (permalink / raw
  To: gentoo-commits

commit:     6a6e851240ee9198398182dfa6598ee19a3fa33f
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 01:46:35 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 01:46:35 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=6a6e8512

grs/Interpret.py and Execute.py: pid is out of scope.

 grs/Interpret.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 4f184a0..d042da3 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -78,7 +78,7 @@ class Interpret(Daemon):
                 pass
             sys.exit(signum + 128)
 
-
+)
         def signalexit():
             pid = os.getpid()
             while True:
@@ -98,7 +98,7 @@ class Interpret(Daemon):
             except Exception as e:
                 _lo.log('Bad command: %s' % _line)
                 _lo.log('Exception throw: %s' % e)
-                _lo.log('SENDING SIGTERM to pid = %d\n' % pid)
+                _lo.log('SENDING SIGTERM\n')
                 signalexit()
 
 


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10  1:46 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10  1:46 UTC (permalink / raw
  To: gentoo-commits

commit:     12356f10563d378306b3eeafa7b708e5d4888477
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 01:46:35 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 01:52:10 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=12356f10

grs/Interpret.py and Execute.py: pid is out of scope.

 grs/Execute.py   |  4 ++--
 grs/Interpret.py | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 0690e8e..0e70221 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -74,14 +74,14 @@ class Execute():
             if _rc:
                 _file.write('EXIT CODE: %d\n' % _rc)
                 if not failok:
-                    _file.write('SENDING SIGTERM to pid = %d\n' % pid)
+                    _file.write('SENDING SIGTERM\n')
                     _file.close()
                     signalexit()
 
         if timed_out:
             _file.write('TIMEOUT ERROR: %s\n' % cmd)
             if not failok:
-                _file.write('SENDING SIGTERM to pid = %d\n' % pid)
+                _file.write('SENDING SIGTERM\n')
                 _file.close()
                 signalexit()
 

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 4f184a0..12271d6 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -86,19 +86,19 @@ class Interpret(Daemon):
                 time.sleep(2.0)
 
 
-        def semantic_action(_line, objs, n, execstr):
+        def semantic_action(_line, objs, num_objs, execstr):
             """ Execute the directive """
             if self.mock_run:
                 _lo.log(_line)
                 return
             try:
-                if len(objs) < n:
+                if len(objs) < num_objs:
                     raise Exception('Number of objs for verb incorrect.')
                 exec(execstr)
-            except Exception as e:
+            except Exception as err:
                 _lo.log('Bad command: %s' % _line)
-                _lo.log('Exception throw: %s' % e)
-                _lo.log('SENDING SIGTERM to pid = %d\n' % pid)
+                _lo.log('Exception throw: %s' % err)
+                _lo.log('SENDING SIGTERM\n')
                 signalexit()
 
 


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

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

commit:     c8e8855012e458322bacf094ac2e06ccac716cb0
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 11:15:44 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 11:15:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=c8e88550

grs/Interpret.py: exec() is bad, get rid of it.

 grs/Interpret.py | 55 ++++++++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 25 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 12271d6..ea6d2e2 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -86,18 +86,23 @@ class Interpret(Daemon):
                 time.sleep(2.0)
 
 
-        def semantic_action(_line, objs, num_objs, execstr):
+        def semantic_action(_line, objs, nargs, func, *args):
             """ Execute the directive """
-            if self.mock_run:
-                _lo.log(_line)
-                return
-            try:
-                if len(objs) < num_objs:
-                    raise Exception('Number of objs for verb incorrect.')
-                exec(execstr)
-            except Exception as err:
-                _lo.log('Bad command: %s' % _line)
-                _lo.log('Exception throw: %s' % err)
+            err = None
+            if len(objs) == nargs:
+                if self.mock_run:
+                    _lo.log(_line)
+                    return
+                try:
+                   f(*args) 
+                except Exception as err:
+                    pass
+            else:
+                err = 'Number of parameters incorrect.'
+
+            if err:
+                _lo.log('Bad command:   %s' % _line)
+                _lo.log('Error message: %s' % err)
                 _lo.log('SENDING SIGTERM\n')
                 signalexit()
 
@@ -213,44 +218,44 @@ class Interpret(Daemon):
                 if verb == 'log':
                     if objs[0] == 'stamp':
                         objs[0] = '='*80
-                    semantic_action(_line, objs, 1, '_lo.log(\' \'.join(objs))')
+                    semantic_action(_line, objs, 1, _lo.log, ' '.join(objs))
                 elif verb == 'mount':
-                    semantic_action(_line, objs, 0, '_md.mount_all()')
+                    semantic_action(_line, objs, 0, _md.mount_all)
                 elif verb == 'unmount':
-                    semantic_action(_line, objs, 0, '_md.umount_all()')
+                    semantic_action(_line, objs, 0, _md.umount_all)
                 elif verb == 'populate':
-                    semantic_action(_line, objs, 1, '_po.populate(cycle=int(objs[0]))')
+                    semantic_action(_line, objs, 1, _po.populate, int(objs[0]))
                 elif verb == 'runscript':
-                    semantic_action(_line, objs, 1, '_ru.runscript(objs[0])')
+                    semantic_action(_line, objs, 1, _ru.runscript, objs[0])
                 elif verb == 'pivot':
-                    semantic_action(_line, objs, 1, '_pc.pivot(objs[0], _md)')
+                    semantic_action(_line, objs, 1, _pc.pivot, objs[0], _md)
                 elif verb == 'kernel':
-                    semantic_action(_line, objs, 0, '_ke.kernel()')
+                    semantic_action(_line, objs, 0, _ke.kernel)
                 elif verb == 'tarit':
                     # 'tarit' can either be just a verb, or a 'verb obj' pair.
                     if len(objs):
-                        semantic_action(_line, objs, 1, '_bi.tarit(objs[0])')
+                        semantic_action(_line, objs, 1, _bi.tarit, objs[0])
                     else:
-                        semantic_action(_line, objs, 0, '_bi.tarit()')
+                        semantic_action(_line, objs, 0, _bi.tarit)
                     medium_type = 'tarit'
                 elif verb == 'isoit':
                     # 'isoit' can either be just a verb, or a 'verb obj' pair.
                     if len(objs):
-                        semantic_action(_line, objs, 1, '_io.isoit(objs[1])')
+                        semantic_action(_line, objs, 1, _io.isoit, objs[0])
                     else:
-                        semantic_action(_line, objs, 0, '_io.isoit()')
+                        semantic_action(_line, objs, 0, _io.isoit)
                     medium_type = 'isoit'
                 elif verb == 'hashit':
                     if medium_type == 'tarit':
-                        semantic_action(_line, objs, 0, '_bi.hashit()')
+                        semantic_action(_line, objs, 0, _bi.hashit)
                     elif medium_type == 'isoit':
-                        semantic_action(_line, objs, 0, '_io.hashit()')
+                        semantic_action(_line, objs, 0, _io.hashit)
                     else:
                         raise Exception('Unknown medium to hash.')
                 else:
                     _lo.log('Bad command: %s' % _line)
                     _lo.log('Unknown verb: %s' % verb)
-                    _lo.log('SENDING SIGTERM to pid = %d\n' % pid)
+                    _lo.log('SENDING SIGTERM\n')
                     signalexit()
 
                 stampit(progress)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10 11:20 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10 11:20 UTC (permalink / raw
  To: gentoo-commits

commit:     0d4eeb1055010e0ee9b08ee6e9296fff0f4021dd
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 11:25:46 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 11:25:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=0d4eeb10

grs/Interpret.py: don't run sync/seed during mock run.

 grs/Interpret.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index ea6d2e2..c90a9bd 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -156,13 +156,19 @@ class Interpret(Daemon):
         # sync() is done unconditionally for an update run.
         progress = os.path.join(tmpdir, '.completed_sync')
         if not os.path.exists(progress) or self.update_run:
-            _sy.sync()
+            if self.mock_run:
+                _lo.log(_line)
+            else:
+                _sy.sync()
             stampit(progress)
 
         # seed() is never done for an update run
         progress = os.path.join(tmpdir, '.completed_seed')
         if not os.path.exists(progress) and not self.update_run:
-            _se.seed()
+            if self.mock_run:
+                _lo.log(_line)
+            else:
+                _se.seed()
             stampit(progress)
 
         # Read the build script and execute a line at a time.


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10 11:22 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10 11:22 UTC (permalink / raw
  To: gentoo-commits

commit:     5c8cd4560eb2fe3acf10d90f0fc3798c60b9d1b3
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 11:28:32 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 11:28:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=5c8cd456

grs/Interpret.py: fix logging during sync/seed.

 grs/Interpret.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index c90a9bd..2bf880c 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -157,7 +157,7 @@ class Interpret(Daemon):
         progress = os.path.join(tmpdir, '.completed_sync')
         if not os.path.exists(progress) or self.update_run:
             if self.mock_run:
-                _lo.log(_line)
+                _lo.log('sync')
             else:
                 _sy.sync()
             stampit(progress)
@@ -166,7 +166,7 @@ class Interpret(Daemon):
         progress = os.path.join(tmpdir, '.completed_seed')
         if not os.path.exists(progress) and not self.update_run:
             if self.mock_run:
-                _lo.log(_line)
+                _lo.log('seed')
             else:
                 _se.seed()
             stampit(progress)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10 11:44 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10 11:44 UTC (permalink / raw
  To: gentoo-commits

commit:     30cbbe17a8f849e3fb41dc9a85756581c6395c6f
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 11:50:06 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 11:50:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=30cbbe17

grs/Interpret.py: fix minor errors in semantic_action().

 grs/Interpret.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 2bf880c..a42400d 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -94,8 +94,9 @@ class Interpret(Daemon):
                     _lo.log(_line)
                     return
                 try:
-                   f(*args) 
-                except Exception as err:
+                   func(*args) 
+                except Exception as excpt:
+                    err = excpt
                     pass
             else:
                 err = 'Number of parameters incorrect.'


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10 12:22 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10 12:22 UTC (permalink / raw
  To: gentoo-commits

commit:     4476229290dcd40ef1dd7320b84ea86e5e1b8fa9
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 12:28:22 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 12:28:22 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=44762292

grs/Interpret.py: fix minor errors.

 grs/Interpret.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index a42400d..3e2c408 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -94,10 +94,9 @@ class Interpret(Daemon):
                     _lo.log(_line)
                     return
                 try:
-                   func(*args) 
+                    func(*args)
                 except Exception as excpt:
                     err = excpt
-                    pass
             else:
                 err = 'Number of parameters incorrect.'
 


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

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

commit:     438ed1265ea9b4b7957d4b3b098abab6a37ebb5a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 19:10:10 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 19:10:10 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=438ed126

grs/Execute.py, Interpret.py: clean up signal code

While the following may look like a good idea, its not:

	while True:
	    os.kill(pid, signal.SIGKILL)

If pid is zombied, we're stuck in an infinite loop.  Rather
for all processes in the cgroup we just aggressively send a
SIGKILL until only the first ancestor remains.

 grs/Execute.py   | 23 +++++++----------------
 grs/Interpret.py | 18 +++---------------
 2 files changed, 10 insertions(+), 31 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 0e70221..7b0e5a2 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -42,12 +42,6 @@ class Execute():
             logfile     - A file to log output to.  If logfile = None, then we log
                           to sys.stdout.
         """
-        def signalexit():
-            pid = os.getpid()
-            while True:
-                os.kill(pid, signal.SIGTERM)
-                time.sleep(2.0)
-
         if shell:
             args = cmd
         else:
@@ -71,19 +65,16 @@ class Execute():
         if not timed_out:
             # _rc = None if we had a timeout
             _rc = proc.returncode
-            if _rc:
-                _file.write('EXIT CODE: %d\n' % _rc)
-                if not failok:
-                    _file.write('SENDING SIGTERM\n')
-                    _file.close()
-                    signalexit()
+            _file.write('EXIT CODE: %d\n' % _rc)
 
         if timed_out:
             _file.write('TIMEOUT ERROR: %s\n' % cmd)
-            if not failok:
-                _file.write('SENDING SIGTERM\n')
-                _file.close()
-                signalexit()
+
+        if not failok and ( _rc != 0 or timed_out):
+            pid = os.getpid()
+            _file.write('SENDING SIGTERM: %s\n' % pid)
+            _file.close()
+            os.kill(pid, signal.SIGTERM)
 
         # Only close a logfile, don't close sys.stderr!
         if logfile:

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 3e2c408..5624fd4 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -64,12 +64,7 @@ class Interpret(Daemon):
                         if mypid == pid:
                             continue
                         try:
-                            for i in range(10):
-                                os.kill(pid, signal.SIGTERM)
-                                time.sleep(0.2)
-                            while True:
-                                os.kill(pid, signal.SIGKILL)
-                                time.sleep(0.2)
+                            os.kill(pid, signal.SIGKILL)
                         except ProcessLookupError:
                             pass
             try:
@@ -79,13 +74,6 @@ class Interpret(Daemon):
             sys.exit(signum + 128)
 
 
-        def signalexit():
-            pid = os.getpid()
-            while True:
-                os.kill(pid, signal.SIGTERM)
-                time.sleep(2.0)
-
-
         def semantic_action(_line, objs, nargs, func, *args):
             """ Execute the directive """
             err = None
@@ -104,7 +92,7 @@ class Interpret(Daemon):
                 _lo.log('Bad command:   %s' % _line)
                 _lo.log('Error message: %s' % err)
                 _lo.log('SENDING SIGTERM\n')
-                signalexit()
+                os.kill(os.getpid(), signal.SIGTERM)
 
 
         def stampit(progress):
@@ -262,7 +250,7 @@ class Interpret(Daemon):
                     _lo.log('Bad command: %s' % _line)
                     _lo.log('Unknown verb: %s' % verb)
                     _lo.log('SENDING SIGTERM\n')
-                    signalexit()
+                    os.kill(os.getpid(), signal.SIGTERM)
 
                 stampit(progress)
 


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-10-10 19:36 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-10-10 19:36 UTC (permalink / raw
  To: gentoo-commits

commit:     e7233ec6f81bf3ec2fd77303c0bef67252c6494c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 19:42:36 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 19:42:36 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=e7233ec6

grs/Execute.py: suppress logging rc = 0.

 grs/Execute.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 7b0e5a2..87667be 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -65,7 +65,8 @@ class Execute():
         if not timed_out:
             # _rc = None if we had a timeout
             _rc = proc.returncode
-            _file.write('EXIT CODE: %d\n' % _rc)
+            if _rc != 0:
+                _file.write('EXIT CODE: %d\n' % _rc)
 
         if timed_out:
             _file.write('TIMEOUT ERROR: %s\n' % cmd)


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

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

commit:     ca4930493d12a8e2d8aa22ab70801f8569e88559
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 20:26:02 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 20:26:02 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=ca493049

lint: minor code cleanups.

 grs/Execute.py   | 3 +--
 grs/Interpret.py | 9 ++++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/grs/Execute.py b/grs/Execute.py
index 87667be..8d9da75 100644
--- a/grs/Execute.py
+++ b/grs/Execute.py
@@ -21,7 +21,6 @@ import signal
 import shlex
 import subprocess
 import sys
-import time
 from grs.Constants import CONST
 
 class Execute():
@@ -71,7 +70,7 @@ class Execute():
         if timed_out:
             _file.write('TIMEOUT ERROR: %s\n' % cmd)
 
-        if not failok and ( _rc != 0 or timed_out):
+        if not failok and (_rc != 0 or timed_out):
             pid = os.getpid()
             _file.write('SENDING SIGTERM: %s\n' % pid)
             _file.close()

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 5624fd4..ab16cfa 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -20,7 +20,6 @@ import os
 import re
 import signal
 import sys
-import time
 
 from grs.Constants import CONST
 from grs.Daemon import Daemon
@@ -81,6 +80,9 @@ class Interpret(Daemon):
                 if self.mock_run:
                     _lo.log(_line)
                     return
+                # We'll catch this exception to get in into the
+                # GRS system log rather than the daemon log.  Without
+                # the try-except, it would wind up in the daemon log.
                 try:
                     func(*args)
                 except Exception as excpt:
@@ -89,10 +91,11 @@ class Interpret(Daemon):
                 err = 'Number of parameters incorrect.'
 
             if err:
+                pid = os.getpid()
                 _lo.log('Bad command:   %s' % _line)
                 _lo.log('Error message: %s' % err)
-                _lo.log('SENDING SIGTERM\n')
-                os.kill(os.getpid(), signal.SIGTERM)
+                _lo.log('SENDING SIGTERM to %d' % pid)
+                os.kill(pid, signal.SIGTERM)
 
 
         def stampit(progress):


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2015-11-26 19:48 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2015-11-26 19:48 UTC (permalink / raw
  To: gentoo-commits

commit:     a92714aacc5da7c5075f1012656426616612534a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 26 19:54:53 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Nov 26 19:54:53 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=a92714aa

grs/WorldConf.py: guard against <cat>/<pkg> with no ebuilds.

 grs/WorldConf.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index 48b93af..83c2175 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -82,7 +82,11 @@ class WorldConf():
         # Construct a list of canonical named files for uninstalled pkgs.
         slot_atoms = []
         for _cp in uninstalled:
-            _cpv = portdb.cp_list(_cp)[0]
+            try:
+                _cpv = portdb.cp_list(_cp)[0]
+            except IndexError:
+                print('Package with no ebuilds: %s' % _cp)
+                continue
             slotvar = portdb.aux_get(_cpv, ['SLOT'])[0]
             try:
                 _match = re.search(r'(.+?)\/(.+)', slotvar)


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

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

commit:     53229170dbe506c5542bd9a68d3d909dfa93cc2c
Author:     Matteo Contri <matteo.contri <AT> tecem <DOT> it>
AuthorDate: Wed Mar 23 14:42:19 2016 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 15:11:41 2016 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=53229170

grs/Rotator.py: make glob more stricter

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Rotator.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grs/Rotator.py b/grs/Rotator.py
index a3684a9..f303c14 100644
--- a/grs/Rotator.py
+++ b/grs/Rotator.py
@@ -42,11 +42,12 @@ class Rotator():
 
             obj's paste an upper limit are deleted.
         """
-        objs = glob.glob('%s.*' % obj)
+        objs = glob.glob('%s.[0-9]*' % obj)
         indexed_obj = {}
         for _obj in objs:
             _match = re.search(r'^.+\.(\d+)$', _obj)
-            indexed_obj[int(_match.group(1))] = _obj
+            if (_match.group(1)):
+                indexed_obj[int(_match.group(1))] = _obj
         count = list(indexed_obj.keys())
         count.sort()
         count.reverse()


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2016-03-23 15:08 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2016-03-23 15:08 UTC (permalink / raw
  To: gentoo-commits

commit:     73b9004664d281b9e8bff36f81bf887d5c941d93
Author:     Matteo Contri <matteo.contri <AT> tecem <DOT> it>
AuthorDate: Wed Mar 23 14:42:19 2016 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 15:15:10 2016 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=73b90046

grs/Rotator.py: make glob stricter

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Rotator.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grs/Rotator.py b/grs/Rotator.py
index a3684a9..f303c14 100644
--- a/grs/Rotator.py
+++ b/grs/Rotator.py
@@ -42,11 +42,12 @@ class Rotator():
 
             obj's paste an upper limit are deleted.
         """
-        objs = glob.glob('%s.*' % obj)
+        objs = glob.glob('%s.[0-9]*' % obj)
         indexed_obj = {}
         for _obj in objs:
             _match = re.search(r'^.+\.(\d+)$', _obj)
-            indexed_obj[int(_match.group(1))] = _obj
+            if (_match.group(1)):
+                indexed_obj[int(_match.group(1))] = _obj
         count = list(indexed_obj.keys())
         count.sort()
         count.reverse()


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-23 14:15 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-23 14:15 UTC (permalink / raw
  To: gentoo-commits

commit:     f2fbce01954b6fadc3d18d7e9dba2934bdf204aa
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 23 14:14:54 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Dec 23 14:14:54 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=f2fbce01

grs/Kernel.p: add arch on the kernel directive line

 grs/Interpret.py | 2 +-
 grs/Kernel.py    | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index ab16cfa..45eca5f 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -227,7 +227,7 @@ class Interpret(Daemon):
                 elif verb == 'pivot':
                     semantic_action(_line, objs, 1, _pc.pivot, objs[0], _md)
                 elif verb == 'kernel':
-                    semantic_action(_line, objs, 0, _ke.kernel)
+                    semantic_action(_line, objs, 0, _ke.kernel, objs[0])
                 elif verb == 'tarit':
                     # 'tarit' can either be just a verb, or a 'verb obj' pair.
                     if len(objs):

diff --git a/grs/Kernel.py b/grs/Kernel.py
index cd2ecee..fe411bd 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -69,7 +69,7 @@ class Kernel():
         return (gentoo_version, pkg_name, has_modules)
 
 
-    def kernel(self):
+    def kernel(self, arch='x86_64'):
         """ This emerges the kernel sources to a directory outside of the
             fledgeling system's portage configroot, builds and installs it
             to yet another external directory, bundles the kernel and modules
@@ -108,8 +108,8 @@ class Kernel():
 
         # Build and install the image outside the portage configroot so
         # we can both rsync it in *and* tarball it for downloads via grsup.
-        # TODO: add more options (eg splash and firmware), which can be
-        # specified vi the kernel line in the build script.
+        # NOTE: more options (eg splash and firmware), can be specified
+        # via the kernel line in the build script.
         cmd = 'genkernel '
         cmd += '--logfile=/dev/null '
         cmd += '--no-save-config '
@@ -122,6 +122,7 @@ class Kernel():
         cmd += '--bootdir=%s '       % boot_dir
         cmd += '--module-prefix=%s ' % image_dir
         cmd += '--modprobedir=%s '   % modprobe_dir
+        cmd += '--arch-override=%s ' % arch
         if has_modules:
             cmd += 'all'
         else:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-23 16:04 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-23 16:04 UTC (permalink / raw
  To: gentoo-commits

commit:     88b09b807c7c3f8e6da242eae864f9bc0c2daf33
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 23 16:04:22 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Dec 23 16:04:22 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=88b09b80

grs/Interpret.py: fix number of args for _ke.kernel()

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 45eca5f..523cdda 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -227,7 +227,7 @@ class Interpret(Daemon):
                 elif verb == 'pivot':
                     semantic_action(_line, objs, 1, _pc.pivot, objs[0], _md)
                 elif verb == 'kernel':
-                    semantic_action(_line, objs, 0, _ke.kernel, objs[0])
+                    semantic_action(_line, objs, 1, _ke.kernel, objs[0])
                 elif verb == 'tarit':
                     # 'tarit' can either be just a verb, or a 'verb obj' pair.
                     if len(objs):


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-25 23:24 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-25 23:24 UTC (permalink / raw
  To: gentoo-commits

commit:     9216169ba661bf2506468b394c525bc727feba62
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 25 23:23:31 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Dec 25 23:24:24 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=9216169b

grs/Netboot.py: initial commit of netbootit directive.

 grs/Interpret.py | 10 ++++++
 grs/Netboot.py   | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 109 insertions(+)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 523cdda..7bdfa01 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -134,6 +134,7 @@ class Interpret(Daemon):
         _ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         _bi = TarIt(name, portage_configroot, logfile)
         _io = ISOIt(name, libdir, tmpdir, portage_configroot, logfile)
+        _nb - Netboot(name, libdir, tmpdir, portage_configroot, kernelroot, logfile)
 
         # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)
@@ -242,11 +243,20 @@ class Interpret(Daemon):
                     else:
                         semantic_action(_line, objs, 0, _io.isoit)
                     medium_type = 'isoit'
+                elif verb == 'netbootit':
+                    # 'netbootit' can either be just a verb, or a 'verb obj' pair.
+                    if len(objs):
+                        semantic_action(_line, objs, 1, _nb.netbootit, objs[0])
+                    else:
+                        semantic_action(_line, objs, 0, _nb.netbootit)
+                    medium_type = 'netbootit'
                 elif verb == 'hashit':
                     if medium_type == 'tarit':
                         semantic_action(_line, objs, 0, _bi.hashit)
                     elif medium_type == 'isoit':
                         semantic_action(_line, objs, 0, _io.hashit)
+                    elif medium_type == 'netbootit':
+                        semantic_action(_line, objs, 0, _nb.hashit)
                     else:
                         raise Exception('Unknown medium to hash.')
                 else:

diff --git a/grs/Netboot.py b/grs/Netboot.py
new file mode 100644
index 0000000..11a78d2
--- /dev/null
+++ b/grs/Netboot.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+#
+#    Netboot.py: this file is part of the GRS suite
+#    Copyright (C) 2017  Anthony G. Basile
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import shutil
+from datetime import datetime
+from grs.Constants import CONST
+from grs.Execute import Execute
+from grs.HashIt import HashIt
+
+class Netboot(HashIt):
+    """ Create a Netboot image of the system. """
+
+    def __init__(
+            self,
+            name,
+            libdir=CONST.LIBDIR,
+            tmpdir=CONST.TMPDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            kernelroot=CONST.KERNELROOT,
+            logfile=CONST.LOGFILE
+    ):
+        self.libdir = libdir
+        self.tmpdir = tmpdir
+        self.portage_configroot = portage_configroot
+        self.logfile = logfile
+        # Prepare a year, month and day for a name timestamp.
+        self.year = str(datetime.now().year).zfill(4)
+        self.month = str(datetime.now().month).zfill(2)
+        self.day = str(datetime.now().day).zfill(2)
+        self.medium_name = 'initramfs-%s-%s%s%s' % (name, self.year, self.month, self.day)
+        self.digest_name = 'initramfs-%s.DIGESTS' % self.medium_name
+
+
+    def netbootit(self, alt_name=None):
+        """ TODO """
+        if alt_name:
+            self.medium_name = 'initramfs-%s-%s%s%s' % (alt_name, self.year, self.month, self.day)
+            self.digest_name = 'initramfs-%s.DIGESTS' % self.medium_name
+
+        # 0. Pepare netboot directory
+        netboot_dir = os.path.join(self.tmpdir, 'netboot')
+        shutil.rmtree(netboot_dir, ignore_errors=True)
+        os.makedirs(netboot_dir, mode=0o755, exist_ok=False)
+
+        # 1. Move the kernel into the netboot directory.
+        kernel_dir = os.path.join(self.portage_configroot, 'boot')
+        kernel_path = os.path.join(kernel_dir, 'kernel')
+        shutil.copy(kernel_path, netboot_dir)
+
+        # 2. Unpack the initramfs into kernelroot/initramfs direcotry
+        initramfs_root = os.path.join(self.kernelroot, 'initramfs')
+        shutil.rmtree(initramfs_root, ignore_errors=True)
+        os.makedirs(initramfs_root, mode=0o755, exist_ok=False)
+
+        initramfs_path = os.path.join(kernel_dir, 'initramfs')
+        cmd = 'xz -dc %s | cpio -idv' % (initramfs_path)
+
+        cwd = os.getcwd()
+        os.chdir(initramfs_root)
+        Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
+        os.chdir(cwd)
+
+        # 3. Make the squashfs image in the netboot directory.
+        squashfs_dir = os.path.join(initramfs_root, 'mnt/cdrom')
+        shutil.rmtree(squashfs_dir, ignore_errors=True)
+        os.makedirs(squashfs_dir, mode=0o755, exist_ok=False)
+        squashfs_path = os.path.join(squashfs_dir, 'image.squashfs')
+        cmd = 'mksquashfs %s %s -xattrs -comp xz' % (self.portage_configroot, squashfs_path)
+        Execute(cmd, timeout=None, logfile=self.logfile)
+
+        # 4. Copy in the init script
+        init_path = os.path.join(self.libdir, 'scripts/init')
+        shutil.copy(init_path, initramfs_root)
+
+
+        # 5. Repack
+        initramfs_path = os.path.join(netboot_dir, self.medium_name)
+        cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_path
+
+        cwd = os.getcwd()
+        os.chdir(initramfs_root)
+        Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
+        os.chdir(cwd)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-25 23:38 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-25 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     0bf65c519cb9190fa5fffe66cd644606e5d67bb1
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 25 23:38:31 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Dec 25 23:38:31 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=0bf65c51

grs/__init__.py: import Netboot class

 grs/Interpret.py | 1 +
 grs/__init__.py  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 7bdfa01..d6fdad9 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -27,6 +27,7 @@ from grs.ISOIt import ISOIt
 from grs.Log import Log
 from grs.Kernel import Kernel
 from grs.MountDirectories import MountDirectories
+from grs.Netboot import Netboot
 from grs.PivotChroot import PivotChroot
 from grs.Populate import Populate
 from grs.RunScript import RunScript

diff --git a/grs/__init__.py b/grs/__init__.py
index fb1b64b..4c5f585 100644
--- a/grs/__init__.py
+++ b/grs/__init__.py
@@ -25,6 +25,7 @@ from grs.ISOIt import ISOIt
 from grs.Log import Log
 from grs.Kernel import Kernel
 from grs.MountDirectories import MountDirectories
+from grs.Netboot import Netboot
 from grs.PivotChroot import PivotChroot
 from grs.Populate import Populate
 from grs.Rotator import Rotator


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-26  0:04 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-26  0:04 UTC (permalink / raw
  To: gentoo-commits

commit:     ba36d48d5de17bafe584d74640e41660d6aa09b4
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 00:04:26 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 00:04:26 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=ba36d48d

grs/Netboot.py: chmod 755 the init script

 grs/Netboot.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 22279cc..0918f1a 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -86,9 +86,10 @@ class Netboot(HashIt):
         Execute(cmd, timeout=None, logfile=self.logfile)
 
         # 4. Copy in the init script
-        init_path = os.path.join(self.libdir, 'scripts/init')
-        shutil.copy(init_path, initramfs_root)
-
+        init_src = os.path.join(self.libdir, 'scripts/init')
+        init_dst = os.path.join(initramfs_root, 'init')
+        shutil.copy(init_src, init_dst)
+        os.chmod(init_dst, 0o0755)
 
         # 5. Repack
         initramfs_path = os.path.join(netboot_dir, self.medium_name)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-26  0:04 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-26  0:04 UTC (permalink / raw
  To: gentoo-commits

commit:     eb8e68b4cd1ff1f90dcf93ed8c1a58f71f4332d3
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 25 23:41:21 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Dec 25 23:41:21 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=eb8e68b4

grs/Interpret.py: fix typo

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index d6fdad9..9baf41b 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -135,7 +135,7 @@ class Interpret(Daemon):
         _ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         _bi = TarIt(name, portage_configroot, logfile)
         _io = ISOIt(name, libdir, tmpdir, portage_configroot, logfile)
-        _nb - Netboot(name, libdir, tmpdir, portage_configroot, kernelroot, logfile)
+        _nb = Netboot(name, libdir, tmpdir, portage_configroot, kernelroot, logfile)
 
         # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-26  0:04 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-26  0:04 UTC (permalink / raw
  To: gentoo-commits

commit:     50e55fd33ba1bfcdd22a68cd7302716a7c5366f2
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 00:03:17 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 00:03:17 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=50e55fd3

grs/Netboot.py: add self.kernelroot

 grs/Netboot.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 11a78d2..22279cc 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -38,6 +38,7 @@ class Netboot(HashIt):
         self.libdir = libdir
         self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
+        self.kernelroot = kernelroot
         self.logfile = logfile
         # Prepare a year, month and day for a name timestamp.
         self.year = str(datetime.now().year).zfill(4)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-26 14:19 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-26 14:19 UTC (permalink / raw
  To: gentoo-commits

commit:     906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 14:18:58 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 14:18:58 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=906e7ab1

grs/Netboot.py: move kernel/initramfs to tmpdir

 grs/Netboot.py | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 0918f1a..469418c 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -45,7 +45,8 @@ class Netboot(HashIt):
         self.month = str(datetime.now().month).zfill(2)
         self.day = str(datetime.now().day).zfill(2)
         self.medium_name = 'initramfs-%s-%s%s%s' % (name, self.year, self.month, self.day)
-        self.digest_name = 'initramfs-%s.DIGESTS' % self.medium_name
+        self.digest_name = '%s.DIGESTS' % self.medium_name
+        self.kernelname = 'kernel-%s-%s%s%s' % (name, self.year, self.month, self.day)
 
 
     def netbootit(self, alt_name=None):
@@ -54,30 +55,25 @@ class Netboot(HashIt):
             self.medium_name = 'initramfs-%s-%s%s%s' % (alt_name, self.year, self.month, self.day)
             self.digest_name = 'initramfs-%s.DIGESTS' % self.medium_name
 
-        # 0. Pepare netboot directory
-        netboot_dir = os.path.join(self.tmpdir, 'netboot')
-        shutil.rmtree(netboot_dir, ignore_errors=True)
-        os.makedirs(netboot_dir, mode=0o755, exist_ok=False)
-
-        # 1. Move the kernel into the netboot directory.
-        kernel_dir = os.path.join(self.portage_configroot, 'boot')
-        kernel_path = os.path.join(kernel_dir, 'kernel')
-        shutil.copy(kernel_path, netboot_dir)
+        # 1. Move the kernel to the tmpdir directory.
+        kernel_src = os.path.join(self.portage_configroot, 'boot/kernel')
+        kernel_dst = os.path.join(self.tmpdir, self.kernelname)
+        shutil.copy(kernel_src, kernel_dst)
 
         # 2. Unpack the initramfs into kernelroot/initramfs direcotry
         initramfs_root = os.path.join(self.kernelroot, 'initramfs')
         shutil.rmtree(initramfs_root, ignore_errors=True)
         os.makedirs(initramfs_root, mode=0o755, exist_ok=False)
 
-        initramfs_path = os.path.join(kernel_dir, 'initramfs')
-        cmd = 'xz -dc %s | cpio -idv' % (initramfs_path)
+        initramfs_src = os.path.join(self.portage_configroot, 'boot/initramfs')
+        cmd = 'xz -dc %s | cpio -idv' % (initramfs_src)
 
         cwd = os.getcwd()
         os.chdir(initramfs_root)
         Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
         os.chdir(cwd)
 
-        # 3. Make the squashfs image in the netboot directory.
+        # 3. Make the squashfs image in the tmpdir directory.
         squashfs_dir = os.path.join(initramfs_root, 'mnt/cdrom')
         shutil.rmtree(squashfs_dir, ignore_errors=True)
         os.makedirs(squashfs_dir, mode=0o755, exist_ok=False)
@@ -92,8 +88,8 @@ class Netboot(HashIt):
         os.chmod(init_dst, 0o0755)
 
         # 5. Repack
-        initramfs_path = os.path.join(netboot_dir, self.medium_name)
-        cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_path
+        initramfs_dst = os.path.join(self.tmpdir, self.medium_name)
+        cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_dst
 
         cwd = os.getcwd()
         os.chdir(initramfs_root)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-27  9:25 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-27  9:25 UTC (permalink / raw
  To: gentoo-commits

commit:     6f93749d08da2eac91cfc424eac5b5afaf23ab3b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 27 09:25:45 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Dec 27 09:25:45 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=6f93749d

grs/Netboot.py: fix alt digest name

 grs/Netboot.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 469418c..c4bb9ff 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -53,9 +53,9 @@ class Netboot(HashIt):
         """ TODO """
         if alt_name:
             self.medium_name = 'initramfs-%s-%s%s%s' % (alt_name, self.year, self.month, self.day)
-            self.digest_name = 'initramfs-%s.DIGESTS' % self.medium_name
+            self.digest_name = '%s.DIGESTS' % self.medium_name
 
-        # 1. Move the kernel to the tmpdir directory.
+        # 1. Copy the kernel to the tmpdir directory.
         kernel_src = os.path.join(self.portage_configroot, 'boot/kernel')
         kernel_dst = os.path.join(self.tmpdir, self.kernelname)
         shutil.copy(kernel_src, kernel_dst)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-28 17:22 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-28 17:22 UTC (permalink / raw
  To: gentoo-commits

commit:     d8303e6a6da6ab34a2d08b04bc026a211e00d2be
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 28 17:19:19 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 17:19:19 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=d8303e6a

grs/Netboot.py: build busybox inside the system chroot

 grs/Netboot.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index c4bb9ff..62cc17c 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -73,6 +73,14 @@ class Netboot(HashIt):
         Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
         os.chdir(cwd)
 
+        # 2.5 Don't trust genkernel's busybox, but copy in our own version
+        # built in the system chroot.  This ensures it will work on the
+        # target system.
+        # TODO: We need to make sure that we've linked busybox staticly.
+        busybox_src = os.path.join(self.portage_configroot, 'bin/busybox')
+        busybox_dst = os.path.join(self.kernelroot, 'initramfs/bin/busybox')
+        shutil.copy(busybox_src, busybox_dst)
+
         # 3. Make the squashfs image in the tmpdir directory.
         squashfs_dir = os.path.join(initramfs_root, 'mnt/cdrom')
         shutil.rmtree(squashfs_dir, ignore_errors=True)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2017-12-28 17:54 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2017-12-28 17:54 UTC (permalink / raw
  To: gentoo-commits

commit:     dc4ac6709b7d4eefa335995483151a8c47052408
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 28 17:54:24 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 17:54:24 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=dc4ac670

grs/Netboot.py: use only xz compression

 grs/Netboot.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 62cc17c..1b3ea80 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -65,6 +65,7 @@ class Netboot(HashIt):
         shutil.rmtree(initramfs_root, ignore_errors=True)
         os.makedirs(initramfs_root, mode=0o755, exist_ok=False)
 
+        # We will only use xz compression
         initramfs_src = os.path.join(self.portage_configroot, 'boot/initramfs')
         cmd = 'xz -dc %s | cpio -idv' % (initramfs_src)
 
@@ -97,7 +98,7 @@ class Netboot(HashIt):
 
         # 5. Repack
         initramfs_dst = os.path.join(self.tmpdir, self.medium_name)
-        cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_dst
+        cmd = 'find . -print | cpio -H newc -o | xz -9e --check=none -z -f > %s' % initramfs_dst
 
         cwd = os.getcwd()
         os.chdir(initramfs_root)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-10 20:40 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-10 20:40 UTC (permalink / raw
  To: gentoo-commits

commit:     e11c2d0de7b0aec7157a3fd4d5344eb79304bd86
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 10 20:40:24 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jan 10 20:40:24 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=e11c2d0d

grs/Netboot.py: use busybox built by genkernel

 grs/Netboot.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 1b3ea80..985bcfd 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -74,6 +74,13 @@ class Netboot(HashIt):
         Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
         os.chdir(cwd)
 
+        ''' The issue here was that busybox was build in the host env like the
+        kernel and that means that we are using the host's ARCH and the cpuflags
+        which are now poluting the initramfs.  The better approach to building
+        a kernel and initramfs is to drop the Kernel.py module altogether and
+        emerge genkernel in the fledgeling system via the script directive, set
+        genkernel.conf via the populate directive and then just run genkernel.
+
         # 2.5 Don't trust genkernel's busybox, but copy in our own version
         # built in the system chroot.  This ensures it will work on the
         # target system.
@@ -81,6 +88,7 @@ class Netboot(HashIt):
         busybox_src = os.path.join(self.portage_configroot, 'bin/busybox')
         busybox_dst = os.path.join(self.kernelroot, 'initramfs/bin/busybox')
         shutil.copy(busybox_src, busybox_dst)
+        '''
 
         # 3. Make the squashfs image in the tmpdir directory.
         squashfs_dir = os.path.join(initramfs_root, 'mnt/cdrom')


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-10 21:02 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-10 21:02 UTC (permalink / raw
  To: gentoo-commits

commit:     7fdb50bd3be0467d2bfefac8fde9554ed7956cce
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 10 21:01:55 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jan 10 21:01:55 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=7fdb50bd

grs/Netboot.py: switch from xz to gzip compression

 grs/Netboot.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 985bcfd..307b3b3 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -65,9 +65,9 @@ class Netboot(HashIt):
         shutil.rmtree(initramfs_root, ignore_errors=True)
         os.makedirs(initramfs_root, mode=0o755, exist_ok=False)
 
-        # We will only use xz compression
+        # We will use gzip compression
         initramfs_src = os.path.join(self.portage_configroot, 'boot/initramfs')
-        cmd = 'xz -dc %s | cpio -idv' % (initramfs_src)
+        cmd = 'cat %s | gunzip | cpio -idv' % (initramfs_src)
 
         cwd = os.getcwd()
         os.chdir(initramfs_root)
@@ -95,7 +95,7 @@ class Netboot(HashIt):
         shutil.rmtree(squashfs_dir, ignore_errors=True)
         os.makedirs(squashfs_dir, mode=0o755, exist_ok=False)
         squashfs_path = os.path.join(squashfs_dir, 'image.squashfs')
-        cmd = 'mksquashfs %s %s -xattrs -comp xz' % (self.portage_configroot, squashfs_path)
+        cmd = 'mksquashfs %s %s -xattrs -comp gzip' % (self.portage_configroot, squashfs_path)
         Execute(cmd, timeout=None, logfile=self.logfile)
 
         # 4. Copy in the init script
@@ -106,7 +106,7 @@ class Netboot(HashIt):
 
         # 5. Repack
         initramfs_dst = os.path.join(self.tmpdir, self.medium_name)
-        cmd = 'find . -print | cpio -H newc -o | xz -9e --check=none -z -f > %s' % initramfs_dst
+        cmd = 'find . -print | cpio -H newc -o | gzip -9 -f > %s' % initramfs_dst
 
         cwd = os.getcwd()
         os.chdir(initramfs_root)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-13 17:40 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-13 17:40 UTC (permalink / raw
  To: gentoo-commits

commit:     75b1b7cc4faf3c2fd455a5b6260e51c2b2a38c0b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 13 17:37:04 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Jan 13 17:37:04 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=75b1b7cc

grs/Netboot.py: change name of source init script for netboot

Since we want an init script for ISO images too, we need to rename
the netboot init script to avoid a name collision.

 grs/Netboot.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 307b3b3..ae5a0a4 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -99,7 +99,7 @@ class Netboot(HashIt):
         Execute(cmd, timeout=None, logfile=self.logfile)
 
         # 4. Copy in the init script
-        init_src = os.path.join(self.libdir, 'scripts/init')
+        init_src = os.path.join(self.libdir, 'scripts/init.netboot')
         init_dst = os.path.join(initramfs_root, 'init')
         shutil.copy(init_src, init_dst)
         os.chmod(init_dst, 0o0755)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-14 14:07 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-14 14:07 UTC (permalink / raw
  To: gentoo-commits

commit:     f4caf3c0c28d0773f29d044aadcb3ec507ccf662
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 14 14:07:28 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan 14 14:07:28 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=f4caf3c0

grs/Netboot.py: add option to make efi hybrid bootable CD

 grs/Interpret.py |  6 ++++--
 grs/Netboot.py   | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 9baf41b..2f3d5a5 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -245,8 +245,10 @@ class Interpret(Daemon):
                         semantic_action(_line, objs, 0, _io.isoit)
                     medium_type = 'isoit'
                 elif verb == 'netbootit':
-                    # 'netbootit' can either be just a verb, or a 'verb obj' pair.
-                    if len(objs):
+                    # 'netbootit' can either be just a 'verb', 'verb obj' or 'verb obj obj'
+                    if len(objs) == 2:
+                        semantic_action(_line, objs, 1, _nb.netbootit, objs[0], obj[1])
+                    elif len(objs) == 1:
                         semantic_action(_line, objs, 1, _nb.netbootit, objs[0])
                     else:
                         semantic_action(_line, objs, 0, _nb.netbootit)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index ae5a0a4..60cb027 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -47,9 +47,10 @@ class Netboot(HashIt):
         self.medium_name = 'initramfs-%s-%s%s%s' % (name, self.year, self.month, self.day)
         self.digest_name = '%s.DIGESTS' % self.medium_name
         self.kernelname = 'kernel-%s-%s%s%s' % (name, self.year, self.month, self.day)
+        self.cd_name = '%s-%s%s%s.ISO' % (name, self.year, self.month, self.day)
 
 
-    def netbootit(self, alt_name=None):
+    def netbootit(self, do_cd=None, alt_name=None):
         """ TODO """
         if alt_name:
             self.medium_name = 'initramfs-%s-%s%s%s' % (alt_name, self.year, self.month, self.day)
@@ -112,3 +113,52 @@ class Netboot(HashIt):
         os.chdir(initramfs_root)
         Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
         os.chdir(cwd)
+
+        # 6. If do_cd='cd' then we package a bootable CD image
+        # TODO: This code is rushed and we need a better way of
+        # locating the tarball
+        if do_cd == 'cd':
+            tarball_path = '/usr/share/grs-*/ISO-*.tar.gz'
+            cmd = 'tar -Jcf %s .' % (tarball_path)
+
+            cwd = os.getcwd()
+            os.chdir(initramfs_root)
+            Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
+            os.chdir(cwd)
+
+            # Note: we are copying the netboot kernel and initramfs into
+            # the ISO directory, so the kernel_dst and initramfs_dst above
+            # are the sources for these files
+            iso_dir = os.path.join(self.kernelroot, 'ISO')
+            isolinux_dir = os.path.join(iso_dir, 'isolinux')
+            shutil.copy(kernel_dst, '%s/kernel' % (isolinux_dir))
+            shutil.copy(initramfs_dst, '%s/initrd' % (isolinux_dir))
+
+            # Note gentoo.efimg and isolinux.bin are in the ISO tarball
+            # isolinux.bin comes from sys-boot/syslinux
+            # gentoo.efimg is created using
+            #  1) dd if=/dev/zero of=gentoo.efimg bs=1k count=16k
+            #  2) mkfs.vfat -F 16 -n GENTOO gentoo.efimg
+            # gentoo.efimg contains ./EFI/BOOT/BOOTX64.EFI
+            # BOOTX64.EFI is created using
+            #  1) mount -o loop gentoo.efimg zzz
+            #  2) mkdir -p zzz/EFI/BOOT/
+            #  3) grub-mkstandalone /boot/grub/grub.cfg=grub-stub.cfg --compress=xz -O x86_64-efi -o zzz/EFI/BOOT/BOOTX64.EFI
+            #  4) umount zzz
+            # Here grub-stub.cfg contains the following lines
+            #  search --no-floppy --set=root --file /grub/grub.cfg
+            #  configfile /grub/grub.cfg
+            args = '-J -R -z '                      # Joliet/Rock Ridge/RRIP
+            args += '-b isolinux/isolinux.bin '     # Use isolinux boot
+            args += '-c isolinux/boot.cat '         # Create the catalog file
+            args += '-no-emul-boot '                # No disk emulation for El Torito
+            args += '-boot-load-size 4 '            # 4x512-bit sectors for no-emulation mode
+            args += '-boot-info-table '             # Create El Torito boot info table
+            args += '-eltorito-alt-boot '           # Add an alternative boot entry
+            args += '-eltorito-platform efi '       # The additional boot entry is EFI
+            args += '-b gentoo.efimg '              # Use EFI boot
+            args += '-no-emul-boot '                # No disk emulation for El Torito
+
+            cd_path = os.path.join(self.tmpdir, self.cd_name)
+            cmd = 'mkisofs %s -o %s %s' % (args, cd_path, iso_dir)
+            Execute(cmd, timeout=None, logfile=self.logfile)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-14 14:37 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-14 14:37 UTC (permalink / raw
  To: gentoo-commits

commit:     d5ea03d6dca068ea7c4ee01209f2be600c52359b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 14 14:37:29 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan 14 14:37:29 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=d5ea03d6

grs/Netboot.py: correct unpacking of ISO tarball

 grs/Netboot.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 60cb027..c012c05 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -119,12 +119,8 @@ class Netboot(HashIt):
         # locating the tarball
         if do_cd == 'cd':
             tarball_path = '/usr/share/grs-*/ISO-*.tar.gz'
-            cmd = 'tar -Jcf %s .' % (tarball_path)
-
-            cwd = os.getcwd()
-            os.chdir(initramfs_root)
-            Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
-            os.chdir(cwd)
+            cmd = 'tar --xattrs -xf %s -C %s' % (tarball_path, initramfs_root)
+            Execute(cmd, timeout=120, logfile=self.logfile)
 
             # Note: we are copying the netboot kernel and initramfs into
             # the ISO directory, so the kernel_dst and initramfs_dst above


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-14 15:02 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-14 15:02 UTC (permalink / raw
  To: gentoo-commits

commit:     e98dba630d78e2dbd97b1e05df7a37b5f320a78c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 14 15:02:40 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan 14 15:02:40 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=e98dba63

grs/Interpret.py: fix bug in semantic interpreter

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 2f3d5a5..74d04e3 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -247,7 +247,7 @@ class Interpret(Daemon):
                 elif verb == 'netbootit':
                     # 'netbootit' can either be just a 'verb', 'verb obj' or 'verb obj obj'
                     if len(objs) == 2:
-                        semantic_action(_line, objs, 1, _nb.netbootit, objs[0], obj[1])
+                        semantic_action(_line, objs, 2, _nb.netbootit, objs[0], obj[1])
                     elif len(objs) == 1:
                         semantic_action(_line, objs, 1, _nb.netbootit, objs[0])
                     else:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-14 17:05 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-14 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     1027c98b5617fceeadc96f479284d645e35595c5
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 14 17:05:30 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan 14 17:05:30 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=1027c98b

grs/Netboot.py: fix path to ISO directory

 grs/Netboot.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index c012c05..6b1fe7c 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -47,7 +47,7 @@ class Netboot(HashIt):
         self.medium_name = 'initramfs-%s-%s%s%s' % (name, self.year, self.month, self.day)
         self.digest_name = '%s.DIGESTS' % self.medium_name
         self.kernelname = 'kernel-%s-%s%s%s' % (name, self.year, self.month, self.day)
-        self.cd_name = '%s-%s%s%s.ISO' % (name, self.year, self.month, self.day)
+        self.cd_name = '%s-%s%s%s.iso' % (name, self.year, self.month, self.day)
 
 
     def netbootit(self, do_cd=None, alt_name=None):
@@ -118,8 +118,9 @@ class Netboot(HashIt):
         # TODO: This code is rushed and we need a better way of
         # locating the tarball
         if do_cd == 'cd':
-            tarball_path = '/usr/share/grs-*/ISO-*.tar.gz'
-            cmd = 'tar --xattrs -xf %s -C %s' % (tarball_path, initramfs_root)
+            # TODO: Before a regular release, we'll have to fix this path
+            tarball_path = '/usr/share/grs-9999/ISO-1.tar.gz'
+            cmd = 'tar --xattrs -xf %s -C %s' % (tarball_path, self.kernelroot)
             Execute(cmd, timeout=120, logfile=self.logfile)
 
             # Note: we are copying the netboot kernel and initramfs into


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-14 18:22 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-14 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     55b0ee8dbf49619836f9a4dffa8b5401e449dfd2
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 14 18:22:01 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan 14 18:22:01 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=55b0ee8d

grs/Kernel.py: utils to have same arch as kernel

 grs/Kernel.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index fe411bd..924bdf9 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -123,6 +123,7 @@ class Kernel():
         cmd += '--module-prefix=%s ' % image_dir
         cmd += '--modprobedir=%s '   % modprobe_dir
         cmd += '--arch-override=%s ' % arch
+        cmd += '--utils-arch=%s '    % arch
         if has_modules:
             cmd += 'all'
         else:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-15  1:23 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-15  1:23 UTC (permalink / raw
  To: gentoo-commits

commit:     07caf3e213b541c6e165e1d65d73640cb2deee10
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 15 01:23:31 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jan 15 01:23:31 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=07caf3e2

grs/Netboot.py: return to using busybox from system root

 grs/Kernel.py  | 1 -
 grs/Netboot.py | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 924bdf9..fe411bd 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -123,7 +123,6 @@ class Kernel():
         cmd += '--module-prefix=%s ' % image_dir
         cmd += '--modprobedir=%s '   % modprobe_dir
         cmd += '--arch-override=%s ' % arch
-        cmd += '--utils-arch=%s '    % arch
         if has_modules:
             cmd += 'all'
         else:

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 6b1fe7c..976a24d 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -81,6 +81,7 @@ class Netboot(HashIt):
         a kernel and initramfs is to drop the Kernel.py module altogether and
         emerge genkernel in the fledgeling system via the script directive, set
         genkernel.conf via the populate directive and then just run genkernel.
+        '''
 
         # 2.5 Don't trust genkernel's busybox, but copy in our own version
         # built in the system chroot.  This ensures it will work on the
@@ -89,7 +90,6 @@ class Netboot(HashIt):
         busybox_src = os.path.join(self.portage_configroot, 'bin/busybox')
         busybox_dst = os.path.join(self.kernelroot, 'initramfs/bin/busybox')
         shutil.copy(busybox_src, busybox_dst)
-        '''
 
         # 3. Make the squashfs image in the tmpdir directory.
         squashfs_dir = os.path.join(initramfs_root, 'mnt/cdrom')


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-15  1:31 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-15  1:31 UTC (permalink / raw
  To: gentoo-commits

commit:     8a9bfffe0feb3b3165392216370f13742a863ca3
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 15 01:31:35 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jan 15 01:31:35 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=8a9bfffe

grs/Netboot.py: fix location of ISO tarball under /usr/share

 grs/Netboot.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 976a24d..33c7b9d 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -119,7 +119,7 @@ class Netboot(HashIt):
         # locating the tarball
         if do_cd == 'cd':
             # TODO: Before a regular release, we'll have to fix this path
-            tarball_path = '/usr/share/grs-9999/ISO-1.tar.gz'
+            tarball_path = '/usr/share/grs/ISO-1.tar.gz'
             cmd = 'tar --xattrs -xf %s -C %s' % (tarball_path, self.kernelroot)
             Execute(cmd, timeout=120, logfile=self.logfile)
 


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-28 12:09 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-28 12:09 UTC (permalink / raw
  To: gentoo-commits

commit:     54e95c897ccf46d94bd888b0cad815c748ba8417
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 28 12:09:25 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan 28 12:09:25 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=54e95c89

grs: prettify __init__ arguments

 grs/ISOIt.py       | 8 ++++++--
 grs/Kernel.py      | 8 ++++++--
 grs/PivotChroot.py | 4 +++-
 grs/Populate.py    | 7 +++++--
 grs/RunScript.py   | 4 +++-
 grs/Seed.py        | 8 ++++++--
 grs/TarIt.py       | 7 ++++++-
 7 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index d24a542..20e820f 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -27,8 +27,12 @@ class ISOIt(HashIt):
     """ Create a bootable ISO of the system. """
 
     def __init__(
-            self, name, libdir=CONST.LIBDIR, tmpdir=CONST.TMPDIR,
-            portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE
+            self,
+            name,
+            libdir=CONST.LIBDIR,
+            tmpdir=CONST.TMPDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            logfile=CONST.LOGFILE
     ):
         self.libdir = libdir
         self.tmpdir = tmpdir

diff --git a/grs/Kernel.py b/grs/Kernel.py
index fe411bd..bd89ee2 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -28,8 +28,12 @@ class Kernel():
     """ Build a linux-image pkg and install when building a system. """
 
     def __init__(
-            self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
-            kernelroot=CONST.KERNELROOT, package=CONST.PACKAGE, logfile=CONST.LOGFILE
+            self,
+            libdir=CONST.LIBDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            kernelroot=CONST.KERNELROOT,
+            package=CONST.PACKAGE,
+            logfile=CONST.LOGFILE
     ):
         self.libdir = libdir
         self.portage_configroot = portage_configroot

diff --git a/grs/PivotChroot.py b/grs/PivotChroot.py
index 8958c99..46cb839 100644
--- a/grs/PivotChroot.py
+++ b/grs/PivotChroot.py
@@ -27,7 +27,9 @@ class PivotChroot(Rotator):
     """ Move an inner chroot out to the new system portage configroot.  """
 
     def __init__(
-            self, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            self,
+            tmpdir=CONST.TMPDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT,
             logfile=CONST.LOGFILE
     ):
         self.tmpdir = tmpdir

diff --git a/grs/Populate.py b/grs/Populate.py
index 8232c36..71c743a 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -27,8 +27,11 @@ class Populate():
     """
 
     def __init__(
-            self, libdir=CONST.LIBDIR, workdir=CONST.WORKDIR,
-            portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE
+            self,
+            libdir=CONST.LIBDIR,
+            workdir=CONST.WORKDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            logfile=CONST.LOGFILE
     ):
         self.libdir = libdir
         self.workdir = workdir

diff --git a/grs/RunScript.py b/grs/RunScript.py
index ff45aed..1ecc221 100644
--- a/grs/RunScript.py
+++ b/grs/RunScript.py
@@ -25,7 +25,9 @@ class RunScript():
     """ Run a script within the chroot. """
 
     def __init__(
-            self, libdir=CONST.LIBDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            self,
+            libdir=CONST.LIBDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT,
             logfile=CONST.LOGFILE
     ):
         self.libdir = libdir

diff --git a/grs/Seed.py b/grs/Seed.py
index f610228..ae8c524 100644
--- a/grs/Seed.py
+++ b/grs/Seed.py
@@ -29,8 +29,12 @@ class Seed(Rotator):
     """ Download a stage tarball and unpack it into an empty system portage configroot. """
 
     def __init__(
-            self, stage_uri, tmpdir=CONST.TMPDIR, portage_configroot=CONST.PORTAGE_CONFIGROOT,
-            package=CONST.PACKAGE, logfile=CONST.LOGFILE
+            self,
+            stage_uri,
+            tmpdir=CONST.TMPDIR,
+            portage_configroot=CONST.PORTAGE_CONFIGROOT,
+            package=CONST.PACKAGE,
+            logfile=CONST.LOGFILE
     ):
         self.stage_uri = stage_uri
         self.portage_configroot = portage_configroot

diff --git a/grs/TarIt.py b/grs/TarIt.py
index b3d3b32..aef1b42 100644
--- a/grs/TarIt.py
+++ b/grs/TarIt.py
@@ -25,7 +25,12 @@ from grs.HashIt import HashIt
 class TarIt(HashIt):
     """ Create a tarball of the system. """
 
-    def __init__(self, name, portage_configroot=CONST.PORTAGE_CONFIGROOT, logfile=CONST.LOGFILE):
+    def __init__(
+        self,
+        name,
+        portage_configroot=CONST.PORTAGE_CONFIGROOT,
+        logfile=CONST.LOGFILE
+    ):
         self.portage_configroot = portage_configroot
         self.logfile = logfile
         # Prepare a year, month and day for a tarball name timestamp.


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-01-28 12:31 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-01-28 12:31 UTC (permalink / raw
  To: gentoo-commits

commit:     face3fcd8f63c42a750223236da6c3ebc3d8cb17
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 28 12:31:04 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan 28 12:31:04 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=face3fcd

grs/Kernel.py: use scripts/busybox-config if provided

 grs/Kernel.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index bd89ee2..cbe470e 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -41,6 +41,7 @@ class Kernel():
         self.package = package
         self.logfile = logfile
         self.kernel_config = os.path.join(self.libdir, 'scripts/kernel-config')
+        self.busybox_config = os.path.join(self.libdir, 'scripts/busybox-config')
 
 
     def parse_kernel_config(self):
@@ -127,10 +128,13 @@ class Kernel():
         cmd += '--module-prefix=%s ' % image_dir
         cmd += '--modprobedir=%s '   % modprobe_dir
         cmd += '--arch-override=%s ' % arch
+        if os.path.isfile(self.busybox_config):
+            cmd += '--busybox-config=%s ' % self.busybox_config
         if has_modules:
             cmd += 'all'
         else:
             cmd += 'bzImage'
+
         Execute(cmd, timeout=None, logfile=self.logfile)
 
         # Strip the modules to shrink their size enormously!


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-06 10:55 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-06 10:55 UTC (permalink / raw
  To: gentoo-commits

commit:     ad2f9b41833ff60223030dc826106a99a5c52221
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  6 10:55:41 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb  6 10:55:41 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=ad2f9b41

grs/Synchronize.py: add git submodules support

 grs/Synchronize.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 3ce7d5c..199928b 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -30,6 +30,9 @@ class Synchronize():
         self.logfile = logfile
 
     def sync(self):
+        # If there is a .gitmodules, then update the submodules
+        git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
+
         if self.isgitdir():
             # If the local repo exists, then make it pristine an pull
             cmd = 'git -C %s reset HEAD --hard' % self.local_repo
@@ -38,14 +41,24 @@ class Synchronize():
             Execute(cmd, timeout=60, logfile=self.logfile)
             cmd = 'git -C %s pull' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
+            if os.path.isfile(git_modulesfile):
+                cmd = 'git -C %s submodule update' % self.local_repo
+                Execute(cmd, timeout=60, logfile=self.logfile)
         else:
             # else clone afresh.
             cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo)
             Execute(cmd, timeout=60, logfile=self.logfile)
+            if os.path.isfile(git_modulesfile):
+                cmd = 'git -C %s submodule init' % self.local_repo
+                Execute(cmd, timeout=60, logfile=self.logfile)
+                cmd = 'git -C %s submodule update' % self.local_repo
+                Execute(cmd, timeout=60, logfile=self.logfile)
+
         # Make sure we're on the correct branch for the desired GRS system.
         cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
         Execute(cmd, timeout=60, logfile=self.logfile)
 
+
     def isgitdir(self):
         """ If there is a .git/config file, assume its a local git repository. """
         git_configdir = os.path.join(self.local_repo, '.git')


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-06 11:33 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-06 11:33 UTC (permalink / raw
  To: gentoo-commits

commit:     fc61730175767bbfb2f8ad6658b353eb5a23772c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  6 11:33:29 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb  6 11:33:29 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=fc617301

grs/Synchronize.py: always re-init submodules

 grs/Synchronize.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 199928b..97174f5 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -30,9 +30,6 @@ class Synchronize():
         self.logfile = logfile
 
     def sync(self):
-        # If there is a .gitmodules, then update the submodules
-        git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
-
         if self.isgitdir():
             # If the local repo exists, then make it pristine an pull
             cmd = 'git -C %s reset HEAD --hard' % self.local_repo
@@ -48,11 +45,16 @@ class Synchronize():
             # else clone afresh.
             cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo)
             Execute(cmd, timeout=60, logfile=self.logfile)
-            if os.path.isfile(git_modulesfile):
-                cmd = 'git -C %s submodule init' % self.local_repo
-                Execute(cmd, timeout=60, logfile=self.logfile)
-                cmd = 'git -C %s submodule update' % self.local_repo
-                Execute(cmd, timeout=60, logfile=self.logfile)
+
+        # If there is a .gitmodules, then init/update the submodules
+        git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
+        if os.path.isfile(git_modulesfile):
+            # This may re-init submodules, but its harmless.  We need
+            # to keep trying for newly added modules.
+            cmd = 'git -C %s submodule init' % self.local_repo
+            Execute(cmd, timeout=60, logfile=self.logfile)
+            cmd = 'git -C %s submodule update' % self.local_repo
+            Execute(cmd, timeout=60, logfile=self.logfile)
 
         # Make sure we're on the correct branch for the desired GRS system.
         cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-06 11:42 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-06 11:42 UTC (permalink / raw
  To: gentoo-commits

commit:     732c2e65b8af57bcfaa99d5a4a741e6e2b616b14
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  6 11:33:29 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb  6 11:41:57 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=732c2e65

grs/Synchronize.py: always re-init submodules

 grs/Synchronize.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 199928b..8a55c84 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -30,9 +30,6 @@ class Synchronize():
         self.logfile = logfile
 
     def sync(self):
-        # If there is a .gitmodules, then update the submodules
-        git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
-
         if self.isgitdir():
             # If the local repo exists, then make it pristine an pull
             cmd = 'git -C %s reset HEAD --hard' % self.local_repo
@@ -41,18 +38,20 @@ class Synchronize():
             Execute(cmd, timeout=60, logfile=self.logfile)
             cmd = 'git -C %s pull' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
-            if os.path.isfile(git_modulesfile):
-                cmd = 'git -C %s submodule update' % self.local_repo
-                Execute(cmd, timeout=60, logfile=self.logfile)
         else:
             # else clone afresh.
             cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo)
             Execute(cmd, timeout=60, logfile=self.logfile)
-            if os.path.isfile(git_modulesfile):
-                cmd = 'git -C %s submodule init' % self.local_repo
-                Execute(cmd, timeout=60, logfile=self.logfile)
-                cmd = 'git -C %s submodule update' % self.local_repo
-                Execute(cmd, timeout=60, logfile=self.logfile)
+
+        # If there is a .gitmodules, then init/update the submodules
+        git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
+        if os.path.isfile(git_modulesfile):
+            # This may re-init submodules, but its harmless.  We need
+            # to keep trying for newly added modules.
+            cmd = 'git -C %s submodule init' % self.local_repo
+            Execute(cmd, timeout=60, logfile=self.logfile)
+            cmd = 'git -C %s submodule update' % self.local_repo
+            Execute(cmd, timeout=60, logfile=self.logfile)
 
         # Make sure we're on the correct branch for the desired GRS system.
         cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-06 11:57 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-06 11:57 UTC (permalink / raw
  To: gentoo-commits

commit:     d3100bd866cb5339b897378894f79bcd51ede89c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  6 11:57:31 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb  6 11:57:31 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=d3100bd8

grs/Synchronize.py: checkout the branch before updating the submodule

 grs/Synchronize.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 8a55c84..d2d4cb5 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -43,6 +43,10 @@ class Synchronize():
             cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo)
             Execute(cmd, timeout=60, logfile=self.logfile)
 
+        # Make sure we're on the correct branch for the desired GRS system.
+        cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
+        Execute(cmd, timeout=60, logfile=self.logfile)
+
         # If there is a .gitmodules, then init/update the submodules
         git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
         if os.path.isfile(git_modulesfile):
@@ -53,10 +57,6 @@ class Synchronize():
             cmd = 'git -C %s submodule update' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
 
-        # Make sure we're on the correct branch for the desired GRS system.
-        cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
-        Execute(cmd, timeout=60, logfile=self.logfile)
-
 
     def isgitdir(self):
         """ If there is a .git/config file, assume its a local git repository. """


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-18 16:37 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-18 16:37 UTC (permalink / raw
  To: gentoo-commits

commit:     a7fc9bfe8447be1804066f5c5da4209784960c7e
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 18 16:36:23 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Feb 18 16:36:23 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=a7fc9bfe

grs/Kernel.py: use scripts/genkernel.conf if provided

 grs/Kernel.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index cbe470e..2bc3e72 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -42,6 +42,7 @@ class Kernel():
         self.logfile = logfile
         self.kernel_config = os.path.join(self.libdir, 'scripts/kernel-config')
         self.busybox_config = os.path.join(self.libdir, 'scripts/busybox-config')
+        self.genkernel_config = os.path.join(self.libdir, 'scripts/genkernel.conf')
 
 
     def parse_kernel_config(self):
@@ -130,6 +131,8 @@ class Kernel():
         cmd += '--arch-override=%s ' % arch
         if os.path.isfile(self.busybox_config):
             cmd += '--busybox-config=%s ' % self.busybox_config
+        if os.path.isfile(self.genkernel_config):
+            cmd += '--config=%s ' % self.genkernel_config):
         if has_modules:
             cmd += 'all'
         else:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-18 22:38 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-18 22:38 UTC (permalink / raw
  To: gentoo-commits

commit:     b9dc8458eaba1a97380f6a59795afd267739f04c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 18 22:38:45 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Feb 18 22:38:45 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b9dc8458

grs/Kernel.py: fix typo

 grs/Kernel.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 2bc3e72..6b15a46 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -132,7 +132,7 @@ class Kernel():
         if os.path.isfile(self.busybox_config):
             cmd += '--busybox-config=%s ' % self.busybox_config
         if os.path.isfile(self.genkernel_config):
-            cmd += '--config=%s ' % self.genkernel_config):
+            cmd += '--config=%s ' % self.genkernel_config
         if has_modules:
             cmd += 'all'
         else:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-20  2:04 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-20  2:04 UTC (permalink / raw
  To: gentoo-commits

commit:     8e616d7126450fe4f3fb34e22fc5ce10492fbd99
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 20 02:04:47 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb 20 02:04:47 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=8e616d71

grs/Synchronize.py: update tracking the remote branch

 grs/Synchronize.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index d2d4cb5..be41bd6 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -54,7 +54,7 @@ class Synchronize():
             # to keep trying for newly added modules.
             cmd = 'git -C %s submodule init' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
-            cmd = 'git -C %s submodule update' % self.local_repo
+            cmd = 'git -C %s submodule update --remote' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
 
 


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-02-20  2:27 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-02-20  2:27 UTC (permalink / raw
  To: gentoo-commits

commit:     f9a259f9f4b69644eed30f46955b77aaf2aa97fc
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 20 02:27:14 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb 20 02:27:36 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=f9a259f9

grs/Synchronize.py: improve 'git submodule update' command

 grs/Synchronize.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index be41bd6..da38285 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -50,11 +50,8 @@ class Synchronize():
         # If there is a .gitmodules, then init/update the submodules
         git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
         if os.path.isfile(git_modulesfile):
-            # This may re-init submodules, but its harmless.  We need
-            # to keep trying for newly added modules.
-            cmd = 'git -C %s submodule init' % self.local_repo
-            Execute(cmd, timeout=60, logfile=self.logfile)
-            cmd = 'git -C %s submodule update --remote' % self.local_repo
+            # Recursively update any submodules following the remote branch
+            cmd = 'git -C %s submodule update --init --recursive --remote' % self.local_repo
             Execute(cmd, timeout=60, logfile=self.logfile)
 
 


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-04-10  3:14 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-04-10  3:14 UTC (permalink / raw
  To: gentoo-commits

commit:     d0d9a3b850b4f2c6ced830142e6314ce5d26d2cf
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 10 03:14:15 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Apr 10 03:14:15 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=d0d9a3b8

grs/Kernel.py: allow genkernel to install firmware

 grs/Kernel.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 6b15a46..7582e81 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -120,7 +120,6 @@ class Kernel():
         cmd += '--logfile=/dev/null '
         cmd += '--no-save-config '
         cmd += '--makeopts=-j9 '
-        cmd += '--no-firmware '
         cmd += '--symlink '
         cmd += '--no-mountboot '
         cmd += '--kernel-config=%s ' % self.kernel_config


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-04-14 14:53 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-04-14 14:53 UTC (permalink / raw
  To: gentoo-commits

commit:     4eea4b02f33038cbf8d0ea706dd212df964cac4a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 14 14:52:57 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Apr 14 14:52:57 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=4eea4b02

grs/Kernel.py: look for firmware-dir in portage_configroot

 grs/Kernel.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 7582e81..82e6d04 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -92,6 +92,10 @@ class Kernel():
         boot_dir = os.path.join(image_dir, 'boot')
         modprobe_dir = os.path.join(image_dir, 'etc/modprobe.d')
         modules_dir = os.path.join(image_dir, 'lib/modules')
+
+        # The firmware directory, if it exists, will be in self.portage_configroot
+        firmware_dir = os.path.join(self.portage_configroot, 'lib/firmware')
+
         # Prepare tarball filename and path.  If the tarball already exists,
         # don't rebuild/reinstall it.  Note: It should have been installed to
         # the system's portage configroot when it was first built, so no need
@@ -132,6 +136,8 @@ class Kernel():
             cmd += '--busybox-config=%s ' % self.busybox_config
         if os.path.isfile(self.genkernel_config):
             cmd += '--config=%s ' % self.genkernel_config
+        if  os.path.isdir(firmware_dir):
+            cmd += '--firmware-dir=%s ' % firmware_dir
         if has_modules:
             cmd += 'all'
         else:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-06-25 20:32 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-06-25 20:32 UTC (permalink / raw
  To: gentoo-commits

commit:     44dfdc8b645cb2d13fa0e966bfa7f7591119c980
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 25 20:32:19 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jun 25 20:32:19 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=44dfdc8b

grs/Constants.py: add CONFIGFILE for an alt to '/etc/grs/systems.conf'

 grs/Constants.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/grs/Constants.py b/grs/Constants.py
index ecbac40..bdaee25 100644
--- a/grs/Constants.py
+++ b/grs/Constants.py
@@ -57,6 +57,12 @@ class Constants():
     """
 
     def __init__(self, configfile='/etc/grs/systems.conf'):
+        # Grab an alternative config file from the env var CONFIGFILE
+        # TODO: I've designed myself into a bit of a corner here, and
+        # there is no easy way of adding a command line option to grsrun
+        # or grsup which propagates to this class.
+        if 'CONFIGFILE' in os.environ:
+            configfile = os.environ['CONFIGFILE']
         # If there's no config file, we're dead in the water.
         if not os.path.isfile(configfile):
             raise Exception('Configuration file %s not found\n' % configfile)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-11-11 23:16 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-11-11 23:16 UTC (permalink / raw
  To: gentoo-commits

commit:     be05b024339d7273767060b3679a91c434ee5455
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 11 23:15:35 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Nov 11 23:16:20 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=be05b024

grs/TarIt.py: control the entire alt-name for the tarball

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/TarIt.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/grs/TarIt.py b/grs/TarIt.py
index aef1b42..89e7465 100644
--- a/grs/TarIt.py
+++ b/grs/TarIt.py
@@ -34,17 +34,17 @@ class TarIt(HashIt):
         self.portage_configroot = portage_configroot
         self.logfile = logfile
         # Prepare a year, month and day for a tarball name timestamp.
-        self.year = str(datetime.now().year).zfill(4)
-        self.month = str(datetime.now().month).zfill(2)
-        self.day = str(datetime.now().day).zfill(2)
-        self.medium_name = '%s-%s%s%s.tar.xz' % (name, self.year, self.month, self.day)
+        year = str(datetime.now().year).zfill(4)
+        month = str(datetime.now().month).zfill(2)
+        day = str(datetime.now().day).zfill(2)
+        self.medium_name = '%s-%s%s%s.tar.xz' % (name, year, month, day)
         self.digest_name = '%s.DIGESTS' % self.medium_name
 
 
     def tarit(self, alt_name=None):
         # Create the tarball with the default name unless an alt_name is given.
         if alt_name:
-            self.medium_name = '%s-%s%s%s.tar.xz' % (alt_name, self.year, self.month, self.day)
+            self.medium_name = '%s.tar.xz' % alt_name)
             self.digest_name = '%s.DIGESTS' % self.medium_name
         # We have to cd into the system's portage configroot and then out again.
         cwd = os.getcwd()


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-11-11 23:35 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-11-11 23:35 UTC (permalink / raw
  To: gentoo-commits

commit:     85345d4e5f9ab61413299368e506edc247d78a6b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 11 23:35:31 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Nov 11 23:35:31 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=85345d4e

grs/Netboot.py: control the entire alt-name for the initramfs/kernel/ISO

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Netboot.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/grs/Netboot.py b/grs/Netboot.py
index 33c7b9d..59bd34b 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -41,20 +41,22 @@ class Netboot(HashIt):
         self.kernelroot = kernelroot
         self.logfile = logfile
         # Prepare a year, month and day for a name timestamp.
-        self.year = str(datetime.now().year).zfill(4)
-        self.month = str(datetime.now().month).zfill(2)
-        self.day = str(datetime.now().day).zfill(2)
-        self.medium_name = 'initramfs-%s-%s%s%s' % (name, self.year, self.month, self.day)
+        year = str(datetime.now().year).zfill(4)
+        month = str(datetime.now().month).zfill(2)
+        day = str(datetime.now().day).zfill(2)
+        self.medium_name = 'initramfs-%s-%s%s%s' % (name, year, month, day)
         self.digest_name = '%s.DIGESTS' % self.medium_name
-        self.kernelname = 'kernel-%s-%s%s%s' % (name, self.year, self.month, self.day)
-        self.cd_name = '%s-%s%s%s.iso' % (name, self.year, self.month, self.day)
+        self.kernelname = 'kernel-%s-%s%s%s' % (name, year, month, day)
+        self.cd_name = '%s-%s%s%s.iso' % (name, year, month, day)
 
 
     def netbootit(self, do_cd=None, alt_name=None):
         """ TODO """
         if alt_name:
-            self.medium_name = 'initramfs-%s-%s%s%s' % (alt_name, self.year, self.month, self.day)
+            self.medium_name = 'initramfs-%s' % alt_name
             self.digest_name = '%s.DIGESTS' % self.medium_name
+            self.kernelname = 'kernel-%s' % alt_name
+            self.cd_name = '%s.iso' % alt_name
 
         # 1. Copy the kernel to the tmpdir directory.
         kernel_src = os.path.join(self.portage_configroot, 'boot/kernel')


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-11-11 23:57 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-11-11 23:57 UTC (permalink / raw
  To: gentoo-commits

commit:     604406fecf6be1d674e123f630957f15b1ed1dec
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 11 23:57:34 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Nov 11 23:57:41 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=604406fe

grs/TarIt.py: fix typo

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/TarIt.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/TarIt.py b/grs/TarIt.py
index 89e7465..00f0b6a 100644
--- a/grs/TarIt.py
+++ b/grs/TarIt.py
@@ -44,7 +44,7 @@ class TarIt(HashIt):
     def tarit(self, alt_name=None):
         # Create the tarball with the default name unless an alt_name is given.
         if alt_name:
-            self.medium_name = '%s.tar.xz' % alt_name)
+            self.medium_name = '%s.tar.xz' % alt_name
             self.digest_name = '%s.DIGESTS' % self.medium_name
         # We have to cd into the system's portage configroot and then out again.
         cwd = os.getcwd()


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-11-12  3:08 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-11-12  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     58b059a17bf4be4b97d72b8e242f0365949deaa6
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 12 03:08:36 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Nov 12 03:08:36 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=58b059a1

grs/Interpret.py: fix typo

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 74d04e3..422357d 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -247,7 +247,7 @@ class Interpret(Daemon):
                 elif verb == 'netbootit':
                     # 'netbootit' can either be just a 'verb', 'verb obj' or 'verb obj obj'
                     if len(objs) == 2:
-                        semantic_action(_line, objs, 2, _nb.netbootit, objs[0], obj[1])
+                        semantic_action(_line, objs, 2, _nb.netbootit, objs[0], objs[1])
                     elif len(objs) == 1:
                         semantic_action(_line, objs, 1, _nb.netbootit, objs[0])
                     else:


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2018-11-18 19:09 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2018-11-18 19:09 UTC (permalink / raw
  To: gentoo-commits

commit:     4081b20f9f1c6837ae06704422215eb51910491b
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 18 19:08:59 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Nov 18 19:08:59 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=4081b20f

grs/MountDirectories.py: location of /usr/portage is configurable

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Constants.py        | 2 ++
 grs/Interpret.py        | 3 ++-
 grs/MountDirectories.py | 5 +++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/grs/Constants.py b/grs/Constants.py
index bdaee25..3c4b3bc 100644
--- a/grs/Constants.py
+++ b/grs/Constants.py
@@ -87,6 +87,7 @@ class Constants():
             'tmpdir'              : '/var/tmp/grs/%s',
             'workdir'             : '/var/tmp/grs/%s/work',
             'package'             : '/var/tmp/grs/%s/packages',
+            'portage'             : '/usr/portage',
             'kernelroot'          : '/var/tmp/grs/%s/kernel',
             'portage_configroot'  : '/var/tmp/grs/%s/system',
             'pidfile'             : '/run/grs-%s.pid'
@@ -161,6 +162,7 @@ CONST.LOGFILE = '/var/log/grs.log'
 CONST.TMPDIR = '/var/tmp/grs'
 CONST.WORKDIR = '/var/tmp/grs/work'
 CONST.PACKAGE = '/var/tmp/grs/package'
+CONST.PORTAGE = '/usr/portage'
 CONST.KERNELROOT = '/var/tmp/grs/kernel'
 CONST.PORTAGE_CONFIGROOT = '/var/tmp/grs/system'
 CONST.PIDFILE = '/run/grs.pid'

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 422357d..a06807f 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -119,6 +119,7 @@ class Interpret(Daemon):
         tmpdir = CONST.tmpdirs[self.run_number]
         workdir = CONST.workdirs[self.run_number]
         package = CONST.packages[self.run_number]
+        portage = CONST.portages[self.run_number]
         kernelroot = CONST.kernelroots[self.run_number]
         portage_configroot = CONST.portage_configroots[self.run_number]
 
@@ -128,7 +129,7 @@ class Interpret(Daemon):
         _lo = Log(logfile)
         _sy = Synchronize(repo_uri, name, libdir, logfile)
         _se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile)
-        _md = MountDirectories(portage_configroot, package, logfile)
+        _md = MountDirectories(portage_configroot, package, portage, logfile)
         _po = Populate(libdir, workdir, portage_configroot, logfile)
         _ru = RunScript(libdir, portage_configroot, logfile)
         _pc = PivotChroot(tmpdir, portage_configroot, logfile)

diff --git a/grs/MountDirectories.py b/grs/MountDirectories.py
index 692c320..a1a42af 100644
--- a/grs/MountDirectories.py
+++ b/grs/MountDirectories.py
@@ -27,7 +27,7 @@ class MountDirectories():
     """
 
     def __init__(self, portage_configroot=CONST.PORTAGE_CONFIGROOT, \
-            package=CONST.PACKAGE, logfile=CONST.LOGFILE):
+            package=CONST.PACKAGE, portage=CONST.PORTAGE, logfile=CONST.LOGFILE):
         # The order is respected.  Note that 'dev' needs to be mounted beore 'dev/pts'.
         self.directories = [
             'dev',
@@ -35,12 +35,13 @@ class MountDirectories():
             {'dev/shm' : ('tmpfs', 'shm')},
             'proc',
             'sys',
-            'usr/portage',
+            [portage, 'usr/portage'],
             [package, 'usr/portage/packages']
         ]
         # Once initiated, we only work with one portage_configroot
         self.portage_configroot = portage_configroot
         self.package = package
+        self.portage = portage
         self.logfile = logfile
         # We need to umount in the reverse order
         self.rev_directories = deepcopy(self.directories)


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2019-04-19 12:29 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2019-04-19 12:29 UTC (permalink / raw
  To: gentoo-commits

commit:     9d61dc4ca6b4a8f68806d336c5b6eb888332582e
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 19 12:29:40 2019 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Apr 19 12:29:45 2019 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=9d61dc4c

grs/Kernel.py: correctly parse vanilla-sources

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Kernel.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 82e6d04..3abea6a 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -67,10 +67,15 @@ class Kernel():
             pkg_name = flavor + '-sources-' + vanilla_version + '-' + revision
         except AttributeError:
             # Or the verison is of the form '4.0.6-hardened' with one -
-            _match = re.search(r'(\S+?)-(\S+)', gentoo_version)
-            vanilla_version = _match.group(1)
-            flavor = _match.group(2)
-            pkg_name = flavor + '-sources-' + vanilla_version
+            try:
+                _match = re.search(r'(\S+?)-(\S+)', gentoo_version)
+                vanilla_version = _match.group(1)
+                flavor = _match.group(2)
+                pkg_name = flavor + '-sources-' + vanilla_version
+            except AttributeError:
+                # Finally the verison is of the form '4.0.6' with no -
+                vanilla_version = gentoo_version
+                pkg_name = 'vanilla-sources-' + vanilla_version
         pkg_name = '=sys-kernel/' + pkg_name
         return (gentoo_version, pkg_name, has_modules)
 


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2022-07-18 21:13 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2022-07-18 21:13 UTC (permalink / raw
  To: gentoo-commits

commit:     254ab00f5f6552165a5ca0cd485cdc13e555ba8a
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 18 21:13:30 2022 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jul 18 21:13:30 2022 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=254ab00f

grs/MountDirectories.py: mount /run as tmpfs

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/MountDirectories.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/grs/MountDirectories.py b/grs/MountDirectories.py
index 1ada579..36949d0 100644
--- a/grs/MountDirectories.py
+++ b/grs/MountDirectories.py
@@ -35,6 +35,7 @@ class MountDirectories():
             {'dev/shm' : ('tmpfs', 'shm')},
             'proc',
             'sys',
+            {'run' : ('tmpfs', 'none')},
             [portage, 'var/db/repos/gentoo'],
             [package, 'var/cache/binpkgs']
         ]


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2022-07-19 20:18 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2022-07-19 20:18 UTC (permalink / raw
  To: gentoo-commits

commit:     e8635e7e6c77150eadeefe09301b550bc410a383
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 19 20:18:37 2022 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 19 20:18:37 2022 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=e8635e7e

grs/Kernel.py: use new name --kernel-modules-prefix

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Kernel.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 3abea6a..1f9ba31 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -131,12 +131,12 @@ class Kernel():
         cmd += '--makeopts=-j9 '
         cmd += '--symlink '
         cmd += '--no-mountboot '
-        cmd += '--kernel-config=%s ' % self.kernel_config
-        cmd += '--kerneldir=%s '     % kernel_source
-        cmd += '--bootdir=%s '       % boot_dir
-        cmd += '--module-prefix=%s ' % image_dir
-        cmd += '--modprobedir=%s '   % modprobe_dir
-        cmd += '--arch-override=%s ' % arch
+        cmd += '--kernel-config=%s '         % self.kernel_config
+        cmd += '--kerneldir=%s '             % kernel_source
+        cmd += '--bootdir=%s '               % boot_dir
+        cmd += '--kernel-modules-prefix=%s ' % image_dir
+        cmd += '--modprobedir=%s '           % modprobe_dir
+        cmd += '--arch-override=%s '         % arch
         if os.path.isfile(self.busybox_config):
             cmd += '--busybox-config=%s ' % self.busybox_config
         if os.path.isfile(self.genkernel_config):


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2022-07-19 20:22 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2022-07-19 20:22 UTC (permalink / raw
  To: gentoo-commits

commit:     3b90324241c0224d10c7bedb725be4c30521192c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 19 20:22:53 2022 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 19 20:22:53 2022 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=3b903242

grs/Kernel.py: remove deprecated option -arch-override

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Kernel.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/grs/Kernel.py b/grs/Kernel.py
index 1f9ba31..8fcf35c 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -136,7 +136,6 @@ class Kernel():
         cmd += '--bootdir=%s '               % boot_dir
         cmd += '--kernel-modules-prefix=%s ' % image_dir
         cmd += '--modprobedir=%s '           % modprobe_dir
-        cmd += '--arch-override=%s '         % arch
         if os.path.isfile(self.busybox_config):
             cmd += '--busybox-config=%s ' % self.busybox_config
         if os.path.isfile(self.genkernel_config):


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

* [gentoo-commits] proj/grss:master commit in: grs/
@ 2022-07-20  1:49 Anthony G. Basile
  0 siblings, 0 replies; 139+ messages in thread
From: Anthony G. Basile @ 2022-07-20  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     a5b44d6b3130b0f676c2408a5d483c9c70da4919
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 20 01:49:11 2022 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 01:49:11 2022 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=a5b44d6b

grs/MountDirectories.py: bind mount /var/cache/distfiles

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Constants.py        | 2 ++
 grs/Interpret.py        | 3 ++-
 grs/MountDirectories.py | 8 +++++---
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/grs/Constants.py b/grs/Constants.py
index f9a640e..8d8df14 100644
--- a/grs/Constants.py
+++ b/grs/Constants.py
@@ -88,6 +88,7 @@ class Constants():
             'workdir'             : '/var/tmp/grs/%s/work',
             'package'             : '/var/tmp/grs/%s/packages',
             'portage'             : '/var/db/repos/gentoo',
+            'distfiles'           : '/var/cache/distfiles',
             'kernelroot'          : '/var/tmp/grs/%s/kernel',
             'portage_configroot'  : '/var/tmp/grs/%s/system',
             'pidfile'             : '/run/grs-%s.pid'
@@ -163,6 +164,7 @@ CONST.TMPDIR = '/var/tmp/grs'
 CONST.WORKDIR = '/var/tmp/grs/work'
 CONST.PACKAGE = '/var/tmp/grs/package'
 CONST.PORTAGE = '/var/db/repos/gentoo'
+CONST.DISTFILES = '/var/cache/distfiles'
 CONST.KERNELROOT = '/var/tmp/grs/kernel'
 CONST.PORTAGE_CONFIGROOT = '/var/tmp/grs/system'
 CONST.PIDFILE = '/run/grs.pid'

diff --git a/grs/Interpret.py b/grs/Interpret.py
index a06807f..db9be7d 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -120,6 +120,7 @@ class Interpret(Daemon):
         workdir = CONST.workdirs[self.run_number]
         package = CONST.packages[self.run_number]
         portage = CONST.portages[self.run_number]
+        distfiles = CONST.distfiles[self.run_number]
         kernelroot = CONST.kernelroots[self.run_number]
         portage_configroot = CONST.portage_configroots[self.run_number]
 
@@ -129,7 +130,7 @@ class Interpret(Daemon):
         _lo = Log(logfile)
         _sy = Synchronize(repo_uri, name, libdir, logfile)
         _se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile)
-        _md = MountDirectories(portage_configroot, package, portage, logfile)
+        _md = MountDirectories(portage_configroot, package, portage, distfiles, logfile)
         _po = Populate(libdir, workdir, portage_configroot, logfile)
         _ru = RunScript(libdir, portage_configroot, logfile)
         _pc = PivotChroot(tmpdir, portage_configroot, logfile)

diff --git a/grs/MountDirectories.py b/grs/MountDirectories.py
index 36949d0..24d2f66 100644
--- a/grs/MountDirectories.py
+++ b/grs/MountDirectories.py
@@ -27,7 +27,7 @@ class MountDirectories():
     """
 
     def __init__(self, portage_configroot=CONST.PORTAGE_CONFIGROOT, \
-            package=CONST.PACKAGE, portage=CONST.PORTAGE, logfile=CONST.LOGFILE):
+            package=CONST.PACKAGE, portage=CONST.PORTAGE, distfiles=CONST.DISTFILES, logfile=CONST.LOGFILE):
         # The order is respected.  Note that 'dev' needs to be mounted beore 'dev/pts'.
         self.directories = [
             'dev',
@@ -37,12 +37,14 @@ class MountDirectories():
             'sys',
             {'run' : ('tmpfs', 'none')},
             [portage, 'var/db/repos/gentoo'],
-            [package, 'var/cache/binpkgs']
+            [package, 'var/cache/binpkgs'],
+            [distfiles, 'var/cache/distfiles']
         ]
         # Once initiated, we only work with one portage_configroot
         self.portage_configroot = portage_configroot
-        self.package = package
         self.portage = portage
+        self.package = package
+        self.distfiles = distfiles
         self.logfile = logfile
         # We need to umount in the reverse order
         self.rev_directories = deepcopy(self.directories)


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

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

commit:     099b2e7ac4bbf546103e263a3a5ff165a556a4c5
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 20 02:22:36 2022 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 02:22:36 2022 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=099b2e7a

grs/Interpret.py: fix typo

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 grs/Interpret.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index db9be7d..48990fb 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -120,7 +120,7 @@ class Interpret(Daemon):
         workdir = CONST.workdirs[self.run_number]
         package = CONST.packages[self.run_number]
         portage = CONST.portages[self.run_number]
-        distfiles = CONST.distfiles[self.run_number]
+        distfiles = CONST.distfiless[self.run_number]
         kernelroot = CONST.kernelroots[self.run_number]
         portage_configroot = CONST.portage_configroots[self.run_number]
 


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

end of thread, other threads:[~2022-07-20  2:22 UTC | newest]

Thread overview: 139+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-10 19:07 [gentoo-commits] proj/grss:master commit in: grs/ Anthony G. Basile
  -- strict thread matches above, loose matches on Subject: below --
2022-07-20  2:22 Anthony G. Basile
2022-07-20  1:49 Anthony G. Basile
2022-07-19 20:22 Anthony G. Basile
2022-07-19 20:18 Anthony G. Basile
2022-07-18 21:13 Anthony G. Basile
2019-04-19 12:29 Anthony G. Basile
2018-11-18 19:09 Anthony G. Basile
2018-11-12  3:08 Anthony G. Basile
2018-11-11 23:57 Anthony G. Basile
2018-11-11 23:35 Anthony G. Basile
2018-11-11 23:16 Anthony G. Basile
2018-06-25 20:32 Anthony G. Basile
2018-04-14 14:53 Anthony G. Basile
2018-04-10  3:14 Anthony G. Basile
2018-02-20  2:27 Anthony G. Basile
2018-02-20  2:04 Anthony G. Basile
2018-02-18 22:38 Anthony G. Basile
2018-02-18 16:37 Anthony G. Basile
2018-02-06 11:57 Anthony G. Basile
2018-02-06 11:42 Anthony G. Basile
2018-02-06 11:33 Anthony G. Basile
2018-02-06 10:55 Anthony G. Basile
2018-01-28 12:31 Anthony G. Basile
2018-01-28 12:09 Anthony G. Basile
2018-01-15  1:31 Anthony G. Basile
2018-01-15  1:23 Anthony G. Basile
2018-01-14 18:22 Anthony G. Basile
2018-01-14 17:05 Anthony G. Basile
2018-01-14 15:02 Anthony G. Basile
2018-01-14 14:37 Anthony G. Basile
2018-01-14 14:07 Anthony G. Basile
2018-01-13 17:40 Anthony G. Basile
2018-01-10 21:02 Anthony G. Basile
2018-01-10 20:40 Anthony G. Basile
2017-12-28 17:54 Anthony G. Basile
2017-12-28 17:22 Anthony G. Basile
2017-12-27  9:25 Anthony G. Basile
2017-12-26 14:19 Anthony G. Basile
2017-12-26  0:04 Anthony G. Basile
2017-12-26  0:04 Anthony G. Basile
2017-12-26  0:04 Anthony G. Basile
2017-12-25 23:38 Anthony G. Basile
2017-12-25 23:24 Anthony G. Basile
2017-12-23 16:04 Anthony G. Basile
2017-12-23 14:15 Anthony G. Basile
2016-03-23 15:08 Anthony G. Basile
2016-03-23 15:05 Anthony G. Basile
2015-11-26 19:48 Anthony G. Basile
2015-10-10 20:20 Anthony G. Basile
2015-10-10 19:36 Anthony G. Basile
2015-10-10 12:22 Anthony G. Basile
2015-10-10 11:44 Anthony G. Basile
2015-10-10 11:22 Anthony G. Basile
2015-10-10 11:20 Anthony G. Basile
2015-10-10 11:10 Anthony G. Basile
2015-10-10  1:46 Anthony G. Basile
2015-10-10  1:40 Anthony G. Basile
2015-10-10  1:34 Anthony G. Basile
2015-10-10  1:26 Anthony G. Basile
2015-10-10  1:23 Anthony G. Basile
2015-10-10  1:18 Anthony G. Basile
2015-10-10  0:34 Anthony G. Basile
2015-10-10  0:29 Anthony G. Basile
2015-10-09 23:33 Anthony G. Basile
2015-10-09 23:33 Anthony G. Basile
2015-10-09 23:30 Anthony G. Basile
2015-10-09 23:11 Anthony G. Basile
2015-10-09 23:06 Anthony G. Basile
2015-10-08 23:52 Anthony G. Basile
2015-10-08 18:03 Anthony G. Basile
2015-10-08 17:20 Anthony G. Basile
2015-10-07 11:28 Anthony G. Basile
2015-10-07 11:15 Anthony G. Basile
2015-10-07 11:07 Anthony G. Basile
2015-10-07 11:03 Anthony G. Basile
2015-10-07 10:57 Anthony G. Basile
2015-10-07  8:31 Anthony G. Basile
2015-10-07  8:01 Anthony G. Basile
2015-10-06 10:07 Anthony G. Basile
2015-09-16 22:08 Anthony G. Basile
2015-09-16  5:16 Anthony G. Basile
2015-09-16  0:37 Anthony G. Basile
2015-09-16  0:32 Anthony G. Basile
2015-09-14  7:17 Anthony G. Basile
2015-09-14  5:32 Anthony G. Basile
2015-09-14  5:25 Anthony G. Basile
2015-09-14  0:29 Anthony G. Basile
2015-09-13 17:31 Anthony G. Basile
2015-09-12 20:56 Anthony G. Basile
2015-09-12 20:56 Anthony G. Basile
2015-08-09 20:26 Anthony G. Basile
2015-08-08 20:06 Anthony G. Basile
2015-08-08 18:01 Anthony G. Basile
2015-08-08 17:51 Anthony G. Basile
2015-07-29  0:20 Anthony G. Basile
2015-07-28 22:44 Anthony G. Basile
2015-07-27 20:49 Anthony G. Basile
2015-07-25 22:36 Anthony G. Basile
2015-07-14 23:37 Anthony G. Basile
2015-07-14 23:29 Anthony G. Basile
2015-07-14 23:19 Anthony G. Basile
2015-07-14 23:16 Anthony G. Basile
2015-07-14 23:02 Anthony G. Basile
2015-07-14 22:39 Anthony G. Basile
2015-07-14 22:35 Anthony G. Basile
2015-07-14 21:45 Anthony G. Basile
2015-07-14 21:21 Anthony G. Basile
2015-07-14 21:02 Anthony G. Basile
2015-07-14 20:55 Anthony G. Basile
2015-07-10 12:54 Anthony G. Basile
2015-07-10  2:37 Anthony G. Basile
2015-07-10  2:37 Anthony G. Basile
2015-07-10  2:01 Anthony G. Basile
2015-07-09 15:26 Anthony G. Basile
2015-07-09  1:44 Anthony G. Basile
2015-07-08 15:44 Anthony G. Basile
2015-07-08 10:28 Anthony G. Basile
2015-07-07 20:52 Anthony G. Basile
2015-07-07 20:34 Anthony G. Basile
2015-07-07 14:30 Anthony G. Basile
2015-07-07 12:54 Anthony G. Basile
2015-07-07 12:46 Anthony G. Basile
2015-07-07 12:44 Anthony G. Basile
2015-07-07 12:33 Anthony G. Basile
2015-07-07 11:26 Anthony G. Basile
2015-07-07  2:17 Anthony G. Basile
2015-07-06 20:13 Anthony G. Basile
2015-07-06 18:13 Anthony G. Basile
2015-07-05 16:49 Anthony G. Basile
2015-07-05 12:04 Anthony G. Basile
2015-07-02 22:30 Anthony G. Basile
2015-07-01 17:27 Anthony G. Basile
2015-07-01 17:03 Anthony G. Basile
2015-07-01 16:53 Anthony G. Basile
2015-07-01 16:52 Anthony G. Basile
2015-07-01 16:07 Anthony G. Basile
2015-07-01 12:30 Anthony G. Basile
2015-07-01 12:23 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