Commits

zhangchunlin committed 0de5d1c

if keep not remove

  • Participants
  • Parent commits 2af5467

Comments (0)

Files changed (1)

File apps/autobuild/commands.py

     app = make_application(start=False, debug_console=False, debug=False)
     return app
 
+from views import get_build_info
 class AbCleanOldCommand(Command):
     name = 'abcleanold'
     help = 'Autobuild Clean Old builds'
                             int(hour),
                             int(minute))
                         tonow = datetime.datetime.now()-dt
+                        fpinfo = os.path.join(path,".info")
+                        info = get_build_info(fpinfo)
+                        if info!=None and info.has_key("keep") and info['keep']==True:
+                            keep = True
+                        else:
+                            keep = False
                         if tonow>keeplimit:
                             print tonow,name
-                            if not dryrun:
-                                print "remove %s"%(name)
-                                shutil.rmtree(path)
+                            if keep:
+                                print "+keep %s"%(name)
+                            else:
+                                if not dryrun:
+                                    print "-remove %s"%(name)
+                                    shutil.rmtree(path)