Specfile module¶
-
class
rebasehelper.specfile.PatchObject(path, index, option)[source]¶ Class represents set of information about patches
-
git_generated= ''¶
-
index= ''¶
-
option= ''¶
-
path= ''¶
-
-
class
rebasehelper.specfile.SpecFile(path, changelog_entry, sources_location='', download=True)[source]¶ Class representing a SPEC file
-
category= None¶
-
static
construct_string_with_comment(lines)[source]¶ Wraps the line in a rebase-helper specific comments
Parameters: lines – line (or list of lines) to be wrapped Returns: list with lines
-
copy(new_path=None)[source]¶ Create a copy of the current object and copy the SPEC file the new object represents to a new location.
Parameters: new_path – new path to which to copy the SPEC file Returns: copy of the current object
-
defined_sections= ['%package', '%description', '%prep', '%build', '%install', '%check', '%files', '%changelog']¶
-
download= False¶
-
download_remote_sources()[source]¶ Method that iterates over all sources and downloads ones, which contain URL instead of just a file.
Returns: None
-
extra_version= None¶
-
static
extract_version_from_archive_name(archive_path, source_string='')[source]¶ Method extracts the version from archive name based on the source string from SPEC file. It extracts also an extra version such as ‘b1’, ‘rc1’, …
Parameters: - archive_path – archive name or path with archive name from which to extract the version
- source_string – Source string from SPEC file used to construct version extraction regex
Returns: tuple of strings with (extracted version, extra version) or (None, None) if extraction failed
-
find_archive_target_in_prep(archive)[source]¶ Tries to find a command that is used to extract the specified archive and attempts to determine target path from it. ‘tar’ and ‘unzip’ commands are supported so far.
Parameters: archive – Path to archive Returns: Target path relative to builddir or None if not determined
-
get_applied_patches()[source]¶ Method returns list of all applied patches.
Returns: list of PatchObject
-
get_archive()[source]¶ Method returns the basename of first Source in SPEC file a.k.a. Source0
Returns: basename of first Source in SPEC file Return type: str
-
get_extra_version()[source]¶ Returns an extra version of the package - like b1, rc2, …
Returns: String
-
get_extra_version_separator()[source]¶ Returns the separator between version and extra version as used by upstream. If there is not separator or extra version, it returns an empty string.
Returns: String with the separator between version as extra version as used by upstream. Return type: str
-
get_full_version()[source]¶ Returns the full version string, which is a combination of version, separator and extra version.
Returns: String with full version, including the extra version part. Return type: str
-
get_not_used_patches()[source]¶ Method returns list of all unpplied patches.
Returns: list of PatchObject
-
get_patch_option(line)[source]¶ Function returns a patch options
Parameters: line – Returns: patch options like -p1
-
get_patches()[source]¶ Method returns list of all applied and not applied patches
Returns: list of PatchObject
-
static
get_paths_with_rpm_macros(files)[source]¶ Method modifies paths in passed list to use RPM macros
Parameters: files – list of absolute paths Returns: modified list of paths with RPM macros
-
get_sources()[source]¶ Method returns dictionary with local sources list.
Returns: list of Sources with absolute path Return type: list of str
-
get_spec_section(section_name)[source]¶ Returns the section of selected name
Parameters: section_name – section name to get Returns: list of lines contained in the selected section
-
hdr= None¶
-
is_test_suite_enabled()[source]¶ Returns whether test suite is enabled during the build time
Returns: True if enabled or False if not
-
modify_spec_files_section(files)[source]¶ Function repairs spec file according to new sources.
Parameters: files – Returns:
-
patches= None¶
-
path= ''¶
-
prep_section= []¶
-
redefine_release_with_macro(macro)[source]¶ Method redefines the Release: line to include passed macro and comments out the old line
Parameters: macro – Returns:
-
removed_patches= []¶
-
revert_redefine_release_with_macro(macro)[source]¶ Method removes the redefined the Release: line with given macro and uncomments the old Release line.
Parameters: macro – Returns:
-
rpm_sections= {}¶
-
set_extra_version(extra_version)[source]¶ Method to update the extra version in the SPEC file. Redefined Source0 if needed and also changes Release accordingly.
Parameters: extra_version – the extra version string, if any (e.g. ‘b1’, ‘rc2’, …) Returns: None
-
set_extra_version_separator(separator)[source]¶ Set the string that separates the version and extra version
Parameters: separator – Returns:
-
set_spec_section(section_name, new_section)[source]¶ Returns the section of selected name
Parameters: section_name – section name to get Returns: list of lines contained in the selected section
-
set_tag(tag, value, preserve_macros=False)[source]¶ Sets value of a tag while trying to preserve macros if requested
-
set_version(version)[source]¶ Method to update the version in the SPEC file
Parameters: version – string with new version Returns: None
-
set_version_using_archive(archive_path)[source]¶ Method to update the version in the SPEC file using a archive path. The version is extracted from the archive name.
Parameters: archive_path – Returns:
-
sources= None¶
-
spc= None¶
-
spec_content= []¶
-
static
split_version_string(version_string='')[source]¶ Method splits version string into version and possibly extra string as ‘rc1’ or ‘b1’, …
Parameters: version_string – version string such as ‘1.1.1’ or ‘1.2.3b1’, … Returns: tuple of strings with (extracted version, extra version, separator) or (None, None, None) if extraction failed
-