OE Package
authorChris Larson <clarson@kergoth.com>
Sat, 14 Jun 2003 17:29:02 +0000 (17:29 +0000)
committerChris Larson <clarson@kergoth.com>
Sat, 14 Jun 2003 17:29:02 +0000 (17:29 +0000)
bin/classes/base.oeclass
bin/data
bin/fetch
bin/oe/fetch.py
bin/oebuild
bin/oeread
bin/parse

index 045455c..7f51b61 100644 (file)
@@ -8,8 +8,8 @@ python base_do_patch () {
                (type, host, path, user, pswd, parm) = decodeurl(expand(url))
                if not parm.has_key("patch"):
                        continue
-               oefetch.init([url])
-               local = oefetch.localpath(url)
+               oe.fetch.init([url])
+               local = oe.fetch.localpath(url)
                # patch!
                dots = local.split(".")
                if dots[-2] in ['tar']:
index 25c8391..7300f83 100644 (file)
--- a/bin/data
+++ b/bin/data
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-from oedata import *
+from oe.data import *
 
 def niftyPrint(d = getData()):
        for var in d.keys():
index 4560798..e2eb9ce 100644 (file)
--- a/bin/fetch
+++ b/bin/fetch
@@ -1,8 +1,8 @@
 #!/usr/bin/python
 
-import oefetch
+import oe.fetch
 
 urls = ["cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;module=familiar/dist/ipkg;tag=V-99-84"]
 
-oefetch.init(urls)
-oefetch.go()
+oe.fetch.init(urls)
+oe.fetch.go()
index 7b70a84..cc14db7 100644 (file)
@@ -12,7 +12,8 @@ Based on functions from the base oe module, Copyright 2003 Holger Schurig
 """
 
 import os, re
-from oe import *
+import oe
+import oe.data
 
 class FetchError(Exception):
        """Exception raised when a download fails"""
@@ -37,7 +38,8 @@ def init(urls = []):
 def go():
        """Fetch all urls"""
        for m in methods:
-               m.go()
+               if m.urls:
+                       m.go()
 
 def localpaths():
        """Return a list of the local filenames, assuming successful fetch"""
@@ -59,7 +61,7 @@ class Fetch(object):
        def __init__(self, urls = []):
                self.urls = []
                for url in urls:
-                       if self.supports(decodeurl(url)) is 1:
+                       if self.supports(oe.decodeurl(url)) is 1:
                                self.urls.append(url)
 
        def supports(url):
@@ -93,18 +95,18 @@ class Wget(Fetch):
                """Check to see if a given url can be fetched using wget.
                   Expects supplied url in list form, as outputted by oe.decodeurl().
                """
-               (type, host, path, user, pswd, parm) = decodeurl(expand(url))
+               (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(url))
                return type in ['http','https','ftp']
        supports = staticmethod(supports)
 
        def localpath(url):
                # strip off parameters
-               (type, host, path, user, pswd, parm) = decodeurl(expand(url))
+               (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(url))
                if parm.has_key("localpath"):
                        # if user overrides local path, use it.
                        return parm["localpath"]
-               url = encodeurl([type, host, path, user, pswd, {}])
-               return os.path.join(getenv("DL_DIR"), os.path.basename(url))
+               url = oe.encodeurl([type, host, path, user, pswd, {}])
+               return os.path.join(oe.getenv("DL_DIR"), os.path.basename(url))
        localpath = staticmethod(localpath)
 
        def go(self, urls = []):
@@ -113,15 +115,15 @@ class Wget(Fetch):
                        urls = self.urls
 
                for loc in urls:
-                       (type, host, path, user, pswd, parm) = decodeurl(expand(loc))
+                       (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(loc))
                        myfile = os.path.basename(path)
                        dlfile = self.localpath(loc)
 
-                       myfetch = getenv("RESUMECOMMAND")
-                       note("fetch " +loc)
-                       myfetch = myfetch.replace("${URI}",encodeurl([type, host, path, user, pswd, {}]))
+                       myfetch = oe.getenv("RESUMECOMMAND")
+                       oe.note("fetch " +loc)
+                       myfetch = myfetch.replace("${URI}",oe.encodeurl([type, host, path, user, pswd, {}]))
                        myfetch = myfetch.replace("${FILE}",myfile)
-                       debug(2,myfetch)
+                       oe.debug(2,myfetch)
                        myret = os.system(myfetch)
                        if myret != 0:
                                raise FetchError(myfile)
@@ -137,12 +139,12 @@ class Cvs(Fetch):
                """Check to see if a given url can be fetched with cvs.
                   Expects supplied url in list form, as outputted by oe.decodeurl().
                """
-               (type, host, path, user, pswd, parm) = decodeurl(expand(url))
+               (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(url))
                return type in ['cvs', 'pserver']
        supports = staticmethod(supports)
 
        def localpath(url):
-               (type, host, path, user, pswd, parm) = decodeurl(expand(url))
+               (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(url))
                if parm.has_key("localpath"):
                        # if user overrides local path, use it.
                        return parm["localpath"]
@@ -150,7 +152,7 @@ class Cvs(Fetch):
                if not parm.has_key("module"):
                        return url
                else:
-                       return os.path.join(getenv("DL_DIR"), parm["module"])
+                       return os.path.join(oe.getenv("DL_DIR"), parm["module"])
        localpath = staticmethod(localpath)
 
        def go(self, urls = []):
@@ -159,7 +161,7 @@ class Cvs(Fetch):
                        urls = self.urls
 
                for loc in urls:
-                       (type, host, path, user, pswd, parm) = decodeurl(expand(loc))
+                       (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(loc))
                        if not parm.has_key("module"):
                                raise MissingParameterError("cvs method needs a 'module' parameter")
                        else:
@@ -186,7 +188,7 @@ class Cvs(Fetch):
                        else:
                                method = "pserver"
 
-                       os.chdir(expand(dldir))
+                       os.chdir(oe.expand(dldir))
                        cvsroot = ":" + method + ":" + user
                        if pswd is not None:
                                cvsroot += ":" + pswd
@@ -201,7 +203,7 @@ class Cvs(Fetch):
 
                        cvscmd = "cvs -d" + cvsroot
                        cvscmd += " checkout " + string.join(options) + " " + module 
-                       note("fetch " + loc)
+                       oe.note("fetch " + loc)
                        myret = os.system(cvscmd)
                        if myret != 0:
                                raise FetchError(module)
@@ -213,7 +215,7 @@ class Bk(Fetch):
                """Check to see if a given url can be fetched via bitkeeper.
                   Expects supplied url in list form, as outputted by oe.decodeurl().
                """
-               (type, host, path, user, pswd, parm) = decodeurl(expand(url))
+               (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(url))
                return type in ['bk']
        supports = staticmethod(supports)
 
@@ -224,7 +226,7 @@ class Local(Fetch):
                """Check to see if a given url can be fetched in the local filesystem.
                   Expects supplied url in list form, as outputted by oe.decodeurl().
                """
-               (type, host, path, user, pswd, parm) = decodeurl(expand(url))
+               (type, host, path, user, pswd, parm) = oe.decodeurl(oe.expand(url))
                return type in ['file','patch']
        supports = staticmethod(supports)
 
index 045ce99..fbb346c 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 import sys,os,string
-import oefetch
+import oe.fetch
 sys.path.append(os.path.join(sys.prefix,'share/oe'))
 from oe import *
 
@@ -198,19 +198,19 @@ def do_fetch():
 
        if env.has_key('SRC_URI'):
                try:
-                       oefetch.init(getenv('SRC_URI').split())
-               except oefetch.NoMethodError:
+                       oe.fetch.init(getenv('SRC_URI').split())
+               except oe.fetch.NoMethodError:
                        (type, value, traceback) = sys.exc_info()
                        fatal("No method: %s" % value)
                        return
 
                try:
-                       oefetch.go()
-               except oefetch.MissingParameterError:
+                       oe.fetch.go()
+               except oe.fetch.MissingParameterError:
                        (type, value, traceback) = sys.exc_info()
                        fatal("Missing parameters: %s" % value)
                        return
-               except oefetch.FetchError:
+               except oe.fetch.FetchError:
                        (type, value, traceback) = sys.exc_info()
                        fatal("Fetch failed: %s" % value)
                        return
index 59a5835..48b98aa 100644 (file)
@@ -1,4 +1,4 @@
 #!/usr/bin/python
 
-import oeparse
-cfg = oeparse.handle("conf/oe.conf")
+import oe.parse
+cfg = oe.parse.handle("conf/oe.conf")
index 46fd8d4..0f32d3e 100644 (file)
--- a/bin/parse
+++ b/bin/parse
@@ -1,11 +1,11 @@
 #!/usr/bin/python
 
-import oeparse
+import oe.parse
 
-cfgdata = oeparse.handle("conf/oe.conf")
+cfgdata = oe.parse.handle("conf/oe.conf")
 
 from copy import copy
-testdata = oeparse.handle("test.oe", copy(cfgdata))
+testdata = oe.parse.handle("test.oe", copy(cfgdata))
 
 print "testdata: "
 print "\t%s" % testdata