Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
    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)
Exemple #4
0
    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)
Exemple #5
0
    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)
Exemple #6
0
    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):
        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)
Exemple #8
0
    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)
Exemple #9
0
    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)
Exemple #10
0
    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)
Exemple #11
0
    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)
Exemple #12
0
 def add(self, line):
     line = self._complete_cleanup(line)
     line = self._cleanup_setup(line)
     line = self._prepare_patch(line)
     Section.add(self, line)
Exemple #13
0
 def add(self, line):
     # only add the first line (%changelog)
     if len(self.lines) == 0:
         Section.add(self, "%changelog")
Exemple #14
0
 def add(self, line):
     line = self._complete_cleanup(line)
     line = self._cleanup_setup(line)
     line = self._prepare_patch(line)
     Section.add(self, line)
Exemple #15
0
 def add(self, line):
     # only add the first line (%changelog)
     if len(self.lines) == 0:
         Section.add(self, "%changelog")