Ejemplo n.º 1
0
 def get_packager(self):
     p = self.get_cf('packager', None)
     if p is None:
         warn("Target %s has no packager specified. Defaulting to apt" %
              self['target.name'])
         return 'apt'
     return p
Ejemplo n.º 2
0
    def __init__(self, name, spec, conf):
        if spec is None:
            warn("pkg spec is None for package: " + name)
            spec = {}

        SpecObject.__init__(self, spec)

        self.conf = conf
        self.name = name
        self._my_db = {}

        ## split package name / version
        (self.package_name,
         self.package_version) = self._split_pkg_version(self.name)

        ## load repo configs from csdb
        for dbn in self.conf.csdb.get_dbnames():
            self._load_db(dbn)

        ## add variables for substitution
        self.default_addlist({
            'GLOBAL': self.conf,
            'config.basedir': "${GLOBAL::config.basedir}",
            'package.version': lambda: self.package_version,
            'package.name': lambda: self.package_name,
            'package.fqname': lambda: self.name,
            'package.src':
            "${GLOBAL::pathes::pkg-prefix}${package.fqname}${GLOBAL::pathes::pkg-suffix}",
            'autobuild-local': 'autobuild',
        })

        # add global defaults
        self.default_addlist(self.conf['defaults', 'packages'])
Ejemplo n.º 3
0
 def get_head_commit(self):
     args = ['rev-parse', '--verify', 'HEAD^{commit}']
     try:
         return self._gitout(args)
     except OSError as err:
         warn("get_head_commit() failed: " + str(err))
         return None
Ejemplo n.º 4
0
 def get_target(self, name):
     tl = []
     for tn in self.get_target_list():
         if (tn == name):
             return self.conf.load_target(tn, self)
     warn("pool %s: undefined target requested: %s" %
          (self['pool.name'], name))
Ejemplo n.º 5
0
    def load(self, fn):
        self.load_spec(fn)
        self.__intrinsics()

        csdb_path = self['csdb', 'path']
        if csdb_path is None:
            warn("CSDB path should be specified in 'csdb:' block.")
            csdb_path = self.get_pathconf('csdb-path')

        self.csdb = CSDB(csdb_path, self.get_cf(['csdb', 'sections']))

        # load target configs
        for t in self.get_cf('targets'):
            self._my_targets[t] = self.load_target(t, None)
Ejemplo n.º 6
0
 def _cf_dckbp(self, key, dflt, wmsg):
     cf = self.get_cf(['dck-buildpackage', key])
     if cf is None:
         warn(wmsg)
         return dflt
     return cf
Ejemplo n.º 7
0
 def log_warn(self, text):
     warn("("+self.name+") "+text)