Beispiel #1
0
    def clean(self):

        if self.clean_yes:
            Blog.info("cleaning %s" % self.name)
            Bos.get_env(self._native)
            ret,logname = bos_run(['make', '-C', os.path.join(Bos.topdir, self._src),
                                   '-f', os.path.join(Bos.mkdir, os.path.basename(self.mk)),
                                   '--no-print-directory',
                                   'clean'])
            if 0 != ret: Blog.warn('%s unable to clean' % self.name)
            self._revert_patch()

            if self._gitdir:
                with BosLockFile(os.path.join(Bos.topdir, self._gitdir, '.bos.lock')) as lock:
                    bos_run(['git', '--git-dir=%s' % os.path.join(Bos.topdir, self._gitdir),
                             'clean', '-Xfd'])

            self._uninstall()

            try:
                for fn in glob.glob('%s.?' % (Bos.statesdir + self.name)): os.unlink(fn)
                Bos.touch(Bos.statesdir + self.name + '.v')
            except OSError as e:
                Blog.warn(e.strerror + ': ' + e.filename)

            try:
                shutil.rmtree(os.path.dirname(self._get_logdir()))
            except: pass

        return (0, None)
Beispiel #2
0
    def compile(self):

        if self.compile_yes:
            Blog.info("compiling %s" % self.name)
            Bos.get_env(self._native)
            return bos_run(['make', '-C', os.path.join(Bos.topdir, self._src),
                            '-f', os.path.join(Bos.mkdir, os.path.basename(self.mk)),
                            '--no-print-directory',
                            'compile'], self._get_logdir() + '-compile')
        return (0, None)
Beispiel #3
0
    def prepare(self):

        Blog.info("preparing %s" % self.name)
        self._apply_patch()

        if self.prepare_yes:
            Bos.get_env(self._native)
            return bos_run(['make', '-C', os.path.join(Bos.topdir, self._src),
                            '-f', os.path.join(Bos.mkdir, os.path.basename(self.mk)),
                            '--no-print-directory',
                            'MK=%s' % os.path.dirname(os.path.join(Bos.topdir, self.mk)),
                            'prepare'], self._get_logdir() + '-prepare')
        return (0, None)
Beispiel #4
0
    def install(self):

        ret = 0
        logname = None
        self._uninstall()
        if self.install_yes:
            Blog.info("installing %s" % self.name)
            if not os.path.exists(self._get_stagingdir()): os.makedirs(self._get_stagingdir())
            ret,logname = bos_run(['make', '-C', os.path.join(Bos.topdir, self._src),
                                   '-f', os.path.join(Bos.mkdir, os.path.basename(self.mk)),
                                   '--no-print-directory',
                                   'DESTDIR=%s' % self._get_stagingdir(),
                                   'install'], self._get_logdir() + '-install')
            if 0 == ret: ret = self._install()
            shutil.rmtree(self._get_stagingdir())

        if 0 == ret:
            ## record package version
            self._version = self._get_version()
            self._flush()
        return (ret, logname)
Beispiel #5
0
Datei: bosm.py Projekt: bosm/bos
def _check_package_version():

    from bomb.package import BosPackage

    names = _all_pkgs()
    for name in names:
        pkg = BosPackage.open(name)

        dot_v = os.path.join(Bos.statesdir, name + '.v')
        dot_d = os.path.join(Bos.statesdir, name + '.d')
        if not os.path.exists(dot_v): Bos.touch(dot_v)

        if True == pkg.is_version_diff():
            if os.path.exists(dot_d):
                Blog.info("%s: rebuild required" % name)
                Bos.touch(dot_v)
        else:
            if not os.path.exists(dot_d):
               Bos.touch(os.path.join(Bos.statesdir, name + '.p'))
               Bos.touch(os.path.join(Bos.statesdir, name + '.f'))
               Bos.touch(os.path.join(Bos.statesdir, name + '.b'))
               Bos.touch(dot_d)
Beispiel #6
0
    def purge(self):

        if self.clean_yes:
            Blog.info("purging %s" % self.name)
            Bos.get_env(self._native)
            ret,logname = bos_run(['make', '-C', os.path.join(Bos.topdir, self._src),
                                   '-f', os.path.join(Bos.mkdir, os.path.basename(self.mk)),
                                   '--no-print-directory',
                                   'clean'])
            if 0 != ret: Blog.warn('%s unable to clean' % self.name)
            self._revert_patch()

            if self._gitdir:
                with BosLockFile(os.path.join(Bos.topdir, self._gitdir, '.bos.lock')) as lock:
                    from subprocess import Popen, PIPE
                    Popen('rm -fr %s/*' % os.path.join(Bos.topdir, self._src),
                          shell = True,
                          stdout = PIPE, stderr = PIPE
                          ).communicate()
                    Popen('cd %s/.. && git reset --hard' % os.path.join(Bos.topdir, self._gitdir),
                          shell = True,
                          stdout = PIPE, stderr = PIPE
                          ).communicate()

            self._purge()

            try:
                for fn in glob.glob('%s.?' % (Bos.statesdir + self.name)): os.unlink(fn)
                Bos.touch(Bos.statesdir + self.name + '.v')
            except OSError as e:
                Blog.warn(e.strerror + ': ' + e.filename)

            try:
                shutil.rmtree(os.path.dirname(self._get_logdir()))
            except: pass

        return (0, None)