hotness: remove old hotness vm's as it's been moved to openshift
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
parent
ab127872ef
commit
7906963cc7
11 changed files with 2 additions and 1029 deletions
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
nm: 255.255.255.0
|
||||
gw: 10.5.126.254
|
||||
dns: 10.5.126.21
|
||||
|
||||
ks_url: http://10.5.126.23/repo/rhel/ks/kvm-rhel-7
|
||||
ks_repo: http://10.5.126.23/repo/rhel/RHEL7-x86_64/
|
||||
|
||||
eth0_ip: 10.5.126.5
|
||||
|
||||
volgroup: /dev/vg_guests
|
||||
vmhost: virthost01.phx2.fedoraproject.org
|
||||
datacenter: phx2
|
||||
freezes: false
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
nm: 255.255.255.0
|
||||
gw: 10.5.128.254
|
||||
dns: 10.5.126.21
|
||||
|
||||
ks_url: http://10.5.126.23/repo/rhel/ks/kvm-rhel-7
|
||||
ks_repo: http://10.5.126.23/repo/rhel/RHEL7-x86_64/
|
||||
|
||||
eth0_ip: 10.5.128.135
|
||||
|
||||
volgroup: /dev/vg_guests
|
||||
vmhost: virthost01.stg.phx2.fedoraproject.org
|
||||
datacenter: phx2
|
|
@ -47,7 +47,6 @@
|
|||
- import_playbook: /srv/web/infra/ansible/playbooks/groups/freshmaker.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/groups/github2fedmsg.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/groups/gnome-backups.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/groups/hotness.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/groups/infinote.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/groups/ipa.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/groups/kerneltest.yml
|
||||
|
@ -115,13 +114,13 @@
|
|||
- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/greenwave.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/ipsilon.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/release-monitoring.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/the-new-hotness.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/transtats.yml
|
||||
- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/waiverdb.yml
|
||||
# These need work to finish and complete and are all stg currently.
|
||||
#- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/koschei.yml
|
||||
#- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/modernpaste.yml
|
||||
#- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/rats.yml
|
||||
#- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/transtats.yml
|
||||
#- import_playbook: /srv/web/infra/ansible/playbooks/openshift-apps/the-new-hotness.yml
|
||||
|
||||
#
|
||||
# host playbooks
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
# create a new hotness server
|
||||
# NOTE: should be used with --limit most of the time
|
||||
# NOTE: make sure there is room/space for this server on the vmhost
|
||||
# NOTE: most of these vars_path come from group_vars/mirrorlist or from hostvars
|
||||
|
||||
- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=hotness:hotness_stg"
|
||||
|
||||
- name: dole out the generic configuration
|
||||
hosts: hotness:hotness_stg
|
||||
user: root
|
||||
gather_facts: True
|
||||
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
|
||||
roles:
|
||||
- base
|
||||
- rkhunter
|
||||
- nagios_client
|
||||
- collectd/base
|
||||
- hosts
|
||||
- fas_client
|
||||
- sudo
|
||||
- role: keytab/service
|
||||
service: hotness
|
||||
owner_user: fedmsg
|
||||
# The proxies don't actually need to talk to these hosts so we won't bother
|
||||
# putting them on the vpn.
|
||||
#- { role: openvpn/client,
|
||||
# when: env != "staging" }
|
||||
|
||||
pre_tasks:
|
||||
- import_tasks: "{{ tasks_path }}/yumrepos.yml"
|
||||
|
||||
tasks:
|
||||
- import_tasks: "{{ tasks_path }}/2fa_client.yml"
|
||||
- import_tasks: "{{ tasks_path }}/motd.yml"
|
||||
|
||||
handlers:
|
||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||
|
||||
- name: set up fedmsg basics
|
||||
hosts: hotness:hotness_stg
|
||||
user: root
|
||||
gather_facts: True
|
||||
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
|
||||
roles:
|
||||
- fedmsg/base
|
||||
|
||||
handlers:
|
||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||
|
||||
- name: dole out the service-specific config
|
||||
hosts: hotness:hotness_stg
|
||||
user: root
|
||||
gather_facts: True
|
||||
|
||||
roles:
|
||||
- fedmsg/hub
|
||||
- hotness
|
||||
- role: collectd/fedmsg-service
|
||||
process: fedmsg-hub
|
||||
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
|
||||
handlers:
|
||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
|
@ -1,48 +0,0 @@
|
|||
- name: push packages out
|
||||
hosts: hotness:hotness_stg
|
||||
user: root
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
vars:
|
||||
testing: False
|
||||
handlers:
|
||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||
|
||||
tasks:
|
||||
- name: clean all metadata {%if testing%}(with infrastructure-testing on){%endif%}
|
||||
command: yum clean all {%if testing%} --enablerepo=infrastructure-tags-stg {%endif%}
|
||||
check_mode: no
|
||||
- name: yum update hotness packages from main repo
|
||||
yum: name="the-new-hotness" state=latest
|
||||
when: not testing
|
||||
- name: yum update hotness packages from testing repo
|
||||
yum: name="the-new-hotness" state=latest enablerepo=infrastructure-tags-stg
|
||||
when: testing
|
||||
|
||||
- name: verify the backend and restart it
|
||||
hosts: hotness:hotness_stg
|
||||
user: root
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
handlers:
|
||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||
|
||||
pre_tasks:
|
||||
- name: tell nagios to shush
|
||||
nagios: action=downtime minutes=60 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
||||
delegate_to: noc01.phx2.fedoraproject.org
|
||||
ignore_errors: true
|
||||
|
||||
roles:
|
||||
- hotness
|
||||
|
||||
post_tasks:
|
||||
- service: name="fedmsg-hub" state=restarted
|
||||
- name: tell nagios to unshush
|
||||
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
||||
delegate_to: noc01.phx2.fedoraproject.org
|
||||
ignore_errors: true
|
|
@ -1,299 +0,0 @@
|
|||
--- bz.py
|
||||
+++ bz.py
|
||||
@@ -31,46 +31,66 @@ _log = logging.getLogger(__name__)
|
||||
|
||||
class Bugzilla(object):
|
||||
base_query = {
|
||||
- 'query_format': 'advanced',
|
||||
- 'emailreporter1': '1',
|
||||
- 'emailtype1': 'exact',
|
||||
+ "query_format": "advanced",
|
||||
+ "emailreporter1": "1",
|
||||
+ "emailtype1": "exact",
|
||||
}
|
||||
- bug_status_early = ['NEW', 'ASSIGNED']
|
||||
+ bug_status_early = ["NEW", "ASSIGNED"]
|
||||
bug_status_open = bug_status_early + [
|
||||
- 'MODIFIED', 'ON_DEV', 'ON_QA', 'VERIFIED', 'FAILS_QA',
|
||||
- 'RELEASE_PENDING', 'POST']
|
||||
- bug_status_closed = ['CLOSED']
|
||||
+ "MODIFIED",
|
||||
+ "ON_DEV",
|
||||
+ "ON_QA",
|
||||
+ "VERIFIED",
|
||||
+ "FAILS_QA",
|
||||
+ "RELEASE_PENDING",
|
||||
+ "POST",
|
||||
+ ]
|
||||
+ bug_status_closed = ["CLOSED"]
|
||||
|
||||
new_bug = {
|
||||
- 'op_sys': 'Unspecified',
|
||||
- 'platform': 'Unspecified',
|
||||
- 'bug_severity': 'unspecified',
|
||||
+ "op_sys": "Unspecified",
|
||||
+ "platform": "Unspecified",
|
||||
+ "bug_severity": "unspecified",
|
||||
}
|
||||
|
||||
def __init__(self, consumer, config):
|
||||
self.consumer = consumer
|
||||
self.config = config
|
||||
- default = 'https://partner-bugzilla.redhat.com'
|
||||
- url = self.config.get('url', default)
|
||||
- self.username = self.config['user']
|
||||
- password = self.config['password']
|
||||
- self.bugzilla = bugzilla.Bugzilla(
|
||||
- url=url, cookiefile=None, tokenfile=None)
|
||||
+ default = "https://partner-bugzilla.redhat.com"
|
||||
+ url = self.config.get("url", default)
|
||||
+ self.username = self.config["user"]
|
||||
+ password = self.config["password"]
|
||||
+ api_key = self.config["api_key"]
|
||||
+ _log.info("Using BZ URL %s" % url)
|
||||
+
|
||||
+ if api_key:
|
||||
+ self.bugzilla = bugzilla.Bugzilla(
|
||||
+ url=url, api_key=api_key, cookiefile=None, tokenfile=None
|
||||
+ )
|
||||
+ elif self.username and password:
|
||||
+ self.bugzilla = bugzilla.Bugzilla(
|
||||
+ url=url,
|
||||
+ user=self.username,
|
||||
+ password=password,
|
||||
+ cookiefile=None,
|
||||
+ tokenfile=None,
|
||||
+ )
|
||||
+ else:
|
||||
+ self.bugzilla = bugzilla.Bugzilla(url=url, cookiefile=None, tokenfile=None)
|
||||
+
|
||||
self.bugzilla.bug_autorefresh = True
|
||||
- _log.info("Logging in to %s" % url)
|
||||
- self.bugzilla.login(self.username, password)
|
||||
|
||||
- self.base_query['product'] = self.config['product']
|
||||
- self.base_query['email1'] = self.config['user']
|
||||
+ self.base_query["product"] = self.config["product"]
|
||||
+ self.base_query["email1"] = self.config["user"]
|
||||
|
||||
- self.new_bug['product'] = self.config['product']
|
||||
+ self.new_bug["product"] = self.config["product"]
|
||||
if "keywords" in self.config:
|
||||
- self.new_bug['keywords'] = self.config['keywords']
|
||||
- self.new_bug['version'] = self.config['version']
|
||||
- self.new_bug['status'] = self.config['bug_status']
|
||||
+ self.new_bug["keywords"] = self.config["keywords"]
|
||||
+ self.new_bug["version"] = self.config["version"]
|
||||
+ self.new_bug["status"] = self.config["bug_status"]
|
||||
|
||||
- self.short_desc_template = self.config['short_desc_template']
|
||||
- self.description_template = self.config['description_template']
|
||||
+ self.short_desc_template = self.config["short_desc_template"]
|
||||
+ self.description_template = self.config["description_template"]
|
||||
|
||||
def handle(self, projectid, package, upstream, version, release, url):
|
||||
""" Main API entry point. Push updates to bugzilla.
|
||||
@@ -82,22 +102,21 @@ class Bugzilla(object):
|
||||
- There is no bug and we need to file one.
|
||||
"""
|
||||
kwargs = copy.copy(self.config)
|
||||
- kwargs.update(dict(
|
||||
- projectid=projectid,
|
||||
- package=package,
|
||||
- name=package,
|
||||
- version=version,
|
||||
- release=release,
|
||||
-
|
||||
- repo_name=self.consumer.repoid,
|
||||
- repo_version=version,
|
||||
- repo_release=release,
|
||||
-
|
||||
- upstream=upstream,
|
||||
- latest_upstream=upstream,
|
||||
-
|
||||
- url=url,
|
||||
- ))
|
||||
+ kwargs.update(
|
||||
+ dict(
|
||||
+ projectid=projectid,
|
||||
+ package=package,
|
||||
+ name=package,
|
||||
+ version=version,
|
||||
+ release=release,
|
||||
+ repo_name=self.consumer.repoid,
|
||||
+ repo_version=version,
|
||||
+ repo_release=release,
|
||||
+ upstream=upstream,
|
||||
+ latest_upstream=upstream,
|
||||
+ url=url,
|
||||
+ )
|
||||
+ )
|
||||
|
||||
bug = self.exact_bug(**kwargs)
|
||||
if bug:
|
||||
@@ -115,13 +134,7 @@ class Bugzilla(object):
|
||||
return bug
|
||||
|
||||
def follow_up(self, text, bug):
|
||||
- update = {
|
||||
- 'comment': {
|
||||
- 'body': text,
|
||||
- 'is_private': False,
|
||||
- },
|
||||
- 'ids': [bug.bug_id],
|
||||
- }
|
||||
+ update = {"comment": {"body": text, "is_private": False}, "ids": [bug.bug_id]}
|
||||
_log.debug("Following up on bug %r with %r" % (bug.bug_id, update))
|
||||
self.bugzilla._proxy.Bug.update(update)
|
||||
_log.info("Followed up on bug: %s" % bug.weburl)
|
||||
@@ -133,21 +146,21 @@ class Bugzilla(object):
|
||||
_log.info("Attached file to bug: %s" % bug.weburl)
|
||||
|
||||
def attach_log(self, filename, description, bug):
|
||||
- self._attach_file(filename, description, bug, content_type='text/plain')
|
||||
+ self._attach_file(filename, description, bug, content_type="text/plain")
|
||||
|
||||
def attach_patch(self, filename, description, bug):
|
||||
self._attach_file(filename, description, bug, is_patch=True)
|
||||
|
||||
def ftbfs_bugs(self, name):
|
||||
""" Return all FTBFS bugs we find for a package """
|
||||
- short_desc_pattern = '%s: FTBFS in rawhide' % name
|
||||
+ short_desc_pattern = "%s: FTBFS in rawhide" % name
|
||||
query = {
|
||||
- 'component': name,
|
||||
- 'bug_status': self.bug_status_open,
|
||||
- 'short_desc': short_desc_pattern,
|
||||
- 'short_desc_type': 'substring',
|
||||
- 'product': self.config['product'],
|
||||
- 'query_format': 'advanced',
|
||||
+ "component": name,
|
||||
+ "bug_status": self.bug_status_open,
|
||||
+ "short_desc": short_desc_pattern,
|
||||
+ "short_desc_type": "substring",
|
||||
+ "product": self.config["product"],
|
||||
+ "query_format": "advanced",
|
||||
}
|
||||
bugs = self.bugzilla.query(query)
|
||||
bugs = bugs or []
|
||||
@@ -160,14 +173,14 @@ class Bugzilla(object):
|
||||
|
||||
def review_request_bugs(self, name):
|
||||
""" Return the review request bugs for a package. """
|
||||
- short_desc_pattern = ' %s ' % name
|
||||
+ short_desc_pattern = " %s " % name
|
||||
query = {
|
||||
- 'component': 'Package Review',
|
||||
- 'bug_status': self.bug_status_open,
|
||||
- 'short_desc': short_desc_pattern,
|
||||
- 'short_desc_type': 'substring',
|
||||
- 'product': self.config['product'],
|
||||
- 'query_format': 'advanced',
|
||||
+ "component": "Package Review",
|
||||
+ "bug_status": self.bug_status_open,
|
||||
+ "short_desc": short_desc_pattern,
|
||||
+ "short_desc_type": "substring",
|
||||
+ "product": self.config["product"],
|
||||
+ "query_format": "advanced",
|
||||
}
|
||||
bugs = self.bugzilla.query(query)
|
||||
bugs = bugs or []
|
||||
@@ -176,12 +189,12 @@ class Bugzilla(object):
|
||||
|
||||
def exact_bug(self, **package):
|
||||
""" Return a particular upstream release ticket for a package. """
|
||||
- short_desc_pattern = '%(name)s-%(upstream)s ' % package
|
||||
+ short_desc_pattern = "%(name)s-%(upstream)s " % package
|
||||
query = {
|
||||
- 'component': package['name'],
|
||||
- 'bug_status': self.bug_status_open + self.bug_status_closed,
|
||||
- 'short_desc': short_desc_pattern,
|
||||
- 'short_desc_type': 'substring',
|
||||
+ "component": package["name"],
|
||||
+ "bug_status": self.bug_status_open + self.bug_status_closed,
|
||||
+ "short_desc": short_desc_pattern,
|
||||
+ "short_desc_type": "substring",
|
||||
}
|
||||
|
||||
query.update(self.base_query)
|
||||
@@ -198,13 +211,10 @@ class Bugzilla(object):
|
||||
""" Return any upstream release ticket for a package. """
|
||||
# We'll match bugs in the NEW or ASSIGNED state
|
||||
# https://github.com/fedora-infra/the-new-hotness/issues/58
|
||||
- possible_statuses = list(set(
|
||||
- self.bug_status_early + [self.config['bug_status']]
|
||||
- ))
|
||||
- query = {
|
||||
- 'component': [package['name']],
|
||||
- 'bug_status': possible_statuses,
|
||||
- }
|
||||
+ possible_statuses = list(
|
||||
+ set(self.bug_status_early + [self.config["bug_status"]])
|
||||
+ )
|
||||
+ query = {"component": [package["name"]], "bug_status": possible_statuses}
|
||||
|
||||
query.update(self.base_query)
|
||||
bugs = self.bugzilla.query(query)
|
||||
@@ -218,17 +228,17 @@ class Bugzilla(object):
|
||||
# short_desc should be '<name>-<version> <some text>'
|
||||
# To extract the version get everything before the first space
|
||||
# with split and then remove the name and '-' via slicing
|
||||
- bug_version = short_desc.split(" ")[0][len(package['name']) + 1:]
|
||||
+ bug_version = short_desc.split(" ")[0][len(package["name"]) + 1 :]
|
||||
|
||||
- _log.info("Comparing %r, %r" % (bug_version, package['upstream']))
|
||||
- if bug_version != package['upstream']:
|
||||
+ _log.info("Comparing %r, %r" % (bug_version, package["upstream"]))
|
||||
+ if bug_version != package["upstream"]:
|
||||
update = {
|
||||
- 'summary': self.short_desc_template % package,
|
||||
- 'comment': {
|
||||
- 'body': self.description_template % package,
|
||||
- 'is_private': False,
|
||||
+ "summary": self.short_desc_template % package,
|
||||
+ "comment": {
|
||||
+ "body": self.description_template % package,
|
||||
+ "is_private": False,
|
||||
},
|
||||
- 'ids': [bug.bug_id],
|
||||
+ "ids": [bug.bug_id],
|
||||
}
|
||||
_log.debug("Updating bug %r with %r" % (bug.bug_id, update))
|
||||
res = self.bugzilla._proxy.Bug.update(update)
|
||||
@@ -236,26 +246,28 @@ class Bugzilla(object):
|
||||
_log.info("Updated bug: %s" % bug.weburl)
|
||||
return True
|
||||
else:
|
||||
- _log.warn("They are the same, which is odd. %r == %r" % (
|
||||
- bug_version, package['upstream']))
|
||||
+ _log.warn(
|
||||
+ "They are the same, which is odd. %r == %r"
|
||||
+ % (bug_version, package["upstream"])
|
||||
+ )
|
||||
return False
|
||||
|
||||
def create_bug(self, **package):
|
||||
bug_dict = {
|
||||
- 'component': package['name'],
|
||||
- 'short_desc': self.short_desc_template % package,
|
||||
- 'description': self.description_template % package,
|
||||
+ "component": package["name"],
|
||||
+ "short_desc": self.short_desc_template % package,
|
||||
+ "description": self.description_template % package,
|
||||
}
|
||||
bug_dict.update(self.new_bug)
|
||||
new_bug = self.bugzilla.createbug(**bug_dict)
|
||||
change_status = None
|
||||
_log.info("Created bug: %s" % new_bug)
|
||||
|
||||
- if new_bug.bug_status != self.config['bug_status']:
|
||||
+ if new_bug.bug_status != self.config["bug_status"]:
|
||||
change_status = self.bugzilla._proxy.bugzilla.changeStatus(
|
||||
new_bug.bug_id,
|
||||
- self.config['bug_status'],
|
||||
- self.config['user'],
|
||||
+ self.config["bug_status"],
|
||||
+ self.config["user"],
|
||||
"",
|
||||
"",
|
||||
False,
|
|
@ -1,336 +0,0 @@
|
|||
#!/usr/bin/python -tt
|
||||
# -*- mode: Python; indent-tabs-mode: nil; coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2005-2014 Fedora Project
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
import time
|
||||
from optparse import OptionParser
|
||||
|
||||
|
||||
__version__ = "1.0.13"
|
||||
|
||||
|
||||
class BumpSpecError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class SpecFile:
|
||||
def __init__(self, filename, verbose=False, string=None):
|
||||
self.verbose = verbose
|
||||
self.string = string
|
||||
|
||||
self.filename = filename
|
||||
f = None
|
||||
try:
|
||||
f = open(filename, "r")
|
||||
self.lines = f.readlines()
|
||||
finally:
|
||||
f and f.close()
|
||||
|
||||
# supported release value macro definitions
|
||||
_macro_bump_patterns = (
|
||||
re.compile(r"^%(?:define|global)\s+(?i)release\s+(\d+.*)"),
|
||||
re.compile(r"^%(?:define|global)\s+(?i)baserelease\s+(\d+.*)"),
|
||||
)
|
||||
# normal "Release:" tag lines
|
||||
_tag_bump_patterns = (
|
||||
re.compile(r"^Release\s*:\s*(\d+.*)", re.I),
|
||||
re.compile(r"^Release\s*:\s+%release_func\s+(\d+.*)", re.I),
|
||||
)
|
||||
# lines we don't want to mess with
|
||||
_skip_patterns = (
|
||||
re.compile(r"\$Revision:"),
|
||||
)
|
||||
|
||||
def bumpRelease(self):
|
||||
# remember whether we've bumped a macro definition
|
||||
bumped_macro = False
|
||||
# count how many times/lines we've bumped
|
||||
bumped = 0
|
||||
|
||||
for i in range(len(self.lines)):
|
||||
# If we've bumped a macro, we assume this is enough for
|
||||
# the rest of the spec file, so we don't bump a macro and
|
||||
# a corresponding Release tag. The macro may or may not be
|
||||
# used for the definition of one or more Release tags.
|
||||
# Macro-madness makes that hard to check for.
|
||||
if bumped_macro:
|
||||
break
|
||||
|
||||
skipped = False
|
||||
for pattern in SpecFile._skip_patterns:
|
||||
if pattern.search(self.lines[i]):
|
||||
skipped = True
|
||||
break
|
||||
if skipped:
|
||||
continue
|
||||
|
||||
for pattern in SpecFile._macro_bump_patterns:
|
||||
(self.lines[i], n) = \
|
||||
pattern.subn(self.increase, self.lines[i], 1)
|
||||
if n: # this pattern has lead to a change
|
||||
bumped += 1
|
||||
bumped_macro = True
|
||||
break
|
||||
else: # no pattern matched
|
||||
for pattern in SpecFile._tag_bump_patterns:
|
||||
(self.lines[i], n) = \
|
||||
pattern.subn(self.increase, self.lines[i], 1)
|
||||
if n: # this pattern has lead to a change
|
||||
bumped += 1
|
||||
break
|
||||
else: # no pattern matched at all
|
||||
# Bump ^Release: ... line least-significant.
|
||||
if self.lines[i].lower().startswith('release:'):
|
||||
old = self.lines[i][len('Release:'):].rstrip()
|
||||
new = self.increaseFallback(old)
|
||||
if self.verbose:
|
||||
self.debugdiff(old, new)
|
||||
if old != new:
|
||||
self.lines[i] = self.lines[i].replace(old, new)
|
||||
bumped += 1
|
||||
|
||||
if bumped:
|
||||
return
|
||||
if self.verbose:
|
||||
sys.stderr.write('ERROR: No release value matched: %s\n' %
|
||||
self.filename)
|
||||
sys.exit(1)
|
||||
|
||||
def newVersion(self, vr):
|
||||
rpos = vr.find('-')
|
||||
if rpos >= 0: # set custom Release value
|
||||
r = vr[rpos+1:]
|
||||
v = vr[:rpos]
|
||||
else:
|
||||
r = "1%{?dist}"
|
||||
v = vr
|
||||
for i in range(len(self.lines)):
|
||||
if self.lines[i].lower().startswith('version:'):
|
||||
self.lines[i] = re.sub(
|
||||
r'[^: \t]*$', v, self.lines[i].rstrip()) + '\n'
|
||||
elif self.lines[i].lower().startswith('release:'):
|
||||
self.lines[i] = re.sub(
|
||||
r'[^: \t]*$', r, self.lines[i].rstrip()) + '\n'
|
||||
|
||||
_changelog_pattern = re.compile(r"^%changelog(\s|$)", re.I)
|
||||
|
||||
def addChangelogEntry(self, evr, entry, email):
|
||||
for i in range(len(self.lines)):
|
||||
if SpecFile._changelog_pattern.match(self.lines[i]):
|
||||
if len(evr):
|
||||
evrstring = ' - %s' % evr
|
||||
else:
|
||||
evrstring = ''
|
||||
date = time.strftime("%a %b %d %Y", time.gmtime())
|
||||
newchangelogentry = "* %s %s%s\n%s\n\n" % \
|
||||
(date, email, evrstring, entry)
|
||||
self.lines[i] += newchangelogentry
|
||||
return
|
||||
|
||||
_main_pre_pattern = re.compile(r'^0\.(?P<rel>\d+)(?P<post>.*)')
|
||||
_main_pattern = re.compile(r'^(?P<rel>\d+)(?P<post>.*)')
|
||||
|
||||
def increaseMain(self, release):
|
||||
if release.startswith('0.'):
|
||||
relre = SpecFile._main_pre_pattern
|
||||
pre = True
|
||||
else:
|
||||
relre = SpecFile._main_pattern
|
||||
pre = False
|
||||
relmatch = relre.search(release)
|
||||
if not relmatch: # pattern match failed
|
||||
raise BumpSpecError
|
||||
value = str(int(relmatch.group('rel')) + 1)
|
||||
post = relmatch.group('post')
|
||||
|
||||
new = value + post
|
||||
if not pre:
|
||||
if post.find('rc') >= 0:
|
||||
sys.stderr.write(
|
||||
'WARNING: Bad pre-release versioning scheme: %s\n' %
|
||||
self.filename)
|
||||
raise BumpSpecError
|
||||
else:
|
||||
new = '0.' + new
|
||||
return new
|
||||
|
||||
_jpp_pattern = \
|
||||
re.compile(r'(?P<prefix>.*)(?P<rel>\d+)(?P<jpp>jpp\.)(?P<post>.*)')
|
||||
|
||||
def increaseJPP(self, release):
|
||||
"""Fedora jpackage release versioning scheme"""
|
||||
|
||||
relmatch = SpecFile._jpp_pattern.search(release)
|
||||
if not relmatch: # pattern match failed
|
||||
sys.stderr.write(
|
||||
'WARNING: Bad Fedora jpackage release versioning scheme: %s\n'
|
||||
% self.filename)
|
||||
raise BumpSpecError
|
||||
|
||||
prefix = relmatch.group('prefix')
|
||||
value = int(relmatch.group('rel'))
|
||||
jpp = relmatch.group('jpp')
|
||||
post = relmatch.group('post')
|
||||
|
||||
newpost = self.increaseMain(post)
|
||||
new = prefix+str(value)+jpp+newpost
|
||||
return new
|
||||
|
||||
def increaseFallback(self, release):
|
||||
"""bump trailing .<self.string><DIGIT> or add .<self.string>1"""
|
||||
string = self.string
|
||||
if string is None:
|
||||
string = ""
|
||||
relre = re.compile(r'(?P<prefix>.+\.)' + re.escape(string) +
|
||||
r'(?P<post>\d+$)')
|
||||
relmatch = relre.search(release)
|
||||
if relmatch:
|
||||
prefix = relmatch.group('prefix')
|
||||
post = relmatch.group('post')
|
||||
new = prefix + string + self.increaseMain(post)
|
||||
else:
|
||||
new = release.rstrip() + '.' + string + '1'
|
||||
return new
|
||||
|
||||
def increase(self, match):
|
||||
old = match.group(1) # only the release value
|
||||
try:
|
||||
if self.string is not None:
|
||||
new = self.increaseFallback(old)
|
||||
elif old.find('jpp') > 0:
|
||||
new = self.increaseJPP(old)
|
||||
else:
|
||||
new = self.increaseMain(old)
|
||||
except BumpSpecError:
|
||||
new = self.increaseFallback(old)
|
||||
if self.verbose:
|
||||
self.debugdiff(old, new)
|
||||
# group 0 is the full line that defines the release
|
||||
return match.group(0).replace(old, new)
|
||||
|
||||
def writeFile(self, filename):
|
||||
f = open(filename, "w")
|
||||
f.writelines(self.lines)
|
||||
f.close()
|
||||
|
||||
def debugdiff(self, old, new):
|
||||
print ('%s\n-%s\n+%s\n' % (self.filename, old, new))
|
||||
|
||||
if __name__ == "__main__":
|
||||
usage = '''Usage: %prog [OPTION]... SPECFILE...
|
||||
|
||||
rpmdev-bumpspec bumps release tags in specfiles.'''
|
||||
|
||||
version = '''rpmdev-bumpspec version %s
|
||||
|
||||
Copyright (c) 2005-2014 Fedora Project
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.''' % __version__
|
||||
|
||||
userstring = subprocess.Popen("rpmdev-packager 2>/dev/null", shell=True,
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
if sys.version_info[0] > 2:
|
||||
userstring = userstring.decode(errors='replace')
|
||||
userstring = userstring.strip() or None
|
||||
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.add_option("-c", "--comment",
|
||||
help="changelog comment (default: \"- rebuilt\")")
|
||||
parser.add_option("-u", "--userstring", default=userstring,
|
||||
help="user name+email string (default: output from "
|
||||
"rpmdev-packager(1))")
|
||||
parser.add_option("-r", "--rightmost", default=False, action='store_true',
|
||||
help="bump trailing .<DIGIT> component if found, "
|
||||
"append .1 if not; no-op if -s is specified")
|
||||
parser.add_option("-s", "--string", default=None,
|
||||
help="bump trailing .STRING<DIGIT> component if found, "
|
||||
"append .STRING1 if not; trumps -r")
|
||||
parser.add_option("-n", "--new",
|
||||
help="set new version and reset/set release "
|
||||
"(simple spec files only)")
|
||||
parser.add_option("-V", "--verbose", default=False, action='store_true',
|
||||
help="more output")
|
||||
parser.add_option("-v", "--version", default=False, action='store_true',
|
||||
help="output version number and exit")
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
if opts.version:
|
||||
print (version)
|
||||
sys.exit(0)
|
||||
|
||||
if not args:
|
||||
parser.error('No specfiles specified')
|
||||
|
||||
if not opts.userstring:
|
||||
parser.error('Userstring required, see option -u')
|
||||
|
||||
if not opts.comment:
|
||||
opts.comment = '- new version' if opts.new else '- rebuilt'
|
||||
|
||||
# Grab bullet, insert one if not found.
|
||||
bullet_re = re.compile(r'^([^\s\w])\s', re.UNICODE)
|
||||
bullet = "-"
|
||||
match = bullet_re.search(opts.comment)
|
||||
if match:
|
||||
bullet = match.group(1)
|
||||
else:
|
||||
opts.comment = bullet + " " + opts.comment
|
||||
|
||||
# Format comment.
|
||||
if opts.comment.find("\n") == -1:
|
||||
wrapopts = {"subsequent_indent": (len(bullet)+1) * " ",
|
||||
"break_long_words": False}
|
||||
if sys.version_info[:2] > (2, 5):
|
||||
wrapopts["break_on_hyphens"] = False
|
||||
opts.comment = textwrap.fill(opts.comment, 80, **wrapopts)
|
||||
|
||||
# Prepare release component string.
|
||||
string = opts.string
|
||||
if string is None and opts.rightmost:
|
||||
string = ""
|
||||
|
||||
for aspec in args:
|
||||
try:
|
||||
s = SpecFile(aspec, opts.verbose, string)
|
||||
except:
|
||||
# Not actually a parser error, but... meh.
|
||||
parser.error(sys.exc_info()[1])
|
||||
if opts.new:
|
||||
s.newVersion(opts.new)
|
||||
else:
|
||||
s.bumpRelease()
|
||||
s.writeFile(aspec)
|
||||
|
||||
# Get EVR for changelog entry.
|
||||
cmd = ("rpm", "-q", "--specfile", "--define", "dist %{nil}",
|
||||
"--qf=%|epoch?{%{epoch}:}:{}|%{version}-%{release}\n", aspec)
|
||||
popen = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||
evr = popen.communicate()[0].split(b"\n")[0]
|
||||
if sys.version_info[0] > 2:
|
||||
evr = evr.decode(errors='replace')
|
||||
|
||||
s.addChangelogEntry(evr, opts.comment, opts.userstring)
|
||||
s.writeFile(aspec)
|
||||
|
||||
sys.exit(0)
|
|
@ -1,5 +0,0 @@
|
|||
# rpmmacros for the-new-hotness to build source rpms in place in /var/tmp/
|
||||
|
||||
%_topdir .
|
||||
%_sourcedir .
|
||||
%_srcrpmdir .
|
|
@ -1,35 +0,0 @@
|
|||
[main]
|
||||
cachedir=/var/cache/yum-hotness/$basearch/$releasever
|
||||
keepcache=0
|
||||
debuglevel=2
|
||||
logfile=/var/log/yum-hotness.log
|
||||
exactarch=1
|
||||
obsoletes=1
|
||||
gpgcheck=1
|
||||
plugins=1
|
||||
installonly_limit=3
|
||||
|
||||
# It is usually 90m. We'll expire often..
|
||||
metadata_expire=5m
|
||||
|
||||
# We have three repos to query...
|
||||
[rawhide-x86_64]
|
||||
name=Rawhide x86_64
|
||||
failovermethod=priority
|
||||
baseurl=https://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
|
||||
[rawhide-i386]
|
||||
name=Rawhide i386
|
||||
failovermethod=priority
|
||||
baseurl=https://kojipkgs.fedoraproject.org/repos/rawhide/latest/i386/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
|
||||
[rawhide-armhfp]
|
||||
name=Rawhide armhfp
|
||||
failovermethod=priority
|
||||
baseurl=https://kojipkgs.fedoraproject.org/repos/rawhide/latest/armhfp/
|
||||
enabled=1
|
||||
gpgcheck=0
|
|
@ -1,89 +0,0 @@
|
|||
---
|
||||
# Configuration for the the-new-hotness consumer
|
||||
#
|
||||
- name: install rebase helper from epel-testing
|
||||
package: name={{ item }} state=present enablerepo=epel-testing
|
||||
with_items:
|
||||
- rebase-helper
|
||||
tags:
|
||||
- packages
|
||||
- hotness
|
||||
|
||||
- name: install needed packages
|
||||
package: name={{ item }} state=present
|
||||
with_items:
|
||||
- the-new-hotness
|
||||
- python-psycopg2
|
||||
- python-sh
|
||||
- koji
|
||||
- fedpkg
|
||||
- git
|
||||
- rpmdevtools # Note that we hotfix rpmdev-bumpspec on top of this
|
||||
tags:
|
||||
- packages
|
||||
- hotness
|
||||
|
||||
- name: hotfix rpmdev-bumpspec to a copy from rpmdevtools-8.5-1
|
||||
copy: src=hotfix/rpmdev-bumpspec dest=/usr/bin/rpmdev-bumpspec
|
||||
tags:
|
||||
- hotfix
|
||||
- hotness
|
||||
|
||||
- name: hotfix Bugzilla API key
|
||||
patch:
|
||||
src: hotfix/api_bugzilla.patch
|
||||
basedir: /usr/lib/python2.7/site-packages/hotness
|
||||
|
||||
- name: copy hotness fedmsg configuration
|
||||
template: >
|
||||
src={{ item }} dest=/etc/fedmsg.d/{{ item }}
|
||||
owner=fedmsg group=fedmsg mode=0600
|
||||
with_items:
|
||||
- hotness.py
|
||||
notify:
|
||||
- restart fedmsg-hub
|
||||
tags:
|
||||
- config
|
||||
- hotness
|
||||
|
||||
- name: install hotness.pem koji key and cert
|
||||
copy: >
|
||||
src="{{ private }}/files/hotness_key_and_cert.pem"
|
||||
dest="/etc/pki/fedmsg/hotness.pem"
|
||||
owner=fedmsg
|
||||
group=fedmsg
|
||||
mode=0400
|
||||
tags:
|
||||
- config
|
||||
- hotness
|
||||
|
||||
- name: install koji ca cert
|
||||
copy: >
|
||||
src="{{ private }}/files/fedora-ca.cert"
|
||||
dest="/etc/pki/fedmsg/{{ item }}"
|
||||
owner=root
|
||||
group=root
|
||||
mode=0644
|
||||
with_items:
|
||||
- fedora-server-ca.cert
|
||||
- fedora-upload-ca.cert
|
||||
tags:
|
||||
- config
|
||||
- hotness
|
||||
|
||||
- name: Copy over a yum config for repoquery
|
||||
copy: src=yumconfig dest=/etc/hotness-yum.conf
|
||||
tags:
|
||||
- config
|
||||
- hotness
|
||||
|
||||
- name: Copy over rpmmacros configuration
|
||||
copy: src=rpmmacros dest=/etc/rpm/macros.hotness
|
||||
tags:
|
||||
- config
|
||||
- hotness
|
||||
|
||||
- name: Drop old /usr/share/fedmsg (once used for bugzilla cookies...)
|
||||
file: dest=/usr/share/fedmsg state=absent
|
||||
tags:
|
||||
- hotness
|
|
@ -1,110 +0,0 @@
|
|||
import os
|
||||
import socket
|
||||
hostname = socket.gethostname().split('.', 1)[0]
|
||||
|
||||
description_template = """Latest upstream release: %(latest_upstream)s
|
||||
Current version/release in %(repo_name)s: %(repo_version)s-%(repo_release)s
|
||||
URL: %(url)s
|
||||
|
||||
Please consult the package updates policy before you issue an update to a stable branch: https://fedoraproject.org/wiki/Updates_Policy
|
||||
|
||||
More information about the service that created this bug can be found at: %(explanation_url)s
|
||||
|
||||
Please keep in mind that with any upstream change, there may also be packaging changes that need to be made. Specifically, please remember that it is your responsibility to review the new version to ensure that the licensing is still correct and that no non-free or legally problematic items have been added upstream.
|
||||
|
||||
Based on the information from anitya: https://release-monitoring.org/project/%(projectid)s/
|
||||
"""
|
||||
|
||||
config = {
|
||||
{% if env == 'staging' %}
|
||||
# Establish a loop from prod anitya back into the staging hotness.
|
||||
'endpoints': {
|
||||
'anitya-public-relay': [
|
||||
'tcp://release-monitoring.org:9940',
|
||||
],
|
||||
},
|
||||
{% endif %}
|
||||
|
||||
'hotness.bugzilla.enabled': True,
|
||||
|
||||
'hotness.bugzilla': {
|
||||
'user': '{{ upstream_release_bugzilla_user }}',
|
||||
'password': '{{ upstream_release_bugzilla_password }}',
|
||||
{% if env == 'staging' %}
|
||||
'api_key': '',
|
||||
'url': 'https://partner-bugzilla.redhat.com',
|
||||
'explanation_url': 'https://stg.fedoraproject.org/wiki/Upstream_release_monitoring',
|
||||
{% else %}
|
||||
'api_key': '{{ upstream_release_bugzilla_api_token }}',
|
||||
'url': 'https://bugzilla.redhat.com',
|
||||
'explanation_url': 'https://fedoraproject.org/wiki/Upstream_release_monitoring',
|
||||
{% endif %}
|
||||
'product': 'Fedora',
|
||||
'version': 'rawhide',
|
||||
'keywords': 'FutureFeature,Triaged',
|
||||
'bug_status': 'NEW',
|
||||
'short_desc_template': "%(name)s-%(latest_upstream)s is available",
|
||||
'description_template': description_template,
|
||||
},
|
||||
|
||||
'hotness.koji': {
|
||||
{% if env == 'staging' %}
|
||||
'server': 'https://koji.stg.fedoraproject.org/kojihub',
|
||||
'weburl': 'https://koji.stg.fedoraproject.org/koji',
|
||||
{% else %}
|
||||
'server': 'https://koji.fedoraproject.org/kojihub',
|
||||
'weburl': 'https://koji.fedoraproject.org/koji',
|
||||
{% endif %}
|
||||
'git_url': 'https://src.fedoraproject.org/git/rpms/{package}.git',
|
||||
|
||||
'krb_principal': 'hotness/hotness01{{env_suffix}}.phx2.fedoraproject.org@{{ipa_realm}}',
|
||||
'krb_keytab': '/etc/krb5.hotness_hotness01{{env_suffix}}.phx2.fedoraproject.org.keytab',
|
||||
'krb_ccache': None,
|
||||
'krb_proxyuser': None,
|
||||
'krb_sessionopts': {'timeout': 3600, 'krb_rdns': False},
|
||||
|
||||
'user_email': ('Fedora Release Monitoring ',
|
||||
'<release-monitoring@fedoraproject.org>'),
|
||||
'opts': {'scratch': True},
|
||||
'priority': 30,
|
||||
'target_tag': 'rawhide',
|
||||
},
|
||||
|
||||
'hotness.anitya': {
|
||||
'url': 'https://release-monitoring.org',
|
||||
'username': '{{ fedoraDummyUser }}',
|
||||
'password': '{{ fedoraDummyUserPassword }}',
|
||||
},
|
||||
|
||||
'hotness.repo_url': 'https://pagure.io/releng/fedora-scm-requests',
|
||||
{% if env == 'staging' %}
|
||||
"hotness.mdapi_url": "https://apps.stg.fedoraproject.org/mdapi",
|
||||
'hotness.pdc_url': 'https://pdc.stg.fedoraproject.org',
|
||||
'hotness.dist_git_url': 'https://src.stg.fedoraproject.org',
|
||||
{% else %}
|
||||
"hotness.mdapi_url": "https://apps.fedoraproject.org/mdapi",
|
||||
'hotness.pdc_url': 'https://pdc.fedoraproject.org',
|
||||
'hotness.dist_git_url': 'https://src.fedoraproject.org',
|
||||
{% endif %}
|
||||
|
||||
'hotness.yumconfig': '/etc/hotness-yum.conf',
|
||||
|
||||
# The time in seconds the-new-hotness should wait for a socket to connect
|
||||
# before giving up.
|
||||
'hotness.connect_timeout': 15,
|
||||
# The time in seconds the-new-hotness should wait for a read from a socket
|
||||
# before giving up.
|
||||
'hotness.read_timeout': 15,
|
||||
# The number of times the-new-hotness should retry a network request that
|
||||
# that failed for any reason (e.g. read timeout, DNS error, etc)
|
||||
'hotness.requests_retries': 3,
|
||||
|
||||
"hotness.cache": {
|
||||
"backend": "dogpile.cache.dbm",
|
||||
"expiration_time": 290,
|
||||
"arguments": {
|
||||
"filename": "/var/tmp/the-new-hotness-cache.dbm",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue