Skip to content

Commit

Permalink
Rename masher to composer
Browse files Browse the repository at this point in the history
Fixes fedora-infra#2151

Signed-off-by: Sebastian Wojciechowski <[email protected]>
  • Loading branch information
sebwoj committed Jan 17, 2019
1 parent 330d433 commit cbc4d50
Show file tree
Hide file tree
Showing 23 changed files with 715 additions and 700 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ docs/images/database.png
dogpile-cache.dbm*
html-docs
htmlcov/
masher/
composer/
nosetests.xml
virtenv
8 changes: 4 additions & 4 deletions bodhi/server/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2013-2017 Red Hat, Inc. and others.
# Copyright © 2013-2019 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
Expand Down Expand Up @@ -483,13 +483,13 @@ class BodhiConfig(dict):
'mandatory_packager_groups': {
'value': ['packager'],
'validator': _generate_list_validator()},
'mash_dir': {
'compose_dir': {
'value': None,
'validator': _validate_none_or(str)},
'mash_stage_dir': {
'compose_stage_dir': {
'value': None,
'validator': _validate_none_or(str)},
'max_concurrent_mashes': {
'max_concurrent_composes': {
'value': 2,
'validator': int},
'max_update_length_for_ui': {
Expand Down
213 changes: 109 additions & 104 deletions bodhi/server/consumers/masher.py → bodhi/server/consumers/composer.py

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions bodhi/server/metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2007-2018 Red Hat, Inc. and others.
# Copyright 2007-2019 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
Expand All @@ -15,7 +15,7 @@
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Create metadata files when mashing repositories."""
"""Create metadata files when composing repositories."""
from datetime import datetime
import logging
import os
Expand Down Expand Up @@ -96,22 +96,22 @@ class UpdateInfoMetadata(object):
"""
This class represents the updateinfo.xml yum metadata.
It is generated during push time by the bodhi masher based on koji tags
It is generated during push time by the bodhi composer based on koji tags
and is injected into the yum repodata using the `modifyrepo_c` tool,
which is included in the `createrepo_c` package.
"""

def __init__(self, release, request, db, mashdir, close_shelf=True):
def __init__(self, release, request, db, composedir, close_shelf=True):
"""
Initialize the UpdateInfoMetadata object.
Args:
release (bodhi.server.models.Release): The Release that is being mashed.
request (bodhi.server.models.UpdateRequest): The Request that is being mashed.
release (bodhi.server.models.Release): The Release that is being composed.
request (bodhi.server.models.UpdateRequest): The Request that is being composed.
db (): A database session to be used for queries.
mashdir (basestring): A path to the mashdir.
composedir (basestring): A path to the composedir.
close_shelf (bool): Whether to close the shelve, which is used to cache updateinfo
between mashes.
between composes.
"""
self.request = request
if request is UpdateRequest.stable:
Expand Down
30 changes: 15 additions & 15 deletions bodhi/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ class UpdateRequest(DeclEnum):
push.
obsolete (EnumSymbol): The update has been obsoleted by another update.
unpush (EnumSymbol): The update no longer needs to be released.
revoke (EnumSymbol): The unpushed update will no longer be mashed in any repository.
revoke (EnumSymbol): The unpushed update will no longer be composed in any repository.
stable (EnumSymbol): The update is ready to be pushed to the stable repository.
"""

Expand Down Expand Up @@ -779,9 +779,9 @@ class Release(Base):
pending_signing_tag (unicode): The koji tag that specifies that a build is waiting to be
signed, such as 'f27-signing-pending'.
pending_testing_tag (unicode): The koji tag that indicates that a build is waiting to be
mashed into the testing repository, such as 'f27-updates-testing-pending'.
composed into the testing repository, such as 'f27-updates-testing-pending'.
pending_stable_tag (unicode): The koji tag that indicates that a build is waiting to be
mashed into the stable repository, such as 'f27-updates-pending'.
composed into the stable repository, such as 'f27-updates-pending'.
override_tag (unicode): The koji tag that is used when a build is added as a buildroot
override, such as 'f27-override'.
mail_template (unicode): The notification mail template.
Expand Down Expand Up @@ -1602,7 +1602,7 @@ class Update(Base):
suggest (EnumSymbol): Suggested action a user should take after applying the update.
This must be one of the values defined in :class:`UpdateSuggestion`.
locked (bool): Indicates whether or not the update is locked and un-editable.
This is usually set by the masher because the update is going through a state
This is usually set by the composer because the update is going through a state
transition.
pushed (bool): Indicates whether or not the update has been pushed to its requested
repository.
Expand Down Expand Up @@ -1640,7 +1640,7 @@ class Update(Base):
greenwave_unsatisfied_requirements (unicode): When test_gating_status is failed, Bodhi will
set this to a JSON representation of the unsatisfied_requirements field from Greewave's
response.
compose (Compose): The :class:`Compose` that this update is currently being mashed in. The
compose (Compose): The :class:`Compose` that this update is currently being composed in. The
update is locked if this is defined.
"""

Expand Down Expand Up @@ -1728,7 +1728,7 @@ def side_tag_locked(self):
"""
return self.status == UpdateStatus.side_tag_active and self.request is not None

# WARNING: consumers/masher.py assumes that this validation is performed!
# WARNING: consumers/composer.py assumes that this validation is performed!
@validates('builds')
def validate_builds(self, key, build):
"""
Expand Down Expand Up @@ -2569,13 +2569,13 @@ def set_request(self, db, action, username):
action = UpdateRequest.testing

if action is UpdateRequest.batched and self.status is not UpdateStatus.testing:
# We don't want to allow updates to go to batched if they haven't been mashed into the
# We don't want to allow updates to go to batched if they haven't been composed into the
# testing repository yet.
raise BodhiException('This update is not in the testing repository yet. It cannot be '
'requested for batching until it is in testing.')

# Add the appropriate 'pending' koji tag to this update, so tools like
# AutoQA can mash repositories of them for testing.
# AutoQA can compose repositories of them for testing.
if action is UpdateRequest.testing:
self.add_tag(self.release.pending_signing_tag)
elif action is UpdateRequest.stable:
Expand Down Expand Up @@ -2699,7 +2699,7 @@ def modify_bugs(self):
"""
Comment on and close this update's bugs as necessary.
This typically gets called by the Masher at the end.
This typically gets called by the Composer at the end.
"""
if self.status is UpdateStatus.testing:
for bug in self.bugs:
Expand Down Expand Up @@ -3138,7 +3138,7 @@ def obsolete(self, db, newer=None):
Obsolete this update.
Even though unpushing/obsoletion is an "instant" action, changes in the repository will not
propagate until the next mash takes place.
propagate until the next compose takes place.
Args:
db (sqlalchemy.orm.session.Session): A database session.
Expand Down Expand Up @@ -3627,7 +3627,7 @@ class Compose(Base):
__exclude_columns__ (tuple): A tuple of columns to exclude when __json__() is called.
__include_extras__ (tuple): A tuple of attributes to add when __json__() is called.
__tablename__ (str): The name of the table in the database.
checkpoints (unicode): A JSON serialized object describing the checkpoints the masher has
checkpoints (unicode): A JSON serialized object describing the checkpoints the composer has
reached.
date_created (datetime.datetime): The time this Compose was created.
error_message (unicode): An error message indicating what happened if the Compose failed.
Expand All @@ -3645,8 +3645,8 @@ class Compose(Base):
"""

__exclude_columns__ = ('updates')
# We need to include content_type and security so the masher can collate the Composes and so it
# can pick the right masher class to use.
# We need to include content_type and security so the composer can collate the Composes and so
# it can pick the right composer class to use.
__include_extras__ = ('content_type', 'security', 'update_summary')
__tablename__ = 'composes'

Expand Down Expand Up @@ -3800,8 +3800,8 @@ def __json__(self, request=None, anonymize=False, exclude=None, include=None, co
if composer:
exclude = ('checkpoints', 'error_message', 'date_created', 'state_date', 'release',
'state', 'updates')
# We need to include content_type and security so the masher can collate the Composes
# and so it can pick the right masher class to use.
# We need to include content_type and security so the composer can collate the Composes
# and so it can pick the right composer class to use.
include = ('content_type', 'security')
return super(Compose, self).__json__(request=request, anonymize=anonymize, exclude=exclude,
include=include)
Expand Down
10 changes: 5 additions & 5 deletions bodhi/server/push.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2007-2018 Red Hat, Inc.
# Copyright © 2007-2019 Red Hat, Inc.
#
# This file is part of Bodhi.
#
Expand Down Expand Up @@ -88,8 +88,8 @@ def push(username, cert_prefix, yes, **kwargs):
if resume:
for compose in session.query(Compose).all():
if len(compose.updates) == 0:
# Compose objects can end up with 0 updates in them if the masher ejects all the
# updates in a compose for some reason. Composes with no updates cannot be
# Compose objects can end up with 0 updates in them if the composer ejects all
# the updates in a compose for some reason. Composes with no updates cannot be
# serialized because their content_type property uses the content_type of the
# first update in the Compose. Additionally, it doesn't really make sense to go
# forward with running an empty Compose. It makes the most sense to delete them.
Expand Down Expand Up @@ -171,12 +171,12 @@ def push(username, cert_prefix, yes, **kwargs):
composes = [c.__json__(composer=True) for c in composes]

if composes:
click.echo('\nSending masher.start fedmsg')
click.echo('\nSending composer.start fedmsg')
# Because we're a script, we want to send to the fedmsg-relay,
# that's why we say active=True
bodhi.server.notifications.init(active=True, cert_prefix=cert_prefix)
bodhi.server.notifications.publish(
topic='masher.start',
topic='composer.start',
msg=dict(
api_version=2,
composes=composes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2016-2018 Red Hat, Inc.
# Copyright © 2016-2019 Red Hat, Inc.
#
# This file is part of Bodhi.
#
Expand All @@ -15,7 +15,7 @@
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""Cleans up old mashes that are left over in mash_dir."""
"""Cleans up old composes that are left over in compose_dir."""
import collections

import click
Expand All @@ -25,27 +25,28 @@
from bodhi.server import config


# How many of the newest mash dirs to keep during cleanup
# How many of the newest compose dirs to keep during cleanup
NUM_TO_KEEP = 10


@click.command()
@click.version_option(message='%(version)s')
def clean_up():
"""Delete any repo mashes that are older than the newest 10 from each repo series."""
"""Delete any repo composes that are older than the newest 10 from each repo series."""
remove_old_composes()


# Helper function used in auto clean composes (masher.py)
# Helper function used in auto clean composes (composer.py)
def remove_old_composes():
"""Delete any repo mashes that are older than the newest 10 from each repo series."""
mash_dir = config.config['mash_dir']
"""Delete any repo composes that are older than the newest 10 from each repo series."""
compose_dir = config.config['compose_dir']

# This data structure will map the beginning of a group of dirs for the same repo to a list of
# the dirs that start off the same way.
pattern_matched_dirs = collections.defaultdict(list)

for directory in [d for d in os.listdir(mash_dir) if os.path.isdir(os.path.join(mash_dir, d))]:
for directory in [d for d in os.listdir(compose_dir)
if os.path.isdir(os.path.join(compose_dir, d))]:
# If this directory ends with a float, it is a candidate for potential deletion
try:
split_dir = directory.split('-')
Expand All @@ -66,6 +67,6 @@ def remove_old_composes():
if dirs_to_delete:
print('Deleting the following directories:')
for d in dirs_to_delete:
d = os.path.join(mash_dir, d)
d = os.path.join(compose_dir, d)
print(d)
shutil.rmtree(d)
4 changes: 2 additions & 2 deletions bodhi/server/scripts/untag_branched.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2015-2018 Red Hat, Inc. and others.
# Copyright © 2015-2019 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
Expand All @@ -18,7 +18,7 @@
"""
Used to remove the pending and testing tags from updates in a branched release.
Since a separate task mashes the branched stable repos, this will leave
Since a separate task composes the branched stable repos, this will leave
those stable updates with the testing tags for 1 day before untagging.
https://github.com/fedora-infra/bodhi/issues/576
Expand Down
Loading

0 comments on commit cbc4d50

Please sign in to comment.