def __init__(self, specfile): Section.__init__(self, specfile) self.removing_authors = False # Tracks the use of a macro. When this happens and we're still in a # description, we actually don't know where we are so we just put all # the following lines blindly, without trying to fix anything. self.unknown_line = False
def output(self, fout): self._add_pkg_header() self._add_copyright() self._add_default_license() self._add_buildrules() # trailing enter self.lines.append("") Section.output(self, fout)
def output(self, fout): self._add_pkg_header() self._add_copyright() self._add_default_license() self._add_buildrules() # trailing enters # prep_spec does two so do the same self.lines.append('') self.lines.append('') Section.output(self, fout)
def output(self, fout, newline = True): self._add_pkg_header() self._add_copyright() self._add_default_license() self._add_buildrules() # trailing enters # prep_spec does two so do the same self.lines.append('') self.lines.append('') Section.output(self, fout, newline)
def output(self, fout): # if we have 2 or 3 lines where last one is empty nolines = len(self.lines) if nolines == 2 or ( nolines == 3 and self.lines[2] == ''): if self.lines[1] == '/sbin/ldconfig': pkg = self.lines[0] self.lines = [] self.lines.append('{0} -p /sbin/ldconfig'.format(pkg)) self.lines.append('') Section.output(self, fout)
def output(self, fout): # if we have 2 or 3 lines where last one is empty nolines = len(self.lines) if nolines == 2 or (nolines == 3 and self.lines[2] == ''): if self.lines[1] == '/sbin/ldconfig': pkg = self.lines[0] self.lines = [] self.lines.append('{0} -p /sbin/ldconfig'.format(pkg)) self.lines.append('') Section.output(self, fout)
def add(self, line): # The first line (%package) should always be added and is different # from the lines we handle in RpmPreamble. if self.previous_line is None: Section.add(self, line) return # If the package is lang package we add here comment about the lang package if len(self.lines) == 1 and (self.previous_line.endswith(' lang') or self.previous_line.endswith('-lang')) and not line.startswith('#'): Section.add(self, '# FIXME: consider using %lang_package macro') RpmPreamble.add(self, line)
def add(self, line): # The first line (%package) should always be added and is different # from the lines we handle in RpmPreamble. if self.previous_line is None: Section.add(self, line) return # If the package is lang package we add here comment about the lang package if len(self.lines) == 1 and (self.previous_line.endswith(' lang') or self.previous_line.endswith('-lang') ) and not line.startswith('#'): Section.add(self, '# FIXME: consider using %lang_package macro') RpmPreamble.add(self, line)
def add(self, line): line = self._complete_cleanup(line) line = self.strip_useless_spaces(line) # if it is 2nd line and it is not defattr just set there some default if self.previous_line and \ self.previous_line.startswith('%files') and \ not line.startswith('%defattr'): self.lines.append('%defattr(-,root,root)') # toss out empty lines if there are more than one in succession if line == '' and ( not self.previous_line or self.previous_line == ''): return Section.add(self, line)
def add(self, line): install_command = 'make DESTDIR=%{buildroot} install %{?_smp_mflags}' line = self._complete_cleanup(line) line = self._replace_remove_la(line) # we do not want to cleanup buildroot, it is already clean if self.reg.re_clean.search(line): return # do not use install macros as we have trouble with it for now # we can convert it later on if self.reg.re_install.match(line): line = install_command Section.add(self, line)
def add(self, line): if self.previous_line != None and len(line) > 0 and line[0] == '%': self.unknown_line = True if self.removing_authors and not self.unknown_line: return if len(line) == 0: if not self.previous_line or len(self.previous_line) == 0: return if line == 'Authors:': self.removing_authors = True return Section.add(self, line)
def add(self, line): line = self._complete_cleanup(line) # smp_mflags for jobs as tests are usually able to run in parallel if not self.reg.re_comment.match(line): line = self.embrace_macros(line) line = self.reg.re_jobs.sub('%{?_smp_mflags}', line) # add jobs if we have just make call on line # if user want single thread he should specify -j1 if line.startswith('make'): # if there are no smp_flags or jobs spec just append it if line.find('%{?_smp_mflags}') == -1 and line.find('-j') == -1: line = '{0} {1}'.format(line, '%{?_smp_mflags}') Section.add(self, line)
def add(self, line): line = self._complete_cleanup(line) # smp_mflags for jobs if not self.reg.re_comment.match(line): line = self.embrace_macros(line) line = self.reg.re_jobs.sub('%{?_smp_mflags}', line) # add jobs if we have just make call on line # if user want single thread he should specify -j1 if line.startswith('make'): # if there are no smp_flags or jobs spec if line.find('%{?_smp_mflags}') == -1 and line.find('-j') == -1: # Don't append %_smp_mflags if the line ends with a backslash, # it would break the formatting if not line.endswith('\\') and not '||' in line: line = '{0} {1}'.format(line, '%{?_smp_mflags}') Section.add(self, line)
def __init__(self, specfile, pkgconfig): Section.__init__(self, specfile) # do we want pkgconfig self.pkgconfig = pkgconfig # dict of license replacement options self.license_conversions = self._read_licenses_changes() # dict of pkgconfig conversions self.pkgconfig_conversions = self._read_pkgconfig_changes() # start the object self._start_paragraph() # initialize list of groups that need to pass over conversion fixer self.categories_with_package_tokens = self.categories_with_sorted_package_tokens[:] # these packages actually need fixing after we sent the values to reorder them self.categories_with_package_tokens.append('provides_obsoletes') # simple categories matching self.category_to_re = { 'name': self.reg.re_name, 'version': self.reg.re_version, # license need fix replacment 'summary': self.reg.re_summary, 'url': self.reg.re_url, 'group': self.reg.re_group, # for source, we have a special match to keep the source number # for patch, we have a special match to keep the patch number 'buildrequires': self.reg.re_buildrequires, # for prereq we append warning comment so we don't mess it there 'requires': self.reg.re_requires, 'recommends': self.reg.re_recommends, 'suggests': self.reg.re_suggests, 'enhances': self.reg.re_enhances, 'supplements': self.reg.re_supplements, # for provides/obsoletes, we have a special case because we group them # for build root, we have a special match because we force its value 'buildarch': self.reg.re_buildarch, } # deprecated definitions that we no longer want to see self.category_to_clean = { 'vendor': self.reg.re_vendor, 'autoreqprov': self.reg.re_autoreqprov, 'epoch': self.reg.re_epoch, }
def __init__(self, specfile, pkgconfig): Section.__init__(self, specfile) # do we want pkgconfig self.pkgconfig = pkgconfig # dict of license replacement options self.license_conversions = self._read_licenses_changes() # dict of pkgconfig conversions self.pkgconfig_conversions = self._read_pkgconfig_changes() # start the object self._start_paragraph() # initialize list of groups that need to pass over conversion fixer self.categories_with_package_tokens = self.categories_with_sorted_package_tokens[:] # these packages actually need fixing after we sent the values to reorder them self.categories_with_package_tokens.append('provides_obsoletes') # simple categories matching self.category_to_re = { 'name': self.reg.re_name, 'version': self.reg.re_version, # license need fix replacment 'summary': self.reg.re_summary, 'url': self.reg.re_url, 'group': self.reg.re_group, # for source, we have a special match to keep the source number # for patch, we have a special match to keep the patch number 'buildrequires': self.reg.re_buildrequires, # for prereq we append warning comment so we don't mess it there 'requires': self.reg.re_requires, 'recommends': self.reg.re_recommends, 'suggests': self.reg.re_suggests, 'ehnances': self.reg.re_enhances, 'supplements': self.reg.re_supplements, # for provides/obsoletes, we have a special case because we group them # for build root, we have a special match because we force its value 'buildarch': self.reg.re_buildarch, } # deprecated definitions that we no longer want to see self.category_to_clean = { 'vendor': self.reg.re_vendor, 'autoreqprov': self.reg.re_autoreqprov, 'epoch': self.reg.re_epoch, }
def add(self, line): line = self._complete_cleanup(line) # smp_mflags for jobs if not self.reg.re_comment.match(line): line = self.embrace_macros(line) line = self.reg.re_jobs.sub('%{?_smp_mflags}', line) # add jobs if we have just make call on line # if user want single thread he should specify -j1 if line.startswith('make'): # if there are no smp_flags or jobs spec just append it if line.find('%{?_smp_mflags}') == -1 and line.find('-j') == -1: line = '{0} {1}'.format(line, '%{?_smp_mflags}') # if user uses cmake directly just recommend him using the macros if line.startswith('cmake'): self.lines.append('# FIXME: you should use %cmake macros') Section.add(self, line)
def add(self, line): # only add the first line (%changelog) if len(self.lines) == 0: Section.add(self, "%changelog")
def add(self, line): line = self._complete_cleanup(line) line = self._cleanup_setup(line) line = self._prepare_patch(line) Section.add(self, line)
def output(self, fout): lines = self._end_paragraph() self.lines += lines # append empty line to the end of the section self.lines.append('') Section.output(self, fout)
def output(self, fout, newline=True): lines = self._end_paragraph() self.lines += lines Section.output(self, fout, newline)