Files
autospec/autospec/buildpattern.py
T
Matthew Johnson 11569333b4 Add simple tests for buildpattern module
The complexity of the buildpattern has been significantly reduced with
the move to a centralized specfiles class to handle specfile writes.
This patch tests the remaining functionality and fixes a typo in
buildpattern.py (pattern_strengh -> pattern_strength).
2017-04-25 14:48:33 -07:00

44 lines
1.4 KiB
Python

#!/bin/true
#
# buildpattern.py - part of autospec
# Copyright (C) 2015 Intel Corporation
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#
# Deduce and emit the patterns for %build
#
default_pattern = "make"
pattern_strength = 0
sources = {"unit": [], "gcov": [], "tmpfile": [], "archive": []}
source_index = {}
archive_details = {}
def set_build_pattern(pattern, strength):
"""Set the global default pattern and pattern strength"""
global default_pattern
global pattern_strength
if strength <= pattern_strength:
return
default_pattern = pattern
pattern_strength = strength
def load_specfile(specfile):
"""Load specfile object with relevant data"""
specfile.sources = sources
specfile.default_pattern = default_pattern
specfile.archive_details = archive_details