[Extras-cauldron-commits] r132 - trunk/buildme/tools

ed_ at garage.maemo.org ed_ at garage.maemo.org
Mon Jun 15 22:32:43 EEST 2009


Author: ed_
Date: 2009-06-15 22:32:39 +0300 (Mon, 15 Jun 2009)
New Revision: 132

Added:
   trunk/buildme/tools/oldbuilds.py
Log:
added script oldbuilds.py

Added: trunk/buildme/tools/oldbuilds.py
===================================================================
--- trunk/buildme/tools/oldbuilds.py	                        (rev 0)
+++ trunk/buildme/tools/oldbuilds.py	2009-06-15 19:32:39 UTC (rev 132)
@@ -0,0 +1,49 @@
+#!/usr/bin/python -tt
+# vim: sw=4 ts=4 expandtab ai
+#
+# oldbuilds - copy old Maemo Extras builds into subdirectories
+#
+# Copyright (C) 2008 Ed Bartosh <bartosh at gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License version 2 as published by the
+# Free Software Foundation.
+#
+# 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+import sys
+import os
+import time
+import shutil
+
+def main(argv):
+    topdir = "/var/www/extras-devel/builder/%s/" % argv[1]
+    backupdir = "old"
+    for entry in os.listdir(topdir):
+        if entry != backupdir and not entry.startswith('.'):
+            src = os.path.join(topdir, entry)
+            ctstamp = time.strftime("%Y%m", time.localtime())
+            tstamp = time.strftime("%Y%m", time.localtime(os.stat(src).st_mtime))
+            if tstamp != ctstamp:
+                dstdir = os.path.join(topdir, backupdir, tstamp)
+                if not os.path.exists(dstdir):
+                    os.makedirs(dstdir)
+                dst = os.path.join(dstdir, entry)
+                #print src, dst
+                shutil.move(src, dst)
+
+if __name__ == '__main__':
+    if len(sys.argv) != 2:
+        print "Usage: %s <product>" % os.path.basename(sys.argv[0])
+        sys.exit(1)
+    sys.exit(main(sys.argv))
+


Property changes on: trunk/buildme/tools/oldbuilds.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the Extras-cauldron-commits mailing list