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)

Reply via email to