Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync production changes back to git #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions conf/supervisor/defineimage.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[program:defineimage]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other two participants should not go in. defineimage and do_build_trial got removed in git history. wait_for_repo_published is unused (perhaps it shares ancestry with is_repo_published?)

command = /usr/bin/skynet_exo /etc/supervisor/conf.d/defineimage.conf
process_name = %(program_name)s_%(process_num)s
numprocs = 1
user = bossmaintainer
umask = 022
autostart = true
autorestart = true
startsecs = 5
startretries = 100
stopwaitsecs = 10
redirect_stderr = true
stdout_logfile = /var/log/supervisor/%(program_name)s_%(process_num)s.log
stderr_logfile = off
environment = PYTHONUNBUFFERED=1,HOME="/home/bossmaintainer",USER="bossmaintainer"

[participant]
name = defineimage
queue = defineimage
regexp = defineimage
code = /usr/share/boss-skynet/defineimage.py

22 changes: 22 additions & 0 deletions conf/supervisor/do_build_trial.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[program:do_build_trial]
command = /usr/bin/skynet_exo /etc/supervisor/conf.d/do_build_trial.conf
process_name = %(program_name)s_%(process_num)s
numprocs = 1
user = bossmaintainer
umask = 022
autostart = true
autorestart = true
startsecs = 5
startretries = 100
stopwaitsecs = 10
redirect_stderr = true
stdout_logfile = /var/log/supervisor/%(program_name)s_%(process_num)s.log
stderr_logfile = off
environment = PYTHONUNBUFFERED=1,HOME="/home/bossmaintainer",USER="bossmaintainer"

[participant]
name = do_build_trial
queue = do_build_trial
regexp = do_build_trial
code = /usr/share/boss-skynet/do_build_trial.py

22 changes: 22 additions & 0 deletions conf/supervisor/wait_for_repo_published.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[program:wait_for_repo_published]
command = /usr/bin/skynet_exo /etc/supervisor/conf.d/wait_for_repo_published.conf
process_name = %(program_name)s_%(process_num)s
numprocs = 1
user = bossmaintainer
umask = 022
autostart = true
autorestart = true
startsecs = 5
startretries = 100
stopwaitsecs = 10
redirect_stderr = true
stdout_logfile = /var/log/supervisor/%(program_name)s_%(process_num)s.log
stderr_logfile = off
environment = PYTHONUNBUFFERED=1,HOME="/home/bossmaintainer",USER="bossmaintainer"

[participant]
name = wait_for_repo_published
queue = wait_for_repo_published
regexp = wait_for_repo_published
code = /usr/share/boss-skynet/wait_for_repo_published.py

7 changes: 6 additions & 1 deletion participants/bz.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
https://wiki.mozilla.org/index.php?title=Bugzilla:REST_API:Methods
"""

import os
import re
from urllib2 import HTTPError
import datetime
Expand Down Expand Up @@ -241,7 +242,10 @@ def handle_mentioned_bug(bugzilla, bugnum, extra_data, wid, trigger):
if wid.params.comment:
comment = wid.params.comment
elif wid.params.template:
with open(wid.params.template) as fileobj:
with open(os.path.join(bugzilla["template_store"], wid.params.template)) as fileobj:
comment = prepare_comment(fileobj.read(), wid.fields.as_dict(), extra_data)
elif wid.fields.reports and wid.fields.reports.bz_comment_template:
with open(os.path.join(bugzilla["template_store"], wid.fields.reports.bz_comment_template)) as fileobj:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine, where did it open(wid.params.template) before?

comment = prepare_comment(fileobj.read(), wid.fields.as_dict(), extra_data)
elif bugzilla['template']:
comment = prepare_comment(bugzilla["template"], wid.fields.as_dict(), extra_data)
Expand Down Expand Up @@ -374,6 +378,7 @@ def handle_action(self, action, wid, bugs):
matches = set([(match.group(), match.group('key')) for match in bugzilla['compiled_re'].finditer(entry)])
for remote_re in bugzilla['remote_tags_re']:
for match in remote_re.finditer(entry):
print match.group()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging, don't necessarily need it.

tracking_bugs = bugzilla['interface'].tracking_bugs(match.group())
for tracker in tracking_bugs[match.group()]:
matches.add((match.group(), str(tracker)))
Expand Down
6 changes: 5 additions & 1 deletion participants/check_has_relevant_changelog.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ def handle_wi(self, wid):
if not actions:
raise RuntimeError("Missing mandatory field 'ev.actions'")

result = True
# skip requests marked as revert
if "revert" in wid.fields.ev.description.lower():
wid.result = True
return

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess that's ok?

result = True
# Assert each package being submitted has relevant changelog entries.
for action in actions:
pkg_result, _ = contains_relevant_changelog(action, wid)
Expand Down
4 changes: 2 additions & 2 deletions participants/check_mentions_bug.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def handle_wi(self, wi):
result = False
f.msg.append("No bugs mentioned in relevant changelog of "\
"package %s, please refer to a bug using: "\
"%s" % (package,
bugzilla['regexp']))
"%s or %s" % (package,
bugzilla['regexp'], bugzilla['remote_tags']))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

wi.result = result

8 changes: 4 additions & 4 deletions participants/check_package_built_at_source.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ def quality_check(self, action, wid):
if status != "succeeded":
msg.append("Build status is '%s' for %s (against %s)." %
(status, source_build, build_against))
if status != "excluded":
if status not in ["excluded", "disabled"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess this is ok.

result = False

if targets:
msg.append("Not build against %s" % ", ".join(targets))
result = False
#if targets:
# msg.append("Not build against %s" % ", ".join(targets))
# result = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This however, completely disables check_package_built_at_source making it a noop. That said, if you look at the rest of the code it doesn't at all do what it claims to do. Entire logic needs to be rewritten.


if msg:
return result, " ".join(msg)
Expand Down
13 changes: 10 additions & 3 deletions participants/check_package_is_complete.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ def get_rpm_sources(self, action, filelist):
spec = self.obs.getFile(action["sourceproject"],
action["sourcepackage"], spec_name,
action["sourcerevision"])
print spec
except Exception, exobj:
raise SourceError("Failed to fetch spec file %s/%s/%s rev %s: %s" %
(action["sourceproject"], action["sourcepackage"],
spec_name, action["sourcerevision"], exobj))
import hashlib
print "Spec file retrieved from", action["sourceproject"], action["sourcepackage"], action["sourcerevision"], ": ", hashlib.md5(spec).hexdigest()
try:
tmp_spec = NamedTemporaryFile(mode="w")
tmp_spec = NamedTemporaryFile(mode="w", delete=False)
tmp_spec.file.write(spec)
tmp_spec.file.flush()
print "Parsing spec file from", tmp_spec.name
spec_obj = parse_spec(tmp_spec.name)
sources = [os.path.basename(name) for name, _, _ in
spec_obj.sources]
Expand Down Expand Up @@ -169,14 +171,15 @@ def check_source_files(self, action, _wid, filelist):
msg = ""
try:
sources.update(self.get_rpm_sources(action, filelist))
print sources
except SourceError, exobj:
msg += str(exobj)
try:
sources.update(self.get_deb_sources(action, filelist))
except SourceError, exobj:
msg += str(exobj)
extras = []
print sources
print filelist
for name in filelist:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and everything above is debugging, not needed.

if name.startswith("_service"):
name = name.split(":")[-1]
Expand All @@ -187,9 +190,13 @@ def check_source_files(self, action, _wid, filelist):
if name not in sources:
if name.endswith("-rpmlintrc") and not name == "%s-rpmlintrc" % action["sourcepackage"]:
continue
if name == "_src":
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is some gitpkg handling? Don't know for sure, needs examination.

extras.append(name)
else:
sources.remove(name)
if "_src" in sources:
sources.remove("_src")
if extras:
msg += "\nExtra source files: %s. " % ", ".join(extras)
if sources:
Expand Down
17 changes: 12 additions & 5 deletions participants/check_valid_changes.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import re
import time
import rpm
from rpmUtils.miscutils import compareEVR
from rpmUtils.miscutils import compareEVR, stringToVersion
from tempfile import NamedTemporaryFile

try:
Expand Down Expand Up @@ -203,7 +203,12 @@ def setup_obs(self, namespace):

def _get_spec_file(self, prj, pkg, rev):

file_list = self.obs.getPackageFileList(prj, pkg, revision=rev)
file_list = []
try:
file_list = self.obs.getPackageFileList(prj, pkg, revision=rev)
except:
pass

specs = [ fil for fil in file_list if fil.endswith(".spec")]

if len(specs) > 1:
Expand All @@ -220,7 +225,8 @@ def _get_spec_file(self, prj, pkg, rev):

spec = self.obs.getFile(prj, pkg, fil, revision=rev)
specob = None

print fil
print spec
with NamedTemporaryFile() as specf:
specf.write(spec)
specf.flush()
Expand Down Expand Up @@ -248,12 +254,13 @@ def check_spec_version_match(self, version, prj, pkg, rev=None):
def check_version_inc(self, version, prj, pkg):
error, specob = self._get_spec_file(prj, pkg, None)
if error:
print error
#don't care if we can't get target package spec
return None

src_hdrs = [pkg for pkg in specob.packages if pkg.header.isSource()][0]
spec_version = src_hdrs.header[rpm.RPMTAG_VERSION]
version_comparison = compareEVR(('', version.split('-')[0], ''), ('', spec_version, ''))
spec_version = "%s-%s" % (src_hdrs.header[rpm.RPMTAG_VERSION], src_hdrs.header[rpm.RPMTAG_RELEASE])
version_comparison = compareEVR(stringToVersion(version), stringToVersion(spec_version))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, how did this work before?

if version_comparison == 1:
return None
else:
Expand Down
Loading