Ejemplo n.º 1
0
    def __init__(self, dist='squeeze', arch='i386',
                 buildd='builder', user=None):
        SecureShellHandler.__init__(self, buildd, user=user)
        self.arch = arch
        self.dist = dist
        # this should also be self.host
        self.buildd = buildd
        # this should also be self.user
        self.buildd_user = user
        
        self.buildd_incoming = 'cowbuilder-incoming'

        
        self.verbose = False
        self.watch_build_process = False
        self.tailproc = None
        self.buildproc = None
        self.build_logfile = None
        self.logdir = path.getcwd() / 'logs'
        if not self.logdir.isdir():
            self.logdir.makedirs()
            
        self.system_pbuilderrc_filename = '%s-pbuilderrc' % self.host
        self.dpkg_opts = []
        self.current_package = None

        self.local_pbuilderrc_config_dir = 'pbuilderrc'
        self.pbuilder_basedir = '/var/cache/pbuilder/buildbase'
Ejemplo n.º 2
0
def get_dirname(pkgname):
    here = path.getcwd()
    ls = [f.relpath() for f in here.listdir()]
    marker = '%s-' % pkgname
    pkgdirs = [f for f in ls if f.startswith(marker) and f.isdir()]
    if not pkgdirs or len(pkgdirs) > 1:
        msg = "unable to find extracted directory for %s" % pkgname
        raise RuntimeError , msg
    return pkgdirs.pop()
Ejemplo n.º 3
0
def build_source_package(dirname):
    here = path.getcwd()
    os.chdir(dirname)
    cmd = ['dch', 'local build']
    subprocess.check_call(cmd)
    cmd = ['dpkg-buildpackage', '-S', '-sa']
    retcode = subprocess.call(cmd)
    if retcode not in [0, 1]:
        raise RuntimeError , "dpkg-buildpackage returned %d" % retcode
    os.chdir(here)
Ejemplo n.º 4
0
def cleanup(pkgname):
    here = path.getcwd()
    ls = [f.relpath() for f in here.listdir()]
    marker = '%s-' % pkgname
    dirtyfiles = [f for f in ls if f.startswith(marker) and f.isfile()]
    for fname in dirtyfiles:
        print "Removing", fname
        os.remove(fname)
    dirtydirs = [f for f in ls if f.startswith(marker) and f.isdir()]
    for dname in dirtydirs:
        print "Removing", dname
        cmd = ['rm', '-fr', dname]
        subprocess.check_call(cmd)
Ejemplo n.º 5
0
def get_dscfile(pkgname):
    here = path.getcwd()
    ls = [f.relpath() for f in here.listdir()]
    filtered = [f for f in ls if f.startswith(pkgname) and f.endswith('.dsc')]
    #print "FILTERED", filtered
    if len(filtered) == 1:
        return filtered[0]
    if len(filtered) != 2:
        raise RuntimeError , "something bad happened, too many .dsc files"
    versions = [f.split('_')[1] for f in filtered]
    versions = [f.split('.dsc')[0] for f in versions]
    compare = apt.VersionCompare(*versions)
    if not compare:
        raise RuntimeError , "There has been no update in the changelog"
    if compare == 1:
        return filtered[0]
    elif compare == -1:
        return filtered[1]
    else:
        raise RuntimeError , "There has been an unknown problem"
Ejemplo n.º 6
0
 def __init__(self, basedir=None):
     if basedir is None:
         basedir = path.getcwd()
     self.set_basedir(basedir)
     self.clean_proc()