Package gbp :: Package rpm :: Class SpecFile

[hide private]
[frames] | no frames]

# Class SpecFile

    object --+
             |
            SpecFile

Class for parsing/modifying spec files

Instance Methods | [hide private]

__init__(self, filename=None, filedata=None) x.__init__(...) initializes x; see help(type(x)) for signature |

_parse_filtered_spec(self, skip_tags) Parse a filtered spec file in rpm-python |

_patches(self) Get all patch tags as a dict |

_sources(self) Get all source tags as a dict |

sources(self) Get all source tags as a dict |

_macro_replace(self, matchobj) |

`str`

macro_expand(self, text) Expand the rpm macros (that gbp knows of) in the given text. |

write_spec_file(self) Write, possibly updated, spec to disk |

_parse_tag(self, lineobj) Parse tag line |

_parse_directive(self, lineobj) Parse special directive/scriptlet/macro lines |

_parse_gbp_tag(self, linenum, lineobj) Parse special git-buildpackage tags |

_parse_content(self) Go through spec file content line-by-line and (re-)parse info from it |

_delete_tag(self, tag, num) Delete a tag |

_set_tag(self, tag, num, value, insertafter) Set a tag value |

set_tag(self, tag, num, value, insertafter=None) Update a tag in spec file content |

_delete_special_macro(self, name, identifier) Delete a special macro line in spec file content |

_set_special_macro(self, name, identifier, args, insertafter) Update a special macro line in spec file content |

_set_section(self, name, text) Update/create a complete section in spec file. |

set_changelog(self, text) Update or create the %changelog section |

get_changelog(self) Get the %changelog section |

update_patches(self, patches, commands) Update spec with new patch tags and patch macros |

patchseries(self, unapplied=False, ignored=False) Return non-ignored patches of the RPM as a gbp patchseries |

_guess_orig_prefix(self, orig) Guess prefix for the orig file |

_guess_orig_file(self) Try to guess the name of the primary upstream/source archive. |

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods | [hide private]

_patch_macro_opts(args) Parse arguments of the '%patch' macro |

_setup_macro_opts(args) Parse arguments of the '%setup' macro |

Class Variables | [hide private]

| tag_re = `re.compile(r'`(?i)`^`(?P<``name``>``[`a`-`z`]``+``)``(?P<``num``>``[`0`-`9`]``+``)``?`\s`*``...``
| directive_re = `re.compile(r'`(?i)`^%`(?P<``name``>``[`a`-`z`]``+``)``(?P<``num``>``[`0`-`9`...``
| gbptag_re = `re.compile(r'`(?i)`^\s`*`#\s`*`gbp-`(?P<``name``>``[`a`-`z-`]``+``)``(`\s`*``...``
| section_identifiers = ``(``'``package``'``,` `'``description``'``,` `'``prep``'``,` `'``buil``...``

Properties | [hide private]

| version Get the (downstream) version
| specpath Get the dir/filename
| ignorepatches Get numbers of ignored patches as a sorted list
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, filename=None, filedata=None)
(Constructor)

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### macro_expand(self, text)

Expand the rpm macros (that gbp knows of) in the given text.

Parameters:
  - `text` (`str`) - text to check for macros
Returns: `str`
  text with macros expanded

### _guess_orig_file(self)

Try to guess the name of the primary upstream/source archive. Returns a dict with all the relevant information.

Class Variable Details | [hide private]

### tag_re

Value:

      re.compile(r'(?i)^(?P<name>[a-z]+)(?P<num>[0-9]+)?\s*:\s*(?P<value>\S(
      .*\S)?)\s*$')

### directive_re

Value:

      re.compile(r'(?i)^%(?P<name>[a-z]+)(?P<num>[0-9]+)?(\s+(?P<args>.*))?$
      ')

### gbptag_re

Value:

      re.compile(r'(?i)^\s*#\s*gbp-(?P<name>[a-z-]+)(\s*:\s*(?P<args>\S.*))?
      $')

### section_identifiers

Value:

      ('package',
       'description',
       'prep',
       'build',
       'install',
       'clean',
       'check',
       'pre',
      ...

Property Details | [hide private]

### version

Get the (downstream) version

Get Method:
  unreachable.version(self) - Get the (downstream) version

### specpath

Get the dir/filename

Get Method:
  unreachable.specpath(self) - Get the dir/filename

### ignorepatches

Get numbers of ignored patches as a sorted list

Get Method:
  unreachable.ignorepatches(self) - Get numbers of ignored patches as a sorted list