[csw-devel] SF.net SVN: gar:[17689] csw/mgar/gar/v2/lib/python/safe_remove_package.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Apr 15 10:31:44 CEST 2012
Revision: 17689
http://gar.svn.sourceforge.net/gar/?rev=17689&view=rev
Author: wahwah
Date: 2012-04-15 08:31:44 +0000 (Sun, 15 Apr 2012)
Log Message:
-----------
safe-remove-package: Enable the dangerous mode
Add the --execute flag which allows to run and actually remove packages from
the catalog.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/safe_remove_package.py
Modified: csw/mgar/gar/v2/lib/python/safe_remove_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/safe_remove_package.py 2012-04-15 08:31:21 UTC (rev 17688)
+++ csw/mgar/gar/v2/lib/python/safe_remove_package.py 2012-04-15 08:31:44 UTC (rev 17689)
@@ -18,6 +18,7 @@
import sys
import os
import cjson
+import subprocess
class RevDeps(object):
@@ -68,7 +69,7 @@
class PackageRemover(object):
- def RemovePackage(self, catalogname):
+ def RemovePackage(self, catalogname, execute=False):
# Get md5 sums
rest_client = rest.RestClient()
rd = RevDeps()
@@ -95,9 +96,11 @@
pprint.pprint(rev_deps)
else:
for osrel in to_remove:
- print (
- "csw-upload-pkg --remove --os-release %s %s"
- % (osrel, " ".join(to_remove[osrel])))
+ args = ["csw-upload-pkg", "--remove", "--os-release",
+ osrel] + to_remove[osrel]
+ print " ".join(args)
+ if execute:
+ subprocess.call(args)
@@ -105,11 +108,12 @@
parser = optparse.OptionParser()
parser.add_option("-c", "--catalogname", dest="catalogname")
parser.add_option("--debug", dest="debug", action="store_true")
+ parser.add_option("--execute", dest="execute", action="store_true")
options, args = parser.parse_args()
if options.debug:
logging.basicConfig(level=logging.DEBUG)
pr = PackageRemover()
- pr.RemovePackage(options.catalogname)
+ pr.RemovePackage(options.catalogname, options.execute)
if __name__ == '__main__':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list