]> git.decadent.org.uk Git - dak.git/commitdiff
Use archive path instead of Dir::Root
authorAnsgar Burchardt <ansgar@debian.org>
Tue, 31 Jul 2012 17:33:06 +0000 (19:33 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Fri, 10 Aug 2012 13:56:14 +0000 (15:56 +0200)
dak/cruft_report.py
dak/generate_packages_sources2.py
dak/generate_releases.py
dak/init_dirs.py
dak/override.py
dak/override_disparity.py
daklib/contents.py
daklib/filewriter.py

index 6200aa2c67481c9b3fb84563369861e0e26f2c39..98381bc1952fd6199aa32e1ea5cf21d157216543 100755 (executable)
@@ -680,7 +680,7 @@ def main ():
     # 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))
@@ -729,7 +729,7 @@ def main ():
         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))
index f0e08654525c5debb9e2a86bc650f5c2c46de95c..34c62b0949c4e07f5b48977a114be614cb1b96e6 100755 (executable)
@@ -103,7 +103,7 @@ def generate_sources(suite_id, component_id):
 
     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
@@ -226,7 +226,8 @@ def generate_packages(suite_id, component_id, architecture_id, type_name):
     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()
 
@@ -287,7 +288,7 @@ def generate_translations(suite_id, component_id):
     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})
index 3801132db5b72298c32f2a6fdfbc51916002183b..a57c5fc22143047628dd87dd1c1d440064899c6e 100755 (executable)
@@ -145,9 +145,9 @@ class ReleaseWriter(object):
 
         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:
@@ -182,7 +182,7 @@ class ReleaseWriter(object):
             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
 
@@ -214,7 +214,7 @@ class ReleaseWriter(object):
         # 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,
index fd1407143f0c1e759f75845f59a430b0b3ae7bc7..0c63fe3ec003401bccc7796da4e00bb6aec54fea 100755 (executable)
@@ -137,7 +137,7 @@ def create_directories():
     # 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):
index a9f28322f1edfd7f74d323e9c1ee8a3ea63fe273..44fc16f412492ee86f05efdbf8e7806b6e2de2fb 100755 (executable)
@@ -56,7 +56,7 @@ Make microchanges or microqueries of the binary overrides
 """
     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()
@@ -66,7 +66,7 @@ def check_override_compliance(package, priority, suite_name, cnf, session):
     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")
@@ -140,6 +140,10 @@ def main ():
     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()
@@ -227,7 +231,7 @@ def main ():
         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"]:
index e48bd7de23a9c826f46ed73027f2a0e8907ff66e..6b0f9da497e517fde6103b9ec89658c2b6edf4f1 100755 (executable)
@@ -82,12 +82,15 @@ def main():
     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')
index e9517d637ec9588d89af9a362ecd14626f9a0d53..02abe1f93e3212b11a16816c07eecbdd3cc63b99 100644 (file)
@@ -123,6 +123,7 @@ select bc.file, string_agg(o.section || '/' || b.package, ',' order by b.package
         Returns a writer object.
         '''
         values = {
+            'archive':      self.suite.archive.path,
             'suite':        self.suite.suite_name,
             'component':    self.component.component_name,
             'debtype':      self.overridetype.overridetype,
@@ -223,6 +224,7 @@ select sc.file, string_agg(s.source, ',' order by s.source) as pkglist
         Returns a writer object.
         '''
         values = {
+            'archive':   self.suite.archive.path,
             'suite':     self.suite.suite_name,
             'component': self.component.component_name
         }
index c010fb5dc97afc0b1cc1f115bf0ec392119acac7..7fa68289e8a933d92979ff179c77463f7ebd4a57 100644 (file)
@@ -47,9 +47,7 @@ class BaseFileWriter(object):
         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):
         '''
@@ -98,9 +96,9 @@ class BinaryContentsFileWriter(BaseFileWriter):
         }
         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):
@@ -113,7 +111,7 @@ 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):
@@ -127,9 +125,9 @@ 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):
@@ -142,7 +140,7 @@ 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):
@@ -156,5 +154,5 @@ 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)