base.bbclass: check_gcc3 needs to check for gcc-3.4.6 first.
[vuplus_openembedded] / classes / base.bbclass
1 BB_DEFAULT_TASK ?= "build"
2
3 # like os.path.join but doesn't treat absolute RHS specially
4 def base_path_join(a, *p):
5     path = a
6     for b in p:
7         if path == '' or path.endswith('/'):
8             path +=  b
9         else:
10             path += '/' + b
11     return path
12
13 def base_path_relative(src, dest):
14     """ Return a relative path from src to dest.
15
16     >>> base_path_relative("/usr/bin", "/tmp/foo/bar")
17     ../../tmp/foo/bar
18
19     >>> base_path_relative("/usr/bin", "/usr/lib")
20     ../lib
21
22     >>> base_path_relative("/tmp", "/tmp/foo/bar")
23     foo/bar
24     """
25     from os.path import sep, pardir, normpath, commonprefix
26
27     destlist = normpath(dest).split(sep)
28     srclist = normpath(src).split(sep)
29
30     # Find common section of the path
31     common = commonprefix([destlist, srclist])
32     commonlen = len(common)
33
34     # Climb back to the point where they differentiate
35     relpath = [ pardir ] * (len(srclist) - commonlen)
36     if commonlen < len(destlist):
37         # Add remaining portion
38         relpath += destlist[commonlen:]
39
40     return sep.join(relpath)
41
42 # for MD5/SHA handling
43 def base_chk_load_parser(config_paths):
44     import ConfigParser, os, bb
45     parser = ConfigParser.ConfigParser()
46     if len(parser.read(config_paths)) < 1:
47         raise ValueError("no ini files could be found")
48
49     return parser
50
51 def base_chk_file(parser, pn, pv, src_uri, localpath, data):
52     import os, bb
53     no_checksum = False
54     # Try PN-PV-SRC_URI first and then try PN-SRC_URI
55     # we rely on the get method to create errors
56     pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri)
57     pn_src    = "%s-%s" % (pn,src_uri)
58     if parser.has_section(pn_pv_src):
59         md5    = parser.get(pn_pv_src, "md5")
60         sha256 = parser.get(pn_pv_src, "sha256")
61     elif parser.has_section(pn_src):
62         md5    = parser.get(pn_src, "md5")
63         sha256 = parser.get(pn_src, "sha256")
64     elif parser.has_section(src_uri):
65         md5    = parser.get(src_uri, "md5")
66         sha256 = parser.get(src_uri, "sha256")
67     else:
68         no_checksum = True
69
70     # md5 and sha256 should be valid now
71     if not os.path.exists(localpath):
72         bb.note("The localpath does not exist '%s'" % localpath)
73         raise Exception("The path does not exist '%s'" % localpath)
74
75
76     # call md5(sum) and shasum
77     try:
78         md5pipe = os.popen('md5sum ' + localpath)
79         md5data = (md5pipe.readline().split() or [ "" ])[0]
80         md5pipe.close()
81     except OSError:
82         raise Exception("Executing md5sum failed")
83
84     try:
85         shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath))
86         shadata = (shapipe.readline().split() or [ "" ])[0]
87         shapipe.close()
88     except OSError:
89         raise Exception("Executing shasum failed")
90
91     if no_checksum == True:     # we do not have conf/checksums.ini entry
92         try:
93             file = open("%s/checksums.ini" % bb.data.getVar("TMPDIR", data, 1), "a")
94         except:
95             return False
96
97         if not file:
98             raise Exception("Creating checksums.ini failed")
99         
100         file.write("[%s]\nmd5=%s\nsha256=%s\n\n" % (src_uri, md5data, shadata))
101         file.close()
102         if not bb.data.getVar("OE_STRICT_CHECKSUMS",data, True):
103             bb.note("This package has no entry in checksums.ini, please add one")
104             bb.note("\n[%s]\nmd5=%s\nsha256=%s" % (src_uri, md5data, shadata))
105             return True
106         else:
107             bb.note("Missing checksum")
108             return False
109
110     if not md5 == md5data:
111         bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (md5,md5data))
112         raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (md5, md5data))
113
114     if not sha256 == shadata:
115         bb.note("The SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256,shadata))
116         raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256, shadata))
117
118     return True
119
120
121 def base_dep_prepend(d):
122         import bb
123         #
124         # Ideally this will check a flag so we will operate properly in
125         # the case where host == build == target, for now we don't work in
126         # that case though.
127         #
128         deps = "shasum-native coreutils-native"
129         if bb.data.getVar('PN', d, True) == "shasum-native" or bb.data.getVar('PN', d, True) == "stagemanager-native":
130                 deps = ""
131         if bb.data.getVar('PN', d, True) == "coreutils-native":
132                 deps = "shasum-native"
133
134         # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command.  Whether or  not
135         # we need that built is the responsibility of the patch function / class, not
136         # the application.
137         if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d):
138                 if (bb.data.getVar('HOST_SYS', d, 1) !=
139                     bb.data.getVar('BUILD_SYS', d, 1)):
140                         deps += " virtual/${TARGET_PREFIX}gcc virtual/libc "
141         return deps
142
143 def base_read_file(filename):
144         import bb
145         try:
146                 f = file( filename, "r" )
147         except IOError, reason:
148                 return "" # WARNING: can't raise an error now because of the new RDEPENDS handling. This is a bit ugly. :M:
149         else:
150                 return f.read().strip()
151         return None
152
153 def base_conditional(variable, checkvalue, truevalue, falsevalue, d):
154         import bb
155         if bb.data.getVar(variable,d,1) == checkvalue:
156                 return truevalue
157         else:
158                 return falsevalue
159
160 def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
161         import bb
162         if float(bb.data.getVar(variable,d,1)) <= float(checkvalue):
163                 return truevalue
164         else:
165                 return falsevalue
166
167 def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
168     import bb
169     result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue)
170     if result <= 0:
171         return truevalue
172     else:
173         return falsevalue
174
175 def base_contains(variable, checkvalues, truevalue, falsevalue, d):
176         import bb
177         matches = 0
178         if type(checkvalues).__name__ == "str":
179                 checkvalues = [checkvalues]
180         for value in checkvalues:
181                 if bb.data.getVar(variable,d,1).find(value) != -1:      
182                         matches = matches + 1
183         if matches == len(checkvalues):
184                 return truevalue                
185         return falsevalue
186
187 def base_both_contain(variable1, variable2, checkvalue, d):
188        import bb
189        if bb.data.getVar(variable1,d,1).find(checkvalue) != -1 and bb.data.getVar(variable2,d,1).find(checkvalue) != -1:
190                return checkvalue
191        else:
192                return ""
193
194 DEPENDS_prepend="${@base_dep_prepend(d)} "
195
196 # Returns PN with various suffixes removed
197 # or PN if no matching suffix was found.
198 def base_package_name(d):
199   import bb;
200
201   pn = bb.data.getVar('PN', d, 1)
202   if pn.endswith("-native"):
203                 pn = pn[0:-7]
204   elif pn.endswith("-cross"):
205                 pn = pn[0:-6]
206   elif pn.endswith("-initial"):
207                 pn = pn[0:-8]
208   elif pn.endswith("-intermediate"):
209                 pn = pn[0:-13]
210
211   return pn
212
213 def base_set_filespath(path, d):
214         import os, bb
215         bb.note("base_set_filespath usage is deprecated, %s should be fixed" % d.getVar("P", 1))
216         filespath = []
217         # The ":" ensures we have an 'empty' override
218         overrides = (bb.data.getVar("OVERRIDES", d, 1) or "") + ":"
219         for p in path:
220                 for o in overrides.split(":"):
221                         filespath.append(os.path.join(p, o))
222         return ":".join(filespath)
223
224 def oe_filter(f, str, d):
225         from re import match
226         return " ".join(filter(lambda x: match(f, x, 0), str.split()))
227
228 def oe_filter_out(f, str, d):
229         from re import match
230         return " ".join(filter(lambda x: not match(f, x, 0), str.split()))
231
232 die() {
233         oefatal "$*"
234 }
235
236 oenote() {
237         echo "NOTE:" "$*"
238 }
239
240 oewarn() {
241         echo "WARNING:" "$*"
242 }
243
244 oefatal() {
245         echo "FATAL:" "$*"
246         exit 1
247 }
248
249 oedebug() {
250         test $# -ge 2 || {
251                 echo "Usage: oedebug level \"message\""
252                 exit 1
253         }
254
255         test ${OEDEBUG:-0} -ge $1 && {
256                 shift
257                 echo "DEBUG:" $*
258         }
259 }
260
261 oe_runmake() {
262         if [ x"$MAKE" = x ]; then MAKE=make; fi
263         oenote ${MAKE} ${EXTRA_OEMAKE} "$@"
264         ${MAKE} ${EXTRA_OEMAKE} "$@" || die "oe_runmake failed"
265 }
266
267 oe_soinstall() {
268         # Purpose: Install shared library file and
269         #          create the necessary links
270         # Example:
271         #
272         # oe_
273         #
274         #oenote installing shared library $1 to $2
275         #
276         libname=`basename $1`
277         install -m 755 $1 $2/$libname
278         sonamelink=`${HOST_PREFIX}readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
279         solink=`echo $libname | sed -e 's/\.so\..*/.so/'`
280         ln -sf $libname $2/$sonamelink
281         ln -sf $libname $2/$solink
282 }
283
284 oe_libinstall() {
285         # Purpose: Install a library, in all its forms
286         # Example
287         #
288         # oe_libinstall libltdl ${STAGING_LIBDIR}/
289         # oe_libinstall -C src/libblah libblah ${D}/${libdir}/
290         dir=""
291         libtool=""
292         silent=""
293         require_static=""
294         require_shared=""
295         staging_install=""
296         while [ "$#" -gt 0 ]; do
297                 case "$1" in
298                 -C)
299                         shift
300                         dir="$1"
301                         ;;
302                 -s)
303                         silent=1
304                         ;;
305                 -a)
306                         require_static=1
307                         ;;
308                 -so)
309                         require_shared=1
310                         ;;
311                 -*)
312                         oefatal "oe_libinstall: unknown option: $1"
313                         ;;
314                 *)
315                         break;
316                         ;;
317                 esac
318                 shift
319         done
320
321         libname="$1"
322         shift
323         destpath="$1"
324         if [ -z "$destpath" ]; then
325                 oefatal "oe_libinstall: no destination path specified"
326         fi
327         if echo "$destpath/" | egrep '^${STAGING_LIBDIR}/' >/dev/null
328         then
329                 staging_install=1
330         fi
331
332         __runcmd () {
333                 if [ -z "$silent" ]; then
334                         echo >&2 "oe_libinstall: $*"
335                 fi
336                 $*
337         }
338
339         if [ -z "$dir" ]; then
340                 dir=`pwd`
341         fi
342
343         dotlai=$libname.lai
344
345         # Sanity check that the libname.lai is unique
346         number_of_files=`(cd $dir; find . -name "$dotlai") | wc -l`
347         if [ $number_of_files -gt 1 ]; then
348                 oefatal "oe_libinstall: $dotlai is not unique in $dir"
349         fi
350
351
352         dir=$dir`(cd $dir;find . -name "$dotlai") | sed "s/^\.//;s/\/$dotlai\$//;q"`
353         olddir=`pwd`
354         __runcmd cd $dir
355
356         lafile=$libname.la
357
358         # If such file doesn't exist, try to cut version suffix
359         if [ ! -f "$lafile" ]; then
360                 libname1=`echo "$libname" | sed 's/-[0-9.]*$//'`
361                 lafile1=$libname.la
362                 if [ -f "$lafile1" ]; then
363                         libname=$libname1
364                         lafile=$lafile1
365                 fi
366         fi
367
368         if [ -f "$lafile" ]; then
369                 # libtool archive
370                 eval `cat $lafile|grep "^library_names="`
371                 libtool=1
372         else
373                 library_names="$libname.so* $libname.dll.a"
374         fi
375
376         __runcmd install -d $destpath/
377         dota=$libname.a
378         if [ -f "$dota" -o -n "$require_static" ]; then
379                 __runcmd install -m 0644 $dota $destpath/
380         fi
381         if [ -f "$dotlai" -a -n "$libtool" ]; then
382                 if test -n "$staging_install"
383                 then
384                         # stop libtool using the final directory name for libraries
385                         # in staging:
386                         __runcmd rm -f $destpath/$libname.la
387                         __runcmd sed -e 's/^installed=yes$/installed=no/' \
388                                      -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \
389                                      -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \
390                                      $dotlai >$destpath/$libname.la
391                 else
392                         __runcmd install -m 0644 $dotlai $destpath/$libname.la
393                 fi
394         fi
395
396         for name in $library_names; do
397                 files=`eval echo $name`
398                 for f in $files; do
399                         if [ ! -e "$f" ]; then
400                                 if [ -n "$libtool" ]; then
401                                         oefatal "oe_libinstall: $dir/$f not found."
402                                 fi
403                         elif [ -L "$f" ]; then
404                                 __runcmd cp -P "$f" $destpath/
405                         elif [ ! -L "$f" ]; then
406                                 libfile="$f"
407                                 __runcmd install -m 0755 $libfile $destpath/
408                         fi
409                 done
410         done
411
412         if [ -z "$libfile" ]; then
413                 if  [ -n "$require_shared" ]; then
414                         oefatal "oe_libinstall: unable to locate shared library"
415                 fi
416         elif [ -z "$libtool" ]; then
417                 # special case hack for non-libtool .so.#.#.# links
418                 baselibfile=`basename "$libfile"`
419                 if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
420                         sonamelink=`${HOST_PREFIX}readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
421                         solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
422                         if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
423                                 __runcmd ln -sf $baselibfile $destpath/$sonamelink
424                         fi
425                         __runcmd ln -sf $baselibfile $destpath/$solink
426                 fi
427         fi
428
429         __runcmd cd "$olddir"
430 }
431
432 def package_stagefile(file, d):
433     import bb, os
434
435     if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1":
436         destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1))
437         bb.mkdirhier(os.path.dirname(destfile))
438         #print "%s to %s" % (file, destfile)
439         bb.copyfile(file, destfile)
440
441 package_stagefile_shell() {
442         if [ "$PSTAGING_ACTIVE" = "1" ]; then
443                 srcfile=$1
444                 destfile=`echo $srcfile | sed s#${TMPDIR}#${PSTAGE_TMPDIR_STAGE}#`
445                 destdir=`dirname $destfile`
446                 mkdir -p $destdir
447                 cp -dp $srcfile $destfile
448         fi
449 }
450
451 oe_machinstall() {
452         # Purpose: Install machine dependent files, if available
453         #          If not available, check if there is a default
454         #          If no default, just touch the destination
455         # Example:
456         #                $1  $2   $3         $4
457         # oe_machinstall -m 0644 fstab ${D}/etc/fstab
458         #
459         # TODO: Check argument number?
460         #
461         filename=`basename $3`
462         dirname=`dirname $3`
463
464         for o in `echo ${OVERRIDES} | tr ':' ' '`; do
465                 if [ -e $dirname/$o/$filename ]; then
466                         oenote $dirname/$o/$filename present, installing to $4
467                         install $1 $2 $dirname/$o/$filename $4
468                         return
469                 fi
470         done
471 #       oenote overrides specific file NOT present, trying default=$3...
472         if [ -e $3 ]; then
473                 oenote $3 present, installing to $4
474                 install $1 $2 $3 $4
475         else
476                 oenote $3 NOT present, touching empty $4
477                 touch $4
478         fi
479 }
480
481 addtask listtasks
482 do_listtasks[nostamp] = "1"
483 python do_listtasks() {
484         import sys
485         # emit variables and shell functions
486         #bb.data.emit_env(sys.__stdout__, d)
487         # emit the metadata which isnt valid shell
488         for e in d.keys():
489                 if bb.data.getVarFlag(e, 'task', d):
490                         sys.__stdout__.write("%s\n" % e)
491 }
492
493 addtask clean
494 do_clean[dirs] = "${TOPDIR}"
495 do_clean[nostamp] = "1"
496 python base_do_clean() {
497         """clear the build and temp directories"""
498         dir = bb.data.expand("${WORKDIR}", d)
499         if dir == '//': raise bb.build.FuncFailed("wrong DATADIR")
500         bb.note("removing " + dir)
501         os.system('rm -rf ' + dir)
502
503         dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d)
504         bb.note("removing " + dir)
505         os.system('rm -f '+ dir)
506 }
507
508 #Uncomment this for bitbake 1.8.12
509 #addtask rebuild after do_${BB_DEFAULT_TASK}
510 addtask rebuild
511 do_rebuild[dirs] = "${TOPDIR}"
512 do_rebuild[nostamp] = "1"
513 python base_do_rebuild() {
514         """rebuild a package"""
515         from bb import __version__
516         try:
517                 from distutils.version import LooseVersion
518         except ImportError:
519                 def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1
520         if (LooseVersion(__version__) < LooseVersion('1.8.11')):
521                 bb.build.exec_func('do_clean', d)
522                 bb.build.exec_task('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1), d)
523 }
524
525 addtask mrproper
526 do_mrproper[dirs] = "${TOPDIR}"
527 do_mrproper[nostamp] = "1"
528 python base_do_mrproper() {
529         """clear downloaded sources, build and temp directories"""
530         dir = bb.data.expand("${DL_DIR}", d)
531         if dir == '/': bb.build.FuncFailed("wrong DATADIR")
532         bb.debug(2, "removing " + dir)
533         os.system('rm -rf ' + dir)
534         bb.build.exec_func('do_clean', d)
535 }
536
537 addtask distclean
538 do_distclean[dirs] = "${TOPDIR}"
539 do_distclean[nostamp] = "1"
540 python base_do_distclean() {
541         """clear downloaded sources, build and temp directories"""
542         import os
543
544         bb.build.exec_func('do_clean', d)
545
546         src_uri = bb.data.getVar('SRC_URI', d, 1)
547         if not src_uri:
548                 return
549
550         for uri in src_uri.split():
551                 if bb.decodeurl(uri)[0] == "file":
552                         continue
553
554                 try:
555                         local = bb.data.expand(bb.fetch.localpath(uri, d), d)
556                 except bb.MalformedUrl, e:
557                         bb.debug(1, 'Unable to generate local path for malformed uri: %s' % e)
558                 else:
559                         bb.note("removing %s" % local)
560                         try:
561                                 if os.path.exists(local + ".md5"):
562                                         os.remove(local + ".md5")
563                                 if os.path.exists(local):
564                                         os.remove(local)
565                         except OSError, e:
566                                 bb.note("Error in removal: %s" % e)
567 }
568
569 SCENEFUNCS += "base_scenefunction"
570                                                                                         
571 python base_do_setscene () {
572         for f in (bb.data.getVar('SCENEFUNCS', d, 1) or '').split():
573                 bb.build.exec_func(f, d)
574         if not os.path.exists(bb.data.getVar('STAMP', d, 1) + ".do_setscene"):
575                 bb.build.make_stamp("do_setscene", d)
576 }
577 do_setscene[selfstamp] = "1"
578 addtask setscene before do_fetch
579
580 python base_scenefunction () {
581         stamp = bb.data.getVar('STAMP', d, 1) + ".needclean"
582         if os.path.exists(stamp):
583                 bb.build.exec_func("do_clean", d)
584 }
585
586
587 addtask fetch
588 do_fetch[dirs] = "${DL_DIR}"
589 do_fetch[depends] = "shasum-native:do_populate_staging"
590 python base_do_fetch() {
591         import sys
592
593         localdata = bb.data.createCopy(d)
594         bb.data.update_data(localdata)
595
596         src_uri = bb.data.getVar('SRC_URI', localdata, 1)
597         if not src_uri:
598                 return 1
599
600         try:
601                 bb.fetch.init(src_uri.split(),d)
602         except bb.fetch.NoMethodError:
603                 (type, value, traceback) = sys.exc_info()
604                 raise bb.build.FuncFailed("No method: %s" % value)
605
606         try:
607                 bb.fetch.go(localdata)
608         except bb.fetch.MissingParameterError:
609                 (type, value, traceback) = sys.exc_info()
610                 raise bb.build.FuncFailed("Missing parameters: %s" % value)
611         except bb.fetch.FetchError:
612                 (type, value, traceback) = sys.exc_info()
613                 raise bb.build.FuncFailed("Fetch failed: %s" % value)
614         except bb.fetch.MD5SumError:
615                 (type, value, traceback) = sys.exc_info()
616                 raise bb.build.FuncFailed("MD5  failed: %s" % value)
617         except:
618                 (type, value, traceback) = sys.exc_info()
619                 raise bb.build.FuncFailed("Unknown fetch Error: %s" % value)
620
621
622         # Verify the SHA and MD5 sums we have in OE and check what do
623         # in
624         checksum_paths = bb.data.getVar('BBPATH', d, True).split(":")
625
626         # reverse the list to give precedence to directories that
627         # appear first in BBPATH
628         checksum_paths.reverse()
629
630         checksum_files = ["%s/conf/checksums.ini" % path for path in checksum_paths]
631         try:
632                 parser = base_chk_load_parser(checksum_files)
633         except ValueError:
634                 bb.note("No conf/checksums.ini found, not checking checksums")
635                 return
636         except:
637                 bb.note("Creating the CheckSum parser failed")
638                 return
639
640         pv = bb.data.getVar('PV', d, True)
641         pn = bb.data.getVar('PN', d, True)
642
643         # Check each URI
644         for url in src_uri.split():
645                 localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
646                 (type,host,path,_,_,_) = bb.decodeurl(url)
647                 uri = "%s://%s%s" % (type,host,path)
648                 try:
649                         if type == "http" or type == "https" or type == "ftp" or type == "ftps":
650                                 if not base_chk_file(parser, pn, pv,uri, localpath, d):
651                                         if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS",d, True):
652                                                 bb.fatal("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
653                                         else:
654                                                 bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
655                 except Exception:
656                         raise bb.build.FuncFailed("Checksum of '%s' failed" % uri)
657 }
658
659 addtask fetchall after do_fetch
660 do_fetchall[recrdeptask] = "do_fetch"
661 base_do_fetchall() {
662         :
663 }
664
665 addtask checkuri
666 do_checkuri[nostamp] = "1"
667 python do_checkuri() {
668         import sys
669
670         localdata = bb.data.createCopy(d)
671         bb.data.update_data(localdata)
672
673         src_uri = bb.data.getVar('SRC_URI', localdata, 1)
674
675         try:
676                 bb.fetch.init(src_uri.split(),d)
677         except bb.fetch.NoMethodError:
678                 (type, value, traceback) = sys.exc_info()
679                 raise bb.build.FuncFailed("No method: %s" % value)
680
681         try:
682                 bb.fetch.checkstatus(localdata)
683         except bb.fetch.MissingParameterError:
684                 (type, value, traceback) = sys.exc_info()
685                 raise bb.build.FuncFailed("Missing parameters: %s" % value)
686         except bb.fetch.FetchError:
687                 (type, value, traceback) = sys.exc_info()
688                 raise bb.build.FuncFailed("Fetch failed: %s" % value)
689         except bb.fetch.MD5SumError:
690                 (type, value, traceback) = sys.exc_info()
691                 raise bb.build.FuncFailed("MD5  failed: %s" % value)
692         except:
693                 (type, value, traceback) = sys.exc_info()
694                 raise bb.build.FuncFailed("Unknown fetch Error: %s" % value)
695 }
696
697 addtask checkuriall after do_checkuri
698 do_checkuriall[recrdeptask] = "do_checkuri"
699 do_checkuriall[nostamp] = "1"
700 base_do_checkuriall() {
701         :
702 }
703
704 addtask buildall after do_build
705 do_buildall[recrdeptask] = "do_build"
706 base_do_buildall() {
707         :
708 }
709
710
711 def oe_unpack_file(file, data, url = None):
712         import bb, os
713         if not url:
714                 url = "file://%s" % file
715         dots = file.split(".")
716         if dots[-1] in ['gz', 'bz2', 'Z']:
717                 efile = os.path.join(bb.data.getVar('WORKDIR', data, 1),os.path.basename('.'.join(dots[0:-1])))
718         else:
719                 efile = file
720         cmd = None
721         if file.endswith('.tar'):
722                 cmd = 'tar x --no-same-owner -f %s' % file
723         elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'):
724                 cmd = 'tar xz --no-same-owner -f %s' % file
725         elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'):
726                 cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file
727         elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'):
728                 cmd = 'gzip -dc %s > %s' % (file, efile)
729         elif file.endswith('.bz2'):
730                 cmd = 'bzip2 -dc %s > %s' % (file, efile)
731         elif file.endswith('.zip') or file.endswith('.jar'):
732                 cmd = 'unzip -q -o'
733                 (type, host, path, user, pswd, parm) = bb.decodeurl(url)
734                 if 'dos' in parm:
735                         cmd = '%s -a' % cmd
736                 cmd = '%s %s' % (cmd, file)
737         elif os.path.isdir(file):
738                 destdir = "."
739                 filespath = bb.data.getVar("FILESPATH", data, 1).split(":")
740                 for fp in filespath:
741                         if file[0:len(fp)] == fp:
742                                 destdir = file[len(fp):file.rfind('/')]
743                                 destdir = destdir.strip('/')
744                                 if len(destdir) < 1:
745                                         destdir = "."
746                                 elif not os.access("%s/%s" % (os.getcwd(), destdir), os.F_OK):
747                                         os.makedirs("%s/%s" % (os.getcwd(), destdir))
748                                 break
749
750                 cmd = 'cp -pPR %s %s/%s/' % (file, os.getcwd(), destdir)
751         else:
752                 (type, host, path, user, pswd, parm) = bb.decodeurl(url)
753                 if not 'patch' in parm:
754                         # The "destdir" handling was specifically done for FILESPATH
755                         # items.  So, only do so for file:// entries.
756                         if type == "file":
757                                 destdir = bb.decodeurl(url)[1] or "."
758                         else:
759                                 destdir = "."
760                         bb.mkdirhier("%s/%s" % (os.getcwd(), destdir))
761                         cmd = 'cp %s %s/%s/' % (file, os.getcwd(), destdir)
762
763         if not cmd:
764                 return True
765
766         dest = os.path.join(os.getcwd(), os.path.basename(file))
767         if os.path.exists(dest):
768                 if os.path.samefile(file, dest):
769                         return True
770
771         # Change to subdir before executing command
772         save_cwd = os.getcwd();
773         parm = bb.decodeurl(url)[5]
774         if 'subdir' in parm:
775                 newdir = ("%s/%s" % (os.getcwd(), parm['subdir']))
776                 bb.mkdirhier(newdir)
777                 os.chdir(newdir)
778
779         cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd)
780         bb.note("Unpacking %s to %s/" % (file, os.getcwd()))
781         ret = os.system(cmd)
782
783         os.chdir(save_cwd)
784
785         return ret == 0
786
787 addtask unpack after do_fetch
788 do_unpack[dirs] = "${WORKDIR}"
789 python base_do_unpack() {
790         import re, os
791
792         localdata = bb.data.createCopy(d)
793         bb.data.update_data(localdata)
794
795         src_uri = bb.data.getVar('SRC_URI', localdata)
796         if not src_uri:
797                 return
798         src_uri = bb.data.expand(src_uri, localdata)
799         for url in src_uri.split():
800                 try:
801                         local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
802                 except bb.MalformedUrl, e:
803                         raise bb.build.FuncFailed('Unable to generate local path for malformed uri: %s' % e)
804                 if not local:
805                         raise bb.build.FuncFailed('Unable to locate local file for %s' % url)
806                 local = os.path.realpath(local)
807                 ret = oe_unpack_file(local, localdata, url)
808                 if not ret:
809                         raise bb.build.FuncFailed()
810 }
811
812 METADATA_SCM = "${@base_get_scm(d)}"
813 METADATA_REVISION = "${@base_get_scm_revision(d)}"
814 METADATA_BRANCH = "${@base_get_scm_branch(d)}"
815
816 def base_get_scm(d):
817         import os
818         from bb import which
819         baserepo = os.path.dirname(os.path.dirname(which(d.getVar("BBPATH", 1), "classes/base.bbclass")))
820         for (scm, scmpath) in {"svn": ".svn",
821                                "git": ".git",
822                                "monotone": "_MTN"}.iteritems():
823                 if os.path.exists(os.path.join(baserepo, scmpath)):
824                         return "%s %s" % (scm, baserepo)
825         return "<unknown> %s" % baserepo
826
827 def base_get_scm_revision(d):
828         (scm, path) = d.getVar("METADATA_SCM", 1).split()
829         try:
830                 if scm != "<unknown>":
831                         return globals()["base_get_metadata_%s_revision" % scm](path, d)
832                 else:
833                         return scm
834         except KeyError:
835                 return "<unknown>"
836
837 def base_get_scm_branch(d):
838         (scm, path) = d.getVar("METADATA_SCM", 1).split()
839         try:
840                 if scm != "<unknown>":
841                         return globals()["base_get_metadata_%s_branch" % scm](path, d)
842                 else:
843                         return scm
844         except KeyError:
845                 return "<unknown>"
846
847 def base_get_metadata_monotone_branch(path, d):
848         monotone_branch = "<unknown>"
849         try:
850                 monotone_branch = file( "%s/_MTN/options" % path ).read().strip()
851                 if monotone_branch.startswith( "database" ):
852                         monotone_branch_words = monotone_branch.split()
853                         monotone_branch = monotone_branch_words[ monotone_branch_words.index( "branch" )+1][1:-1]
854         except:
855                 pass
856         return monotone_branch
857
858 def base_get_metadata_monotone_revision(path, d):
859         monotone_revision = "<unknown>"
860         try:
861                 monotone_revision = file( "%s/_MTN/revision" % path ).read().strip()
862                 if monotone_revision.startswith( "format_version" ):
863                         monotone_revision_words = monotone_revision.split()
864                         monotone_revision = monotone_revision_words[ monotone_revision_words.index( "old_revision" )+1][1:-1]
865         except IOError:
866                 pass
867         return monotone_revision
868
869 def base_get_metadata_svn_revision(path, d):
870         revision = "<unknown>"
871         try:
872                 revision = file( "%s/.svn/entries" % path ).readlines()[3].strip()
873         except IOError:
874                 pass
875         return revision
876
877 def base_get_metadata_git_branch(path, d):
878         import os
879         branch = os.popen('cd %s; git symbolic-ref HEAD' % path).read().rstrip()
880
881         if len(branch) != 0:
882                 return branch.replace("refs/heads/", "")
883         return "<unknown>"
884
885 def base_get_metadata_git_revision(path, d):
886         import os
887         rev = os.popen("cd %s; git show-ref HEAD" % path).read().split(" ")[0].rstrip()
888         if len(rev) != 0:
889                 return rev
890         return "<unknown>"
891
892
893 addhandler base_eventhandler
894 python base_eventhandler() {
895         from bb import note, error, data
896         from bb.event import Handled, NotHandled, getName
897         import os
898
899         messages = {}
900         messages["Completed"] = "completed"
901         messages["Succeeded"] = "completed"
902         messages["Started"] = "started"
903         messages["Failed"] = "failed"
904
905         name = getName(e)
906         msg = ""
907         if name.startswith("Task"):
908                 msg += "package %s: task %s: " % (data.getVar("PF", e.data, 1), e.task)
909                 msg += messages.get(name[4:]) or name[4:]
910         elif name.startswith("Build"):
911                 msg += "build %s: " % e.name
912                 msg += messages.get(name[5:]) or name[5:]
913         elif name == "UnsatisfiedDep":
914                 msg += "package %s: dependency %s %s" % (e.pkg, e.dep, name[:-3].lower())
915         else:
916                 return NotHandled
917
918         # Only need to output when using 1.8 or lower, the UI code handles it
919         # otherwise
920         if (int(bb.__version__.split(".")[0]) <= 1 and int(bb.__version__.split(".")[1]) <= 8):
921                 if msg:
922                         note(msg)
923
924         if name.startswith("BuildStarted"):
925                 bb.data.setVar( 'BB_VERSION', bb.__version__, e.data )
926                 statusvars = bb.data.getVar("BUILDCFG_VARS", e.data, 1).split()
927                 statuslines = ["%-17s = \"%s\"" % (i, bb.data.getVar(i, e.data, 1) or '') for i in statusvars]
928                 statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines)
929                 print statusmsg
930
931                 needed_vars = bb.data.getVar("BUILDCFG_NEEDEDVARS", e.data, 1).split()
932                 pesteruser = []
933                 for v in needed_vars:
934                         val = bb.data.getVar(v, e.data, 1)
935                         if not val or val == 'INVALID':
936                                 pesteruser.append(v)
937                 if pesteruser:
938                         bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
939
940         #
941         # Handle removing stamps for 'rebuild' task
942         #
943         if name.startswith("StampUpdate"):
944                 for (fn, task) in e.targets:
945                         #print "%s %s" % (task, fn)         
946                         if task == "do_rebuild":
947                                 dir = "%s.*" % e.stampPrefix[fn]
948                                 bb.note("Removing stamps: " + dir)
949                                 os.system('rm -f '+ dir)
950                                 os.system('touch ' + e.stampPrefix[fn] + '.needclean')
951
952         if not data in e.__dict__:
953                 return NotHandled
954
955         log = data.getVar("EVENTLOG", e.data, 1)
956         if log:
957                 logfile = file(log, "a")
958                 logfile.write("%s\n" % msg)
959                 logfile.close()
960
961         return NotHandled
962 }
963
964 addtask configure after do_unpack do_patch
965 do_configure[dirs] = "${S} ${B}"
966 do_configure[deptask] = "do_populate_staging"
967 base_do_configure() {
968         :
969 }
970
971 addtask compile after do_configure
972 do_compile[dirs] = "${S} ${B}"
973 base_do_compile() {
974         if [ -e Makefile -o -e makefile ]; then
975                 oe_runmake || die "make failed"
976         else
977                 oenote "nothing to compile"
978         fi
979 }
980
981 base_do_stage () {
982         :
983 }
984
985 do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${layout_bindir} ${STAGING_DIR_TARGET}/${layout_libdir} \
986                              ${STAGING_DIR_TARGET}/${layout_includedir} \
987                              ${STAGING_BINDIR_NATIVE} ${STAGING_LIBDIR_NATIVE} \
988                              ${STAGING_INCDIR_NATIVE} \
989                              ${STAGING_DATADIR} \
990                              ${S} ${B}"
991
992 # Could be compile but populate_staging and do_install shouldn't run at the same time
993 addtask populate_staging after do_install
994
995 python do_populate_staging () {
996     bb.build.exec_func('do_stage', d)
997 }
998
999 addtask install after do_compile
1000 do_install[dirs] = "${D} ${S} ${B}"
1001 # Remove and re-create ${D} so that is it guaranteed to be empty
1002 do_install[cleandirs] = "${D}"
1003
1004 base_do_install() {
1005         :
1006 }
1007
1008 base_do_package() {
1009         :
1010 }
1011
1012 addtask build after do_populate_staging
1013 do_build = ""
1014 do_build[func] = "1"
1015
1016 # Functions that update metadata based on files outputted
1017 # during the build process.
1018
1019 def explode_deps(s):
1020         r = []
1021         l = s.split()
1022         flag = False
1023         for i in l:
1024                 if i[0] == '(':
1025                         flag = True
1026                         j = []
1027                 if flag:
1028                         j.append(i)
1029                         if i.endswith(')'):
1030                                 flag = False
1031                                 r[-1] += ' ' + ' '.join(j)
1032                 else:
1033                         r.append(i)
1034         return r
1035
1036 def packaged(pkg, d):
1037         import os, bb
1038         return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK)
1039
1040 def read_pkgdatafile(fn):
1041         pkgdata = {}
1042
1043         def decode(str):
1044                 import codecs
1045                 c = codecs.getdecoder("string_escape")
1046                 return c(str)[0]
1047
1048         import os
1049         if os.access(fn, os.R_OK):
1050                 import re
1051                 f = file(fn, 'r')
1052                 lines = f.readlines()
1053                 f.close()
1054                 r = re.compile("([^:]+):\s*(.*)")
1055                 for l in lines:
1056                         m = r.match(l)
1057                         if m:
1058                                 pkgdata[m.group(1)] = decode(m.group(2))
1059
1060         return pkgdata
1061
1062 def get_subpkgedata_fn(pkg, d):
1063         import bb, os
1064         archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ")
1065         archs.reverse()
1066         pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d)
1067         targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d)
1068         for arch in archs:
1069                 fn = pkgdata + arch + targetdir + pkg
1070                 if os.path.exists(fn):
1071                         return fn
1072         return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d)
1073
1074 def has_subpkgdata(pkg, d):
1075         import bb, os
1076         return os.access(get_subpkgedata_fn(pkg, d), os.R_OK)
1077
1078 def read_subpkgdata(pkg, d):
1079         import bb
1080         return read_pkgdatafile(get_subpkgedata_fn(pkg, d))
1081
1082 def has_pkgdata(pn, d):
1083         import bb, os
1084         fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
1085         return os.access(fn, os.R_OK)
1086
1087 def read_pkgdata(pn, d):
1088         import bb
1089         fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
1090         return read_pkgdatafile(fn)
1091
1092 python read_subpackage_metadata () {
1093         import bb
1094         data = read_pkgdata(bb.data.getVar('PN', d, 1), d)
1095
1096         for key in data.keys():
1097                 bb.data.setVar(key, data[key], d)
1098
1099         for pkg in bb.data.getVar('PACKAGES', d, 1).split():
1100                 sdata = read_subpkgdata(pkg, d)
1101                 for key in sdata.keys():
1102                         bb.data.setVar(key, sdata[key], d)
1103 }
1104
1105
1106 #
1107 # Collapse FOO_pkg variables into FOO
1108 #
1109 def read_subpkgdata_dict(pkg, d):
1110         import bb
1111         ret = {}
1112         subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d))
1113         for var in subd:
1114                 newvar = var.replace("_" + pkg, "")
1115                 ret[newvar] = subd[var]
1116         return ret
1117
1118 # Make sure MACHINE isn't exported
1119 # (breaks binutils at least)
1120 MACHINE[unexport] = "1"
1121
1122 # Make sure TARGET_ARCH isn't exported
1123 # (breaks Makefiles using implicit rules, e.g. quilt, as GNU make has this 
1124 # in them, undocumented)
1125 TARGET_ARCH[unexport] = "1"
1126
1127 # Make sure DISTRO isn't exported
1128 # (breaks sysvinit at least)
1129 DISTRO[unexport] = "1"
1130
1131
1132 def base_after_parse(d):
1133     import bb, os, exceptions
1134
1135     source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0)
1136     if not source_mirror_fetch:
1137         need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
1138         if need_host:
1139             import re
1140             this_host = bb.data.getVar('HOST_SYS', d, 1)
1141             if not re.match(need_host, this_host):
1142                 raise bb.parse.SkipPackage("incompatible with host %s" % this_host)
1143
1144         need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1)
1145         if need_machine:
1146             import re
1147             this_machine = bb.data.getVar('MACHINE', d, 1)
1148             if this_machine and not re.match(need_machine, this_machine):
1149                 raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine)
1150
1151     pn = bb.data.getVar('PN', d, 1)
1152
1153     # OBSOLETE in bitbake 1.7.4
1154     srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
1155     if srcdate != None:
1156         bb.data.setVar('SRCDATE', srcdate, d)
1157
1158     use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
1159     if use_nls != None:
1160         bb.data.setVar('USE_NLS', use_nls, d)
1161
1162     # Git packages should DEPEND on git-native
1163     srcuri = bb.data.getVar('SRC_URI', d, 1)
1164     if "git://" in srcuri:
1165         depends = bb.data.getVarFlag('do_fetch', 'depends', d) or ""
1166         depends = depends + " git-native:do_populate_staging"
1167         bb.data.setVarFlag('do_fetch', 'depends', depends, d)
1168
1169     # 'multimachine' handling
1170     mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1)
1171     pkg_arch = bb.data.getVar('PACKAGE_ARCH', d, 1)
1172
1173     if (pkg_arch == mach_arch):
1174         # Already machine specific - nothing further to do
1175         return
1176
1177     #
1178     # We always try to scan SRC_URI for urls with machine overrides
1179     # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0
1180     #
1181     override = bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1)
1182     if override != '0':
1183         paths = []
1184         for p in [ "${PF}", "${P}", "${PN}", "files", "" ]:
1185             path = bb.data.expand(os.path.join("${FILE_DIRNAME}", p, "${MACHINE}"), d)
1186             if os.path.isdir(path):
1187                 paths.append(path)
1188         if len(paths) != 0:
1189             for s in srcuri.split():
1190                 if not s.startswith("file://"):
1191                     continue
1192                 local = bb.data.expand(bb.fetch.localpath(s, d), d)
1193                 for mp in paths:
1194                     if local.startswith(mp):
1195                         #bb.note("overriding PACKAGE_ARCH from %s to %s" % (pkg_arch, mach_arch))
1196                         bb.data.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}", d)
1197                         bb.data.setVar('MULTIMACH_ARCH', mach_arch, d)
1198                         return
1199
1200     multiarch = pkg_arch
1201
1202     packages = bb.data.getVar('PACKAGES', d, 1).split()
1203     for pkg in packages:
1204         pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1)
1205
1206         # We could look for != PACKAGE_ARCH here but how to choose 
1207         # if multiple differences are present?
1208         # Look through PACKAGE_ARCHS for the priority order?
1209         if pkgarch and pkgarch == mach_arch:
1210             multiarch = mach_arch
1211             break
1212
1213     bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
1214
1215 python () {
1216     import bb
1217     from bb import __version__
1218     base_after_parse(d)
1219
1220     # Remove this for bitbake 1.8.12
1221     try:
1222         from distutils.version import LooseVersion
1223     except ImportError:
1224         def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1
1225     if (LooseVersion(__version__) >= LooseVersion('1.8.11')):
1226         deps = bb.data.getVarFlag('do_rebuild', 'deps', d) or []
1227         deps.append('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1))
1228         bb.data.setVarFlag('do_rebuild', 'deps', deps, d)
1229 }
1230
1231 def check_app_exists(app, d):
1232         from bb import which, data
1233
1234         app = data.expand(app, d)
1235         path = data.getVar('PATH', d, 1)
1236         return len(which(path, app)) != 0
1237
1238 def check_gcc3(data):
1239         # Primarly used by qemu to make sure we have a workable gcc-3.4.x.
1240         # Start by checking for the program name as we build it, was not
1241         # all host-provided gcc-3.4's will work.
1242
1243         gcc3_versions = 'gcc-3.4.6 gcc-3.4.4 gcc34 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32'
1244
1245         for gcc3 in gcc3_versions.split():
1246                 if check_app_exists(gcc3, data):
1247                         return gcc3
1248         
1249         return False
1250
1251 # Patch handling
1252 inherit patch
1253
1254 # Configuration data from site files
1255 # Move to autotools.bbclass?
1256 inherit siteinfo
1257
1258 EXPORT_FUNCTIONS do_setscene do_clean do_mrproper do_distclean do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_stage do_rebuild do_fetchall
1259
1260 MIRRORS[func] = "0"
1261 MIRRORS () {
1262 ${DEBIAN_MIRROR}/main   http://snapshot.debian.net/archive/pool
1263 ${DEBIAN_MIRROR}        ftp://ftp.de.debian.org/debian/pool
1264 ${DEBIAN_MIRROR}        ftp://ftp.au.debian.org/debian/pool
1265 ${DEBIAN_MIRROR}        ftp://ftp.cl.debian.org/debian/pool
1266 ${DEBIAN_MIRROR}        ftp://ftp.hr.debian.org/debian/pool
1267 ${DEBIAN_MIRROR}        ftp://ftp.fi.debian.org/debian/pool
1268 ${DEBIAN_MIRROR}        ftp://ftp.hk.debian.org/debian/pool
1269 ${DEBIAN_MIRROR}        ftp://ftp.hu.debian.org/debian/pool
1270 ${DEBIAN_MIRROR}        ftp://ftp.ie.debian.org/debian/pool
1271 ${DEBIAN_MIRROR}        ftp://ftp.it.debian.org/debian/pool
1272 ${DEBIAN_MIRROR}        ftp://ftp.jp.debian.org/debian/pool
1273 ${DEBIAN_MIRROR}        ftp://ftp.no.debian.org/debian/pool
1274 ${DEBIAN_MIRROR}        ftp://ftp.pl.debian.org/debian/pool
1275 ${DEBIAN_MIRROR}        ftp://ftp.ro.debian.org/debian/pool
1276 ${DEBIAN_MIRROR}        ftp://ftp.si.debian.org/debian/pool
1277 ${DEBIAN_MIRROR}        ftp://ftp.es.debian.org/debian/pool
1278 ${DEBIAN_MIRROR}        ftp://ftp.se.debian.org/debian/pool
1279 ${DEBIAN_MIRROR}        ftp://ftp.tr.debian.org/debian/pool
1280 ${GNU_MIRROR}   ftp://mirrors.kernel.org/gnu
1281 ${GNU_MIRROR}   ftp://ftp.matrix.com.br/pub/gnu
1282 ${GNU_MIRROR}   ftp://ftp.cs.ubc.ca/mirror2/gnu
1283 ${GNU_MIRROR}   ftp://sunsite.ust.hk/pub/gnu
1284 ${GNU_MIRROR}   ftp://ftp.ayamura.org/pub/gnu
1285 ${KERNELORG_MIRROR}     http://www.kernel.org/pub
1286 ${KERNELORG_MIRROR}     ftp://ftp.us.kernel.org/pub
1287 ${KERNELORG_MIRROR}     ftp://ftp.uk.kernel.org/pub
1288 ${KERNELORG_MIRROR}     ftp://ftp.hk.kernel.org/pub
1289 ${KERNELORG_MIRROR}     ftp://ftp.au.kernel.org/pub
1290 ${KERNELORG_MIRROR}     ftp://ftp.jp.kernel.org/pub
1291 ftp://ftp.gnupg.org/gcrypt/     ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/
1292 ftp://ftp.gnupg.org/gcrypt/     ftp://ftp.surfnet.nl/pub/security/gnupg/
1293 ftp://ftp.gnupg.org/gcrypt/     http://gulus.USherbrooke.ca/pub/appl/GnuPG/
1294 ftp://dante.ctan.org/tex-archive ftp://ftp.fu-berlin.de/tex/CTAN
1295 ftp://dante.ctan.org/tex-archive http://sunsite.sut.ac.jp/pub/archives/ctan/
1296 ftp://dante.ctan.org/tex-archive http://ctan.unsw.edu.au/
1297 ftp://ftp.gnutls.org/pub/gnutls ftp://ftp.gnutls.org/pub/gnutls/
1298 ftp://ftp.gnutls.org/pub/gnutls ftp://ftp.gnupg.org/gcrypt/gnutls/
1299 ftp://ftp.gnutls.org/pub/gnutls http://www.mirrors.wiretapped.net/security/network-security/gnutls/
1300 ftp://ftp.gnutls.org/pub/gnutls ftp://ftp.mirrors.wiretapped.net/pub/security/network-security/gnutls/
1301 ftp://ftp.gnutls.org/pub/gnutls http://josefsson.org/gnutls/releases/
1302 http://ftp.info-zip.org/pub/infozip/src/ http://mirror.switch.ch/ftp/mirror/infozip/src/
1303 http://ftp.info-zip.org/pub/infozip/src/ ftp://sunsite.icm.edu.pl/pub/unix/archiving/info-zip/src/
1304 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof/
1305 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://ftp.tau.ac.il/pub/unix/admin/
1306 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://ftp.cert.dfn.de/pub/tools/admin/lsof/
1307 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/
1308 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://ftp.kaizo.org/pub/lsof/
1309 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://ftp.tu-darmstadt.de/pub/sysadmin/lsof/
1310 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://ftp.tux.org/pub/sites/vic.cc.purdue.edu/tools/unix/lsof/
1311 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://gd.tuwien.ac.at/utils/admin-tools/lsof/
1312 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://sunsite.ualberta.ca/pub/Mirror/lsof/
1313 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  ftp://the.wiretapped.net/pub/security/host-security/lsof/
1314 http://www.apache.org/dist  http://archive.apache.org/dist
1315
1316 }
1317