Example #1
0
class SuiteManagerDoc(BaseDocument):
    def __init__(self, app, **atts):
        BaseDocument.__init__(self, app, **atts)
        self.cursor = SuiteCursor(self.conn)

    def set_suite(self, suite):
        self.suite = suite
        self.cursor.set_suite(suite)
        self.clear_body()
        attributes = dict(bgcolor='IndianRed', width='100%')
        title = SimpleTitleElement('Suite:  %s' % suite, **attributes)
        title.cell.attributes['align'] = 'center'
        self.body.append(title)
        apt_rows = self.cursor.get_apt_rows()
        if len(apt_rows):
            aptsrc_table = Table(bgcolor='khaki')
            self.body.append(aptsrc_table)
            fields = ['apt_id', 'uri', 'dist', 'sections', 'local_path']
            headrow = TableRow()
            for field in fields:
                headrow.append(TableCell(Bold(field)))
            for row in apt_rows:
                tblrow = TableRow()
                aptsrc_table.append(tblrow)
                for field in fields:
                    tblrow.append(TableCell(row[field]))
Example #2
0
class SuiteManagerDoc(BaseDocument):
    def __init__(self, app, **atts):
        BaseDocument.__init__(self, app, **atts)
        self.cursor = SuiteCursor(self.conn)
        
        

    def set_suite(self, suite):
        self.suite = suite
        self.cursor.set_suite(suite)
        self.clear_body()
        attributes = dict(bgcolor='IndianRed', width='100%')
        title = SimpleTitleElement('Suite:  %s' % suite, **attributes)
        title.cell.attributes['align'] = 'center'
        self.body.append(title)
        apt_rows = self.cursor.get_apt_rows()
        if len(apt_rows):
            aptsrc_table = Table(bgcolor='khaki')
            self.body.append(aptsrc_table)
            fields = ['apt_id', 'uri', 'dist', 'sections', 'local_path']
            headrow = TableRow()
            for field in fields:
                headrow.append(TableCell(Bold(field)))
            for row in apt_rows:
                tblrow = TableRow()
                aptsrc_table.append(tblrow)
                for field in fields:
                    tblrow.append(TableCell(row[field]))
Example #3
0
def make_sources_list_common(conn, target, suite, installer=False):
    defenv = DefaultEnvironment(conn)
    suitecursor = SuiteCursor(conn)
    apt_rows = suitecursor.get_apt_rows(suite)
    if installer:
        # while installing use sources from local mirror
        uri = defenv.get('installer', 'http_mirror')
    else:
        # otherwise use official sources list
        uri = None
    apt_lines = make_sources_list_lines(apt_rows, uri=uri, installer=installer)
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    for line in apt_lines:
        sources_list.write('%s\n' % line)
    sources_list.write('\n')
    sources_list.close()
def make_sources_list_common(conn, target, suite, installer=False):
    defenv = DefaultEnvironment(conn)
    suitecursor = SuiteCursor(conn)
    apt_rows = suitecursor.get_apt_rows(suite)
    if installer:
        # while installing use sources from local mirror
        uri = defenv.get('installer', 'http_mirror')
    else:
        # otherwise use official sources list
        uri = None
    apt_lines = make_sources_list_lines(apt_rows, uri=uri, installer=installer)
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    for line in apt_lines:
        sources_list.write('%s\n' % line)
    sources_list.write('\n')
    sources_list.close()
Example #5
0
    if installer:
        # while installing use sources from local mirror
        uri = defenv.get('installer', 'http_mirror')
    else:
        # otherwise use official sources list
        uri = None
    apt_lines = make_sources_list_lines(apt_rows, uri=uri, installer=installer)
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    for line in apt_lines:
        sources_list.write('%s\n' % line)
    sources_list.write('\n')
    sources_list.close()


def make_sources_list(conn, target, suite):
    make_sources_list_common(conn, target, suite, installer=True)


def make_official_sources_list(conn, target, suite):
    make_sources_list_common(conn, target, suite)


if __name__ == '__main__':
    from paella.db import PaellaConnection
    conn = PaellaConnection()
    cursor = SuiteCursor(conn)
    rows = cursor.get_apt_rows('desksarge')
    msll = make_sources_list_lines
    suitecursor = SuiteCursor(conn)
    apt_rows = suitecursor.get_apt_rows(suite)
    if installer:
        # while installing use sources from local mirror
        uri = defenv.get('installer', 'http_mirror')
    else:
        # otherwise use official sources list
        uri = None
    apt_lines = make_sources_list_lines(apt_rows, uri=uri, installer=installer)
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    for line in apt_lines:
        sources_list.write('%s\n' % line)
    sources_list.write('\n')
    sources_list.close()

def make_sources_list(conn, target, suite):
    make_sources_list_common(conn, target, suite, installer=True)

def make_official_sources_list(conn, target, suite):
    make_sources_list_common(conn, target, suite)

if __name__ == '__main__':
    from paella.db import PaellaConnection
    conn = PaellaConnection()
    cursor = SuiteCursor(conn)
    rows = cursor.get_apt_rows('desksarge')
    msll = make_sources_list_lines