# This is the main configuration file for pakfire.
[main]
+
logfile = /var/log/pakfire.log
+# You can throttle the download bandwidth with this
+# parameter. Unit: bytes per second.
+# bandwidth_throttle = 10240
[distro]
name = IPFire
"""
# XXX add proxy, throttle things here
- def __init__(self, *args, **kwargs):
+ def __init__(self, pakfire, *args, **kwargs):
kwargs.update({
"quote" : 0,
"user_agent" : "pakfire/%s" % PAKFIRE_VERSION,
})
+ # Get Pakfire configuration
+ bandwidth_throttle = pakfire.config.get("bandwidth_throttle")
+ if bandwidth_throttle:
+ try:
+ bandwidth_throttle = int(bandwidth_throttle)
+ except ValueError:
+ logging.error("Configuration value for bandwidth_throttle is invalid.")
+ bandwidth_throttle = 0
+
+ kwargs.update({ "throttle" : bandwidth_throttle })
+
URLGrabber.__init__(self, *args, **kwargs)
class PackageDownloader(PakfireGrabber):
- def __init__(self, *args, **kwargs):
+ def __init__(self, pakfire, *args, **kwargs):
kwargs.update({
"progress_obj" : TextMeter(),
})
- PakfireGrabber.__init__(self, *args, **kwargs)
+ PakfireGrabber.__init__(self, pakfire, *args, **kwargs)
class MetadataDownloader(PakfireGrabber):
- def __init__(self, *args, **kwargs):
+ def __init__(self, pakfire, *args, **kwargs):
kwargs.update({
"http_headers" : (('Pragma', 'no-cache'),),
})
- PakfireGrabber.__init__(self, *args, **kwargs)
+ PakfireGrabber.__init__(self, pakfire, *args, **kwargs)
class DatabaseDownloader(PackageDownloader):
- def __init__(self, *args, **kwargs):
+ def __init__(self, pakfire, *args, **kwargs):
kwargs.update({
"http_headers" : (('Pragma', 'no-cache'),),
})
- PackageDownloader.__init__(self, *args, **kwargs)
+ PackageDownloader.__init__(self, pakfire, *args, **kwargs)
class Mirror(object):
force = True
if force:
- g = MetadataDownloader()
+ g = MetadataDownloader(self.pakfire)
try:
mirrordata = g.urlread(self.mirrorlist, limit=MIRRORLIST_MAXSIZE)
def __init__(self, pakfire):
self.pakfire = pakfire
+ # XXX need to use downloader.py
self.grabber = URLGrabber(
prefix = self.pakfire.config.get("source_download_url"),
progress_obj = TextMeter(),
logging.debug("Going to (re-)download the repository metadata.")
# Initialize a grabber for download.
- grabber = downloader.MetadataDownloader()
+ grabber = downloader.MetadataDownloader(self.pakfire)
grabber = self.repo.mirrors.group(grabber)
data = grabber.urlread(filename, limit=METADATA_DOWNLOAD_LIMIT)
if not self.cache.exists(filename):
# Initialize a grabber for download.
grabber = downloader.DatabaseDownloader(
+ self.pakfire,
text = _("%s: package database") % self.repo.name,
)
grabber = self.repo.mirrors.group(grabber)
logfile = os.path.join(tmpdir, "build.log")
# Get a package grabber and add mirror download capabilities to it.
- grabber = pakfire.downloader.PackageDownloader()
+ grabber = pakfire.downloader.PackageDownloader(self.pakfire)
try:
# Download the source.
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-03 14:24+0200\n"
+"POT-Creation-Date: 2011-08-03 23:16+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../pakfire/actions.py:100 ../pakfire/actions.py:157
+#: ../pakfire/actions.py:101 ../pakfire/actions.py:158
msgid "Installing"
msgstr ""
-#: ../pakfire/actions.py:110
+#: ../pakfire/actions.py:111
msgid "Updating"
msgstr ""
-#: ../pakfire/actions.py:124
+#: ../pakfire/actions.py:125
msgid "Removing"
msgstr ""
#. Cleaning up leftover files and stuff.
-#: ../pakfire/actions.py:142
+#: ../pakfire/actions.py:143
msgid "Cleanup"
msgstr ""
-#: ../pakfire/actions.py:167
+#: ../pakfire/actions.py:168
msgid "Downgrading"
msgstr ""
msgid "Requires"
msgstr ""
-#: ../pakfire/repository/index.py:231
+#: ../pakfire/repository/index.py:232
#, python-format
msgid "%s: package database"
msgstr ""
#. Create progress bar.
-#: ../pakfire/repository/index.py:319
+#: ../pakfire/repository/index.py:320
#, python-format
msgid "Loading from %s"
msgstr ""
#. Add all packages from the database to the index.
-#: ../pakfire/repository/index.py:372
+#: ../pakfire/repository/index.py:373
msgid "Loading installed packages"
msgstr ""
msgid "Freed size: %s"
msgstr ""
-#: ../pakfire/transaction.py:219
+#: ../pakfire/transaction.py:217
msgid "Is this okay?"
msgstr ""
-#: ../pakfire/transaction.py:225
+#: ../pakfire/transaction.py:223
msgid "Running transaction"
msgstr ""