コード例 #1
0
    def rsspkg(self, pkg, url):
        """takes a pkg object and repourl for the pkg object"""

        rfc822_format = "%a, %d %b %Y %X GMT"
        clog_format = "%a, %d %b %Y GMT"
        escape = self.xmlescape

        item = self.rssnode.newChild(None, 'item', None)
        title = escape(str(pkg))
        item.newChild(None, 'title', title)
        date = time.gmtime(float(pkg.returnSimple('buildtime')))
        item.newChild(None, 'pubDate', time.strftime(rfc822_format, date))
        item.newChild(None, 'guid',
                      pkg.returnSimple('id')).setProp("isPermaLink", "false")
        link = url + '/' + pkg.returnSimple('relativepath')
        item.newChild(None, 'link', escape(link))

        # build up changelog
        changelog = ''
        cnt = 0
        if (pkg.changelog != None):
            where = pkg.changelog
        else:
            where = pkg.returnChangelog()
        for e in where:
            cnt += 1
            if cnt > 3:
                changelog += '...'
                break
            (date, author, desc) = e
            date = time.strftime(clog_format, time.gmtime(float(date)))
            changelog += '%s - %s\n%s\n\n' % (date, author, desc)
        description = '<p><strong>%s</strong> - %s</p>\n\n' % (escape(
            pkg.name), escape(pkg.returnSimple('summary')))
        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(
            to_unicode(
                pkg.returnSimple('description')).encode('utf-8').replace(
                    "\n", "<br />\n"))
        description += escape('<pre>%s</pre>' %
                              escape(to_unicode(changelog).encode('utf-8')))
        item.newChild(None, 'description', description)

        return item
コード例 #2
0
ファイル: repo-rss.py プロジェクト: balagopalraj/clearlinux
 def rsspkg(self, pkg, url):
     """takes a pkg object and repourl for the pkg object"""
     
     rfc822_format = "%a, %d %b %Y %X GMT"
     clog_format = "%a, %d %b %Y GMT"
     escape = self.xmlescape
     
     item = self.rssnode.newChild(None, 'item', None)
     title = escape(str(pkg))
     item.newChild(None, 'title', title)
     date = time.gmtime(float(pkg.returnSimple('buildtime')))
     item.newChild(None, 'pubDate', time.strftime(rfc822_format, date))
     item.newChild(None, 'guid', pkg.returnSimple('id')).setProp("isPermaLink", "false")        
     link = url + '/' + pkg.returnSimple('relativepath')
     item.newChild(None, 'link', escape(link))
 
     # build up changelog
     changelog = ''
     cnt = 0
     if (pkg.changelog != None):
         where = pkg.changelog
     else:
         where = pkg.returnChangelog()
     for e in where:
         cnt += 1
         if cnt > 3: 
             changelog += '...'
             break
         (date, author, desc) = e
         date = time.strftime(clog_format, time.gmtime(float(date)))
         changelog += '%s - %s\n%s\n\n' % (date, author, desc)
     description = '<p><strong>%s</strong> - %s</p>\n\n' % (escape(pkg.name), 
                                         escape(pkg.returnSimple('summary')))
     description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(pkg.returnSimple('description').encode('utf-8').replace("\n", "<br />\n"))
     description += escape('<pre>%s</pre>' % escape(to_unicode(changelog).encode('utf-8')))
     item.newChild(None, 'description', description)
     
     return item
コード例 #3
0
            if len(oldlogs):
                #  Don't sort as that can screw the order up when time is the
                # same.
                oldtime    = oldlogs[0][0]
                oldauth    = oldlogs[0][1]
                oldcontent = oldlogs[0][2]
                for (t, author, content) in  pkg.changelog:
                    if t < oldtime:
                        break
                    if ((t == oldtime) and (author == oldauth) and 
                        (content == oldcontent)):
                        break

                    tm = datetime.date.fromtimestamp(int(t))
                    tm = tm.strftime("%a %b %d %Y")
                    msg += "* %s %s\n%s\n\n" % (tm, to_unicode(author),
                                                to_unicode(content))
                    commits += 1
                    

            if size:
                sizechange = int(pkg.size) - int(oldpkg.size)
                total_sizechange += sizechange
                msg += "\nSize Change: %s bytes\n" % sizechange

            if msg == header:
                rebuilt = rebuilt + 1
                if  rebuilds:
                    msg += "\n* Package rebuilt due to dependencies\n"
                    report.append(msg)
            else:
コード例 #4
0
            if len(oldlogs):
                #  Don't sort as that can screw the order up when time is the
                # same.
                oldtime = oldlogs[0][0]
                oldauth = oldlogs[0][1]
                oldcontent = oldlogs[0][2]
                for (t, author, content) in pkg.changelog:
                    if t < oldtime:
                        break
                    if ((t == oldtime) and (author == oldauth)
                            and (content == oldcontent)):
                        break

                    tm = datetime.date.fromtimestamp(int(t))
                    tm = tm.strftime("%a %b %d %Y")
                    msg += "* %s %s\n%s\n\n" % (tm, to_unicode(author),
                                                to_unicode(content))
                    commits += 1

            if size:
                sizechange = int(pkg.size) - int(oldpkg.size)
                total_sizechange += sizechange
                msg += "\nSize Change: %s bytes\n" % sizechange

            if msg == header:
                rebuilt = rebuilt + 1
                if rebuilds:
                    msg += "\n* Package rebuilt due to dependencies\n"
                    report.append(msg)
            else:
                report.append(msg)