]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Add source download option.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 12 Sep 2010 21:15:03 +0000 (23:15 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 12 Sep 2010 21:16:46 +0000 (23:16 +0200)
naoki/__init__.py
naoki/build.py
naoki/constants.py
naoki/packages.py
pkgs/Constants

index a4180c9aa80f9530d7bd54d9c1e5451797e2118d..a70a057bc4d580ea6865af7eff3055117d054a73 100644 (file)
@@ -174,7 +174,7 @@ Release       : %(release)s
                                if not package.name in args.packages:
                                        continue
 
-                       package.source_donwload()
+                       package.source_download()
 
        def call_source_upload(self, args):
                pass # TODO
index b705cd9aed5b261413a47772b090aabdb6b3c746..befab33ff569cfc16c15cfad9a80e2e476584764 100644 (file)
@@ -46,6 +46,9 @@ class Build(object):
                logging.info("    %s" % self.package.summary)
                logging.info("")
 
+               # Download the source tarballs
+               self.package.source_download()
+
                # Resolve the dependencies
                try:
                        self.dependency_set.resolve()
index 1d3aa3df82d6191c73d8fae9daa5e09bfe63ee87..861c83c1b58985d41235df7c3495628fcf87577d 100644 (file)
@@ -20,10 +20,6 @@ PACKAGESDIR = os.path.join(BUILDDIR, "packages")
 REPOSDIR = os.path.join(BUILDDIR, "repositories")
 TOOLSDIR = os.path.join(BASEDIR, "tools")
 
-TARBALLDIR = os.path.join(CACHEDIR, "tarballs")
-TOOLCHAINSDIR = os.path.join(CACHEDIR, "toolchains")
-PATCHESDIR = os.path.join(CACHEDIR, "patches")
-
 ARCHES_DEFAULT = os.path.join(CONFIGDIR, "architectures.conf")
 
 CONFIGFILE = os.path.join(CONFIGDIR, "naoki.conf")
index 9f9aeb5e8ca7cee90680590e37e5b60ed26c5daa..3b09e900c3d13794c674052b60fe837c0354b056 100644 (file)
@@ -4,6 +4,9 @@ import logging
 import os
 import re
 
+import urlgrabber
+import urlgrabber.progress
+
 import architectures
 import dependencies
 import environ
@@ -12,6 +15,7 @@ import util
 
 from constants import *
 
+
 class Package(object):
        def __repr__(self):
                return "<%s %s:%s>" % \
@@ -106,6 +110,27 @@ class SourcePackage(Package):
 
                return True
 
+       @property
+       def source_files(self):
+               return self._info.get("PKG_OBJECTS").split()
+
+       def source_download(self):
+               g = urlgrabber.grabber.URLGrabber(
+                       prefix = config["sources_download_url"],
+                       progress_obj = urlgrabber.progress.TextMeter(),
+                       quote=0,
+               )
+
+               for file in self.source_files:
+                       file = os.path.join(CACHEDIR, file)
+
+                       if os.path.exists(file):
+                               continue
+
+                       util.mkdir(CACHEDIR)
+
+                       g.urlgrab(os.path.basename(file), filename=file)
+
 
 class BinaryPackage(Package):
        def __init__(self, filename):
index b467a0718acf701e710b0ea6d7c9442cd68b4f3d..c8142a14b00c05be283a4a01078d870df33e459a 100644 (file)
@@ -15,7 +15,7 @@ endif
 THISAPP    = $(PKG_NAME)-$(PKG_VER)
 
 DIR_APP = $(DIR_SRC)/$(THISAPP)
-DIR_DL  = $(BASEDIR)/cache/tarballs
+DIR_DL  = $(BASEDIR)/cache
 DIR_PATCHES = $(DIR_SOURCE)/patches
 DIR_SRC = $(ROOT)/usr/src
 DIR_TMP = /tmp