# Checks based on the Sources files
components = get_component_names(session)
for component in components:
- filename = "%s/dists/%s/%s/source/Sources.gz" % (cnf["Dir::Root"], suite_name, component)
+ filename = "%s/dists/%s/%s/source/Sources.gz" % (suite.archive.path, suite_name, component)
# apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
(fd, temp_filename) = utils.temp_filename()
(result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
for architecture in architectures:
if component == 'main/debian-installer' and re.match("kfreebsd", architecture):
continue
- filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (cnf["Dir::Root"], suite_name, component, architecture)
+ filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (suite.archive.path, suite_name, component, architecture)
# apt_pkg.ParseTagFile needs a real file handle
(fd, temp_filename) = utils.temp_filename()
(result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
overridesuite_id = suite.get_overridesuite().suite_id
- writer = SourcesFileWriter(suite=suite.suite_name, component=component.component_name)
+ writer = SourcesFileWriter(archive=suite.archive.path, suite=suite.suite_name, component=component.component_name)
output = writer.open()
# run query and write Sources
if include_long_description:
metadata_skip.append("Description-md5")
- writer = PackagesFileWriter(suite=suite.suite_name, component=component.component_name,
+ writer = PackagesFileWriter(archive=suite.archive.path, suite=suite.suite_name,
+ component=component.component_name,
architecture=architecture.arch_string, debtype=type_name)
output = writer.open()
suite = session.query(Suite).get(suite_id)
component = session.query(Component).get(component_id)
- writer = TranslationFileWriter(suite=suite.suite_name, component=component.component_name, language="en")
+ writer = TranslationFileWriter(archive=suite.archive.path, suite=suite.suite_name, component=component.component_name, language="en")
output = writer.open()
r = session.execute(_translations_query, {"suite": suite_id, "component": component_id})
cnf = Config()
- suite_suffix = "%s" % (cnf.find("Dinstall::SuiteSuffix"))
+ suite_suffix = cnf.find("Dinstall::SuiteSuffix", "")
- outfile = os.path.join(cnf["Dir::Root"], 'dists', "%s/%s" % (suite.suite_name, suite_suffix), "Release")
+ outfile = os.path.join(suite.archive.path, 'dists', suite.suite_name, suite_suffix, "Release")
out = open(outfile + ".new", "w")
for key, dbfield in attribs:
out.write("Description: %s\n" % suite.description)
for comp in components:
- for dirpath, dirnames, filenames in os.walk("%sdists/%s/%s%s" % (cnf["Dir::Root"], suite.suite_name, suite_suffix, comp), topdown=True):
+ for dirpath, dirnames, filenames in os.walk(os.path.join(suite.archive.path, "dists", suite.suite_name, suite_suffix, comp), topdown=True):
if not re_gensubrelease.match(dirpath):
continue
# their checksums to the main Release file
oldcwd = os.getcwd()
- os.chdir("%sdists/%s/%s" % (cnf["Dir::Root"], suite.suite_name, suite_suffix))
+ os.chdir(os.path.join(suite.archive.path, "dists", suite.suite_name, suite_suffix))
hashfuncs = { 'MD5Sum' : apt_pkg.md5sum,
'SHA1' : apt_pkg.sha1sum,
# Process dists directories
# TODO: Store location of each suite in database
for suite in session.query(Suite):
- suite_dir = os.path.join( Cnf['Dir::Root'], 'dists', "%s/%s" % (suite.suite_name, suite_suffix) )
+ suite_dir = os.path.join(suite.archive.path, 'dists', suite.suite_name, suite_suffix)
# TODO: Store valid suite/component mappings in database
for component in session.query(Component):
"""
sys.exit(exit_code)
-def check_override_compliance(package, priority, suite_name, cnf, session):
+def check_override_compliance(package, priority, archive_path, suite_name, cnf, session):
print "Checking compliance with related overrides..."
depends = set()
arches -= set(["source", "all"])
for arch in arches:
for component in components:
- Packages = utils.get_packages_from_ftp(cnf['Dir::Root'], suite_name, component, arch)
+ Packages = utils.get_packages_from_ftp(archive_path, suite_name, component, arch)
while Packages.Step():
package_name = Packages.Section.Find("Package")
dep_list = Packages.Section.Find("Depends")
if arguments and len(arguments) > 2:
utils.fubar("Too many arguments")
+ suite = get_suite(suite_name, session)
+ if suite is None:
+ utils.fubar("Unknown suite '{0}'".format(suite_name))
+
if arguments and len(arguments) == 1:
# Determine if the argument is a priority or a section...
arg = arguments.pop()
utils.fubar("Trying to change priority of a source-only package")
if Options["Check"] and newpriority != oldpriority:
- check_override_compliance(package, p, suite_name, cnf, session)
+ check_override_compliance(package, p, suite.archive.path, suite_name, cnf, session)
# If we're in no-action mode
if Options["No-Action"]:
depends = {}
session = DBConn().session()
suite_name = Options['suite']
+ suite = get_suite(suite_name, session)
+ if suite is None:
+ utils.fubar("Unknown suite '{0}'".format(suite_name))
components = get_component_names(session)
arches = set([x.arch_string for x in get_suite_architectures(suite_name)])
arches -= set(['source', 'all'])
for arch in arches:
for component in components:
- Packages = utils.get_packages_from_ftp(cnf['Dir::Root'], suite_name, component, arch)
+ Packages = utils.get_packages_from_ftp(suite.archive.path, suite_name, component, arch)
while Packages.Step():
package = Packages.Section.Find('Package')
dep_list = Packages.Section.Find('Depends')
Returns a writer object.
'''
values = {
+ 'archive': self.suite.archive.path,
'suite': self.suite.suite_name,
'component': self.component.component_name,
'debtype': self.overridetype.overridetype,
Returns a writer object.
'''
values = {
+ 'archive': self.suite.archive.path,
'suite': self.suite.suite_name,
'component': self.component.component_name
}
self.uncompressed = 'none' in compression
self.gzip = 'gzip' in compression
self.bzip2 = 'bzip2' in compression
- root_dir = Config()['Dir::Root']
- relative_dir = template % keywords
- self.path = os.path.join(root_dir, relative_dir)
+ self.path = template % keywords
def open(self):
'''
}
flags.update(keywords)
if flags['debtype'] == 'deb':
- template = "dists/%(suite)s/%(component)s/Contents-%(architecture)s"
+ template = "%(archive)s/dists/%(suite)s/%(component)s/Contents-%(architecture)s"
else: # udeb
- template = "dists/%(suite)s/%(component)s/Contents-udeb-%(architecture)s"
+ template = "%(archive)s/dists/%(suite)s/%(component)s/Contents-udeb-%(architecture)s"
BaseFileWriter.__init__(self, template, **flags)
class SourceContentsFileWriter(BaseFileWriter):
'compression': ['gzip'],
}
flags.update(keywords)
- template = "dists/%(suite)s/%(component)s/Contents-source"
+ template = "%(archive)s/dists/%(suite)s/%(component)s/Contents-source"
BaseFileWriter.__init__(self, template, **flags)
class PackagesFileWriter(BaseFileWriter):
}
flags.update(keywords)
if flags['debtype'] == 'deb':
- template = "dists/%(suite)s/%(component)s/binary-%(architecture)s/Packages"
+ template = "%(archive)s/dists/%(suite)s/%(component)s/binary-%(architecture)s/Packages"
else: # udeb
- template = "dists/%(suite)s/%(component)s/debian-installer/binary-%(architecture)s/Packages"
+ template = "%(archive)s/dists/%(suite)s/%(component)s/debian-installer/binary-%(architecture)s/Packages"
BaseFileWriter.__init__(self, template, **flags)
class SourcesFileWriter(BaseFileWriter):
'compression': ['gzip', 'bzip2'],
}
flags.update(keywords)
- template = "dists/%(suite)s/%(component)s/source/Sources"
+ template = "%(archive)s/dists/%(suite)s/%(component)s/source/Sources"
BaseFileWriter.__init__(self, template, **flags)
class TranslationFileWriter(BaseFileWriter):
'language': 'en',
}
flags.update(keywords)
- template = "dists/%(suite)s/%(component)s/i18n/Translation-%(language)s"
+ template = "%(archive)s/dists/%(suite)s/%(component)s/i18n/Translation-%(language)s"
super(TranslationFileWriter, self).__init__(template, **flags)