示例#1
0
def _make_repsource(full_uri, dist, sections):
    source = RepositorySource()
    source.uri = full_uri
    if sections == '/' and dist.endswith('/'):
        source.sections = []
    else:
        source.sections = [s.strip() for s in sections.split()]
    source.suite = dist
    return source
示例#2
0
def make_sources_list(cfg, target, suite):
    section = 'debrepos'
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    source = RepositorySource()
    source.uri = cfg.get(section, 'http_mirror')
    source.suite = suite
    source.set_path()
    sources_list.write(str(source) + '\n')
    source.type = 'deb-src'
    sources_list.write(str(source) + '\n')
    source.type = 'deb'
    if suite == 'woody' or cfg.has_option(section, '%s_nonus' % suite):
        source.suite += '/non-US'
        sources_list.write(str(source) + '\n')
        source.type = 'deb-src'
        sources_list.write(str(source) + '\n')
    loption = suite + '_local'
    if cfg.has_option(section, loption) and cfg[loption] == 'true':
        sources_list.write('deb %s/local %s/\n' % (source.uri, suite))
        sources_list.write('deb-src %s/local %s/\n' % (source.uri, suite))
    coption = suite + '_common'
    if cfg.has_option(section, coption) and cfg[coption] == 'true':
        sources_list.write('deb %s/local common/\n' % source.uri)
        sources_list.write('deb-src %s/local common/\n' % source.uri)
    sources_list.write('\n')
    sources_list.close()
示例#3
0
def make_sources_list(cfg, target, suite):
    section = 'debrepos'
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    source = RepositorySource()
    source.uri = cfg.get(section, 'http_mirror')
    source.suite = suite
    source.set_path()
    sources_list.write(str(source) +'\n')
    source.type = 'deb-src'
    sources_list.write(str(source) +'\n')
    source.type = 'deb'
    if suite == 'woody' or cfg.has_option(section, '%s_nonus' % suite):
        source.suite += '/non-US'
        sources_list.write(str(source) +'\n')
        source.type = 'deb-src'
        sources_list.write(str(source) +'\n')
    loption = suite + '_local'
    if cfg.has_option(section, loption) and cfg[loption] == 'true':
        sources_list.write('deb %s/local %s/\n' % (source.uri, suite))
        sources_list.write('deb-src %s/local %s/\n' % (source.uri, suite))
    coption = suite + '_common'
    if cfg.has_option(section, coption) and cfg[coption] == 'true':
        sources_list.write('deb %s/local common/\n' % source.uri)
        sources_list.write('deb-src %s/local common/\n' % source.uri)
    sources_list.write('\n')
    sources_list.close()
示例#4
0
def make_sources_list(cfg, target, suite):
    section = 'debrepos'
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    source = RepositorySource()
    source.uri = cfg.get('installer', 'http_mirror')
    source.suite = suite
    source.set_path()
    sources_list.write(str(source) +'\n')
    source.type = 'deb-src'
    sources_list.write(str(source) +'\n')
    source.type = 'deb'
    if suite == 'woody' or cfg.has_option(section, '%s_nonus' % suite):
        source.suite += '/non-US'
        sources_list.write(str(source) +'\n')
        source.type = 'deb-src'
        sources_list.write(str(source) +'\n')
    loption = suite + '_local'
    if _is_option_true(cfg, section, loption):
        sources_list.write('deb %s/local %s/\n' % (source.uri, suite))
        sources_list.write('deb-src %s/local %s/\n' % (source.uri, suite))
    coption = suite + '_common'
    if _is_option_true(cfg, section, coption):
        sources_list.write('deb %s/local common/\n' % source.uri)
        sources_list.write('deb-src %s/local common/\n' % source.uri)
    secopt = suite + '_updates'
    if _is_option_true(cfg, section, secopt):
        sline = ['deb', source.uri, '%s/updates' % suite, 'main contrib non-free']
        sources_list.write(' '.join(sline) + '\n')
        sline[0] = 'deb-src'
        sources_list.write(' '.join(sline) + '\n')
    sources_list.write('\n')
    sources_list.close()
示例#5
0
 def _make_repository_source(self, apt_id, uri=None):
     row = self.cursor.select_row(table='apt_sources',
                                  clause=Eq('apt_id', apt_id))
     if uri is None:
         uri = row.uri
     src = 'deb %s %s' % (uri, row.dist)
     if not row.dist.endswith('/'):
         src = '%s %s' % (src, row.sections)
     r = RepositorySource(src)
     return r
示例#6
0
 def _row2repsource(self, row, http_mirror):
     lp = row.local_path
     while lp[0] == '/':
         lp = lp[1:]
     uri = os.path.join(http_mirror, lp)
     suite = row.dist
     src = 'deb %s %s' % (uri, suite)
     if not suite.endswith('/'):
         src = '%s %s' % (src, row.sections)
     r = RepositorySource(src)
     return r
示例#7
0
 def make_sources_list(self):
     section = self.cfg.section
     self.cfg.change('repos')
     aptdir = join(self.target, 'etc', 'apt')
     makepaths(aptdir)
     sources_list = file(join(aptdir, 'sources.list'), 'w')
     source = RepositorySource()
     source.uri = self.cfg['local_http']
     suite = self.options['paellasuite'].value
     source.suite = suite
     source.set_path()
     sources_list.write(str(source) + '\n')
     source.type = 'deb-src'
     sources_list.write(str(source) + '\n')
     source.type = 'deb'
     if suite == 'woody':
         source.suite = 'woody/non-US'
         sources_list.write(str(source) + '\n')
         source.type = 'deb-src'
         sources_list.write(str(source) + '\n')
     sources_list.close()
     self.cfg.change(section)
示例#8
0
def _make_repsource(full_uri, dist, sections):
    source = RepositorySource()
    source.uri = full_uri
    if sections == '/' and dist.endswith('/'):
        source.sections = []
    else:
        source.sections = [s.strip() for s in sections.split()]
    source.suite = dist
    return source
示例#9
0
def make_sources_list(cfg, target, suite):
    section = 'debrepos'
    aptdir = os.path.join(target, 'etc', 'apt')
    makepaths(aptdir)
    sources_list = file(os.path.join(aptdir, 'sources.list'), 'w')
    source = RepositorySource()
    source.uri = cfg.get('installer', 'http_mirror')
    source.suite = suite
    source.set_path()
    sources_list.write(str(source) + '\n')
    source.type = 'deb-src'
    sources_list.write(str(source) + '\n')
    source.type = 'deb'
    if suite == 'woody' or cfg.has_option(section, '%s_nonus' % suite):
        source.suite += '/non-US'
        sources_list.write(str(source) + '\n')
        source.type = 'deb-src'
        sources_list.write(str(source) + '\n')
    loption = suite + '_local'
    if _is_option_true(cfg, section, loption):
        sources_list.write('deb %s/local %s/\n' % (source.uri, suite))
        sources_list.write('deb-src %s/local %s/\n' % (source.uri, suite))
    coption = suite + '_common'
    if _is_option_true(cfg, section, coption):
        sources_list.write('deb %s/local common/\n' % source.uri)
        sources_list.write('deb-src %s/local common/\n' % source.uri)
    secopt = suite + '_updates'
    if _is_option_true(cfg, section, secopt):
        sline = [
            'deb', source.uri,
            '%s/updates' % suite, 'main contrib non-free'
        ]
        sources_list.write(' '.join(sline) + '\n')
        sline[0] = 'deb-src'
        sources_list.write(' '.join(sline) + '\n')
    sources_list.write('\n')
    sources_list.close()