Skip to content

Commit

Permalink
Implement pre/post-createmd hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jrha committed Jul 19, 2024
1 parent 8cb56c1 commit ab89281
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def __init__(self):
self.hooks['post-update'] = self.getoption('main', 'hook-post-update', None)
self.hooks['pre-generate'] = self.getoption('main', 'hook-pre-generate', None)
self.hooks['post-generate'] = self.getoption('main', 'hook-post-generate', None)
self.hooks['pre-createmd'] = self.getoption('main', 'hook-pre-createmd', None)
self.hooks['post-createmd'] = self.getoption('main', 'hook-post-createmd', None)
self.hooks['pre-new-repo'] = self.getoption('main', 'hook-pre-new-repo', None)
self.hooks['lock'] = self.getoption('main', 'hook-lock', None)
self.hooks['unlock'] = self.getoption('main', 'hook-unlock', None)
Expand Down Expand Up @@ -373,7 +375,7 @@ def _call_hook(self, hook_name):
run(' '.join([
CONFIG.hooks[hook_name],
hook_name,
self.name,
self.nick,
self.srcdir,
self.dir,
]))
Expand Down Expand Up @@ -655,6 +657,8 @@ def createmd(self):
if not self.changed and not OPTIONS.force:
return

self._call_hook('pre-createmd')

try:
### Generate repository metadata
for metadata in self.dist.metadata:
Expand All @@ -665,6 +669,8 @@ def createmd(self):
error(0, 'Generating repo failed for %s with message:\n %s' % (self.name, instance.value))
EXITCODE = 2

self._call_hook('post-createmd')

def repomd(self):
"Create a repomd repository"
if not CONFIG.cmd['createrepo']:
Expand Down

0 comments on commit ab89281

Please sign in to comment.