* pisi will fallback to defined url/path in the pisi.conf if somehow the source archives

url can not be reached.
This commit is contained in:
Faik Uygur
2006-08-18 13:52:40 +00:00
parent 1ab6894541
commit c335035f27
2 changed files with 12 additions and 2 deletions
+2
View File
@@ -31,6 +31,7 @@
#buildno=True # necessary for generating build nos
#buildhelper = None / ccache / icecream
#compressionlevel = 7
#fallback = "ftp://ftp.pardus.org.tr/pub/pisi/source"
#
#[directories]
#lib_dir = /var/lib/pisi
@@ -75,6 +76,7 @@ class BuildDefaults:
buildno = False
buildhelper = None
compressionlevel = 7
fallback = "ftp://ftp.pardus.org.tr/pub/pisi/source"
class DirectoriesDefaults:
"Default values for [directories] section"
+10 -2
View File
@@ -14,7 +14,7 @@
# python standard library
from os.path import join
from os.path import join, basename
from os import access, R_OK
import gettext
@@ -47,7 +47,15 @@ class SourceArchive:
progress = ctx.ui.Progress
else:
progress = None
fetch_url(self.url, ctx.config.archives_dir(), progress)
try:
fetch_url(self.url, ctx.config.archives_dir(), progress)
except pisi.fetcher.FetchError:
# if archive can not be reached from the url, try the fallback
# address.
if ctx.config.values.build.fallback:
archive = basename(self.url.get_uri())
src = join(ctx.config.values.build.fallback, archive)
fetch_url(src, ctx.config.archives_dir(), progress)
def is_cached(self, interactive=True):
if not access(self.archiveFile, R_OK):