provides some rpm source package related helpers
Class | NoSpecError | Spec file parsing error |
Class | MacroExpandError | Macro expansion in spec file failed |
Class | RpmUpstreamSource | Upstream source class for RPM packages |
Class | SrcRpmFile | Keeps all needed data read from a source rpm |
Class | SpecFile | Class for parsing/modifying spec files |
Function | parse_srpm | parse srpm by creating a SrcRpmFile object |
Function | guess_spec_fn | Guess spec file from a list of filenames |
Function | guess_spec | Guess a spec file |
Function | guess_spec_repo | Try to find/parse the spec file from a given git treeish. |
Function | spec_from_repo | Get and parse a spec file from a give Git treeish |
Function | string_to_int | Convert string of possible unit identifier to int. |
Function | split_version_str | Parse full version string and split it into individual "version components", i.e. upstreamversion, epoch and release |
Function | compose_version_str | Compose a full version string from individual "version components", i.e. epoch, version and release |
Function | filter_version | Remove entry from the version dict |
Function | _decode | Undocumented |
Try to find/parse the spec file from a given git treeish.
Convert string of possible unit identifier to int. @param val_str: value to be converted @type val_str: C{str} @return: value as integer @rtype: C{int} >>> string_to_int("1234") 1234 >>> string_to_int("123k") 125952 >>> string_to_int("1234K") 1263616 >>> string_to_int("1M") 1048576
Parse full version string and split it into individual "version components", i.e. upstreamversion, epoch and release @param version: full version of a package @type version: C{str} @return: individual version components @rtype: C{dict} >>> sorted(split_version_str("1").items()) [('epoch', None), ('release', None), ('upstreamversion', '1')] >>> sorted(split_version_str("1.2.3-5.3").items()) [('epoch', None), ('release', '5.3'), ('upstreamversion', '1.2.3')] >>> sorted(split_version_str("3:1.2.3").items()) [('epoch', '3'), ('release', None), ('upstreamversion', '1.2.3')] >>> sorted(split_version_str("3:1-0").items()) [('epoch', '3'), ('release', '0'), ('upstreamversion', '1')]
Compose a full version string from individual "version components", i.e. epoch, version and release @param evr: dict of version components @type evr: C{dict} of C{str} @return: full version @rtype: C{str} >>> compose_version_str({'epoch': '', 'upstreamversion': '1.0'}) '1.0' >>> compose_version_str({'epoch': '2', 'upstreamversion': '1.0', 'release': None}) '2:1.0' >>> compose_version_str({'epoch': None, 'upstreamversion': '1', 'release': '0'}) '1-0' >>> compose_version_str({'epoch': '2', 'upstreamversion': '1.0', 'release': '2.3'}) '2:1.0-2.3' >>> compose_version_str({'epoch': '2', 'upstreamversion': '', 'release': '2.3'})
Remove entry from the version dict @param evr: dict of version components @type evr: C{dict} of C{str} @param keys: keys to remove @type keys: C{str}s @return: new version dict @rtype: C{dict} of C{str} >>> sorted(list(filter_version({'epoch': 'foo', 'upstreamversion': 'bar', 'vendor': 'baz'}, 'vendor').keys())) ['epoch', 'upstreamversion'] >>> list(filter_version({'epoch': 'foo', 'upstreamversion': 'bar', 'revision': 'baz'}, 'epoch', 'revision').keys()) ['upstreamversion']