summaryrefslogtreecommitdiffstats
path: root/src/pyfedpkg/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pyfedpkg/__init__.py')
-rw-r--r--src/pyfedpkg/__init__.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index f531c07..5da7ede 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -953,6 +953,18 @@ class PackageModule:
if self.branch.startswith('el5') or self.branch.startswith('el4'):
self.hashtype = 'md5'
+ def _delete(self):
+ """Delete all files in the directory with exception of ./.git'
+ """
+ for root, dirs, files in os.walk(self.path, topdown=False):
+ for name in files:
+ if not '/.git' in root:
+ os.remove(os.path.join(root, name))
+ for name in dirs:
+ if not (name == '.git' or '/.git' in root):
+ os.rmdir(os.path.join(root, name))
+ return
+
def tag(self, force=False, clog=False, message=None, file=None,
list=None, delete=None):
"""Managment of git tags
@@ -1175,6 +1187,31 @@ class PackageModule:
_run_command(cmd, cwd=self.path)
return
+ def retire(self, message=None):
+ """Retire a Fedora package
+ """
+
+ try:
+ self._delete()
+ except OSError, e:
+ raise FedpkgError ('Working tree could not deleted: %s ' % e)
+
+ if message:
+ msg = message
+ else:
+ msg = 'Package %s was retired' % self.module
+
+ fd = open(os.path.join(self.path, 'dead.package'), 'w')
+ fd.write(msg)
+ fd.close()
+
+ cmd = ['git', 'add', os.path.join(self.path, 'dead.package')]
+ _run_command(cmd, cwd=self.path)
+
+ self.commit (msg)
+
+ return
+
def compile(self, arch=None, short=False):
"""Run rpm -bc on a module