Skip to content

Commit

Permalink
Also capture ANNOUNCE from cygport into package metadata
Browse files Browse the repository at this point in the history
TODO: Interaction with ';' delimiter used in the message format used by
AppVeyor backend may need attention. Maybe we can use a null as a
delimiter instead, or perhaps AppVeyor should generate JSON as well?
  • Loading branch information
jon-turney committed Aug 18, 2023
1 parent 2123ff0 commit 9975e05
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


class PackageKind:
def __init__(self, kind=None, script='', depends=None, arches=None, tokens=None):
def __init__(self, kind=None, script='', depends=None, arches=None, tokens=None, announce=''):
if depends is None:
depends = set()
if arches is None:
Expand All @@ -42,6 +42,7 @@ def __init__(self, kind=None, script='', depends=None, arches=None, tokens=None)
self.depends = depends
self.arches = arches
self.tokens = tokens
self.announce = announce


var_list = [
Expand All @@ -52,6 +53,7 @@ def __init__(self, kind=None, script='', depends=None, arches=None, tokens=None)
'INHERITED',
'RESTRICT',
'SCALLYWAG',
'ANNOUNCE',
]
var_values = {}

Expand Down Expand Up @@ -224,7 +226,9 @@ def analyze(repodir, default_tokens):

depends.update(depends_from_inherits(inherited))

return PackageKind(kind='cygport', script=fn, depends=depends, arches=arches, tokens=tokens)
announce = get_var('ANNOUNCE', '')

return PackageKind(kind='cygport', script=fn, depends=depends, arches=arches, tokens=tokens, announce=announce)

# if there's no cygport file, we look for a g-b-s style .sh file instead
scripts = [m for m in files if re.search(r'\.sh$', m)]
Expand Down
2 changes: 1 addition & 1 deletion carpetbag.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def update_metadata(u):

# sort, because it's important that 'arch' and 'artifacts' are in the same order!
u.arch_list = ' '.join(sorted(u.artifacts.keys()))
conn.execute("UPDATE jobs SET arches = ?, artifacts = ? WHERE id = ?", (u.arch_list, ' '.join([u.artifacts[a] for a in sorted(u.artifacts.keys())]), u.buildnumber))
conn.execute("UPDATE jobs SET arches = ?, artifacts = ?, announce = ? WHERE id = ?", (u.arch_list, ' '.join([u.artifacts[a] for a in sorted(u.artifacts.keys())]), u.announce, u.buildnumber))

if not hasattr(u, 'status'):
u.status = 'build succeeded'
Expand Down
1 change: 1 addition & 0 deletions gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def examine_run_artifacts(wfr_id, u):
u.reference = mj['REFERENCE']
u.maintainer = mj['MAINTAINER']
u.tokens = mj['TOKENS']
u.announce = mj['ANNOUNCE']

# remove tmpfile
os.remove(tmpfile.name)
Expand Down
2 changes: 2 additions & 0 deletions hook.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def hook():
arch = evars['ARCH'].replace('i686', 'x86')
maintainer = evars['MAINTAINER']
tokens = evars['TOKENS']
announce = evars['ANNOUNCE']

if arch != 'skip':
if len(job['artifacts']):
Expand All @@ -83,6 +84,7 @@ def hook():
u.reference = reference
u.maintainer = maintainer
u.tokens = tokens
u.announce = announce
u.artifacts = artifacts

carpetbag.update_status(u)
Expand Down
3 changes: 3 additions & 0 deletions migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
if 'tokens' not in cols:
cursor.execute("ALTER TABLE jobs ADD COLUMN tokens TEXT NOT NULL DEFAULT ''")

if 'announce' not in cols:
cursor.execute("ALTER TABLE jobs ADD COLUMN announce TEXT NOT NULL DEFAULT ''")

print(cols)

conn.execute("UPDATE jobs SET status = ? WHERE status = ?", ('build succeeded', 'succeeded'))
Expand Down
3 changes: 2 additions & 1 deletion scallywag
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ args = parser.parse_args()

if args.inputs:
args_dict = json.loads(args.inputs)
logging.info('input args are %s' % (args_dict))
else:
args_dict = os.environ

Expand All @@ -32,7 +33,6 @@ commit = args_dict['COMMIT']
reference = args_dict['REFERENCE']
default_tokens = args_dict.get('DEFAULT_TOKENS', '')

logging.info('input args are %s' % (args_dict))
logging.info('package is %s' % (name))

# make a directory for working with the package repo
Expand Down Expand Up @@ -90,6 +90,7 @@ data_items = {
'MAINTAINER': maintainer,
'REFERENCE': reference,
'TOKENS': (' '.join(package.tokens)),
'ANNOUNCE': package.announce,
}

if 'APPVEYOR' in os.environ:
Expand Down

0 comments on commit 9975e05

Please sign in to comment.