| |
@@ -0,0 +1,37 @@
|
| |
+ #!/usr/bin/env python
|
| |
+ # -*- coding: utf-8 -*-
|
| |
+
|
| |
+ from __future__ import print_function
|
| |
+
|
| |
+ import argparse
|
| |
+ import datetime
|
| |
+ import json
|
| |
+ import os
|
| |
+ import sys
|
| |
+ import time
|
| |
+
|
| |
+ if __name__ == '__main__':
|
| |
+ parser = argparse.ArgumentParser()
|
| |
+ parser.add_argument('cmd')
|
| |
+ opts = parser.parse_args()
|
| |
+
|
| |
+ if opts.cmd != 'ostree':
|
| |
+ # Not an announcement of new ostree commit, nothing to do.
|
| |
+ sys.exit()
|
| |
+
|
| |
+ try:
|
| |
+ data = json.load(sys.stdin)
|
| |
+ except ValueError:
|
| |
+ print('Failed to decode data', file=sys.stderr)
|
| |
+ sys.exit(1)
|
| |
+
|
| |
+ repo = data['local_repo_path']
|
| |
+ commit = data['commitid']
|
| |
+ path = '%s/objects/%s/%s.commitmeta' % (repo, commit[:2], commit[2:])
|
| |
+
|
| |
+ while not os.path.exists(path):
|
| |
+ print('%s: Commit not signed yet, waiting...'
|
| |
+ % datetime.datetime.utcnow())
|
| |
+ time.sleep(5)
|
| |
+
|
| |
+ print('Found signature.')
|
| |
First commit in this PR updates the format of message sent on new commit creation to include path to the ostree repo itself. The message announcing new ostree commit so far contained hash of the commit, the ref it's for, but there was no information about where the repo actually is. This patch adds
repo_path
key into the message with URL of the repo andlocal_repo_path
with path to the repo on local filesystem.The second commit adds a notification handler script to wait for signature. This script can be used with the
--notification-script
argument ofpungi-koji
. For most messages it does nothing, but when it sees a new commit in an ostree repo, it will wait for a signature of the new commit to appear.Fixes: #650