Example #1
0
File: make.py Project: ndparker/wtf
    def _tag_release(self):
        """ Tag release """
        from _setup.util import SafeConfigParser as parser
        parser = parser()
        parser.read('package.cfg', **cfgread)
        strversion = parser.get('package', 'version.number')
        isdev = parser.getboolean('package', 'version.dev')
        revision = parser.getint('package', 'version.revision')
        version = strversion
        if isdev:
            version += '-dev-r%d' % (revision,)
        trunk_url = self._repo_url()
        if not trunk_url.endswith('/trunk'):
            rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
            match = rex(trunk_url)
            if not match:
                make.fail("Not in trunk or release branch!")
            found = match.start(0)
        else:
            found = -len('/trunk')
        release_url = trunk_url[:found] + '/releases/' + version

        svn = shell.frompath('svn')
        shell.spawn(
            svn, 'copy', '-m', 'Release version ' + version, '--',
            trunk_url, release_url,
            echo=True,
        )
Example #2
0
    def _tag_release(self):
        """ Tag release """
        from _setup.util import SafeConfigParser as parser
        parser = parser()
        parser.read('package.cfg', **cfgread)
        strversion = parser.get('package', 'version.number')
        version = strversion
        trunk_url = self._repo_url()
        if not trunk_url.endswith('/trunk'):
            rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
            match = rex(trunk_url)
            if not match:
                make.fail("Not in trunk or release branch!")
            found = match.start(0)
        else:
            found = -len('/trunk')
        release_url = trunk_url[:found] + '/releases/' + version

        svn = shell.frompath('svn')
        shell.spawn(
            svn,
            'copy',
            '-m',
            'Release version ' + version,
            '--',
            trunk_url,
            release_url,
            echo=True,
        )
Example #3
0
    def sign(self, filename, detach=True):
        filename = _shell.native(filename)
        try:
            from pyme import core, errors
            from pyme.constants.sig import mode
        except ImportError:
            return self.sign_external(filename, detach=detach)

        _term.green("signing %(name)s...", name=_os.path.basename(filename))
        sigmode = [mode.CLEAR, mode.DETACH][bool(detach)]
        fp = core.Data(file=filename)
        sig = core.Data()
        try:
            c = core.Context()
        except errors.GPGMEError:
            return self.sign_external(filename, detach=detach)
        c.set_armor(1)
        try:
            c.op_sign(fp, sig, sigmode)
        except errors.GPGMEError as e:
            _make.fail(str(e))

        sig.seek(0, 0)
        if detach:
            open("%s.asc" % filename, "w", encoding='utf-8').write(sig.read())
        else:
            open(filename, "w", encoding='utf-8').write(sig.read())

        return True
Example #4
0
    def sign(self, filename, detach=True):
        filename = _shell.native(filename)
        try:
            from pyme import core, errors
            from pyme.constants.sig import mode
        except ImportError:
            return self.sign_external(filename, detach=detach)

        _term.green("signing %(name)s...", name=_os.path.basename(filename))
        sigmode = [mode.CLEAR, mode.DETACH][bool(detach)]
        fp = core.Data(file=filename)
        sig = core.Data()
        try:
            c = core.Context()
        except errors.GPGMEError:
            return self.sign_external(filename, detach=detach)
        c.set_armor(1)
        try:
            c.op_sign(fp, sig, sigmode)
        except errors.GPGMEError as e:
            _make.fail(str(e))

        sig.seek(0, 0)
        if detach:
            open("%s.asc" % filename, "w", encoding='utf-8').write(sig.read())
        else:
            open(filename, "w", encoding='utf-8').write(sig.read())

        return True
Example #5
0
File: make.py Project: ndparker/tdi
    def _tag_release(self):
        """ Tag release """
        from _setup.util import SafeConfigParser as parser

        parser = parser()
        parser.read("package.cfg", **cfgread)
        strversion = parser.get("package", "version.number")
        isdev = parser.getboolean("package", "version.dev")
        revision = parser.getint("package", "version.revision")
        version = strversion
        if isdev:
            version += "-dev-r%d" % (revision,)
        trunk_url = self._repo_url()
        if not trunk_url.endswith("/trunk"):
            rex = _re.compile(r"/branches/\d+(?:\.\d+)*\.[xX]$").search
            match = rex(trunk_url)
            if not match:
                make.fail("Not in trunk or release branch!")
            found = match.start(0)
        else:
            found = -len("/trunk")
        release_url = trunk_url[:found] + "/releases/" + version

        svn = shell.frompath("svn")
        shell.spawn(svn, "copy", "-m", "Release version " + version, "--", trunk_url, release_url, echo=True)
Example #6
0
File: make.py Project: ndparker/wtf
 def _revision(self):
     """ Find SVN revision """
     rev = shell.spawn(shell.frompath('svnversion'), '.', stdout=True)
     rev = rev.strip()
     if ':' in rev:
         rev = rev.split(':')[1]
     try:
         rev = int(rev)
     except ValueError:
         try:
             rev = int(rev[:-1])
         except ValueError:
             make.fail("No clean revision found (%s)" % rev)
     return rev
Example #7
0
 def _revision(self):
     """ Find SVN revision """
     rev = shell.spawn(shell.frompath('svnversion'), '.', stdout=True)
     rev = rev.strip()
     if ':' in rev:
         rev = rev.split(':')[1]
     try:
         rev = int(rev)
     except ValueError:
         try:
             rev = int(rev[:-1])
         except ValueError:
             make.fail("No clean revision found (%s)" % rev)
     return rev
Example #8
0
File: make.py Project: ndparker/wtf
 def _check_committed(self):
     """ Check if everything is committed """
     if not self._repo_url().endswith('/trunk'):
         rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
         match = rex(self._repo_url())
         if not match:
             make.fail("Not in trunk or release branch!")
     svn = shell.frompath('svn')
     lines = shell.spawn(svn, 'stat', '--ignore-externals',
         stdout=True, env=dict(_os.environ, LC_ALL='C'),
     ).splitlines()
     for line in lines:
         if line.startswith('X'):
             continue
         make.fail("Uncommitted changes!")
Example #9
0
 def _check_committed(self):
     """ Check if everything is committed """
     if not self._repo_url().endswith('/trunk'):
         rex = _re.compile(r'/branches/\d+(?:\.\d+)*\.[xX]$').search
         match = rex(self._repo_url())
         if not match:
             make.fail("Not in trunk or release branch!")
     svn = shell.frompath('svn')
     lines = shell.spawn(svn, 'stat', '--ignore-externals',
         stdout=True, env=dict(_os.environ, LC_ALL='C'),
     ).splitlines()
     for line in lines:
         if line.startswith('X'):
             continue
         make.fail("Uncommitted changes!")
Example #10
0
    def sign(self, filename, detach=True):
        filename = _shell.native(filename)
        try:
            from pyme import core, errors
            from pyme.constants.sig import mode
        except ImportError:
            return self.sign_external(filename, detach=detach)

        _term.green("signing %(name)s...", name=_os.path.basename(filename))
        sigmode = [mode.CLEAR, mode.DETACH][bool(detach)]
        fp = core.Data(file=filename)
        sig = core.Data()
        try:
            c = core.Context()
        except errors.GPGMEError:
            return self.sign_external(filename, detach=detach)
        c.set_armor(1)
        try:
            c.op_sign(fp, sig, sigmode)
        except errors.GPGMEError, e:
            _make.fail(str(e))
Example #11
0
File: targets.py Project: AvdN/tdi
    def sign(self, filename, detach=True):
        filename = _shell.native(filename)
        try:
            from pyme import core, errors
            from pyme.constants.sig import mode
        except ImportError:
            return self.sign_external(filename, detach=detach)

        _term.green("signing %(name)s...", name=_os.path.basename(filename))
        sigmode = [mode.CLEAR, mode.DETACH][bool(detach)]
        fp = core.Data(file=filename)
        sig = core.Data()
        try:
            c = core.Context()
        except errors.GPGMEError:
            return self.sign_external(filename, detach=detach)
        c.set_armor(1)
        try:
            c.op_sign(fp, sig, sigmode)
        except errors.GPGMEError, e:
            _make.fail(str(e))
Example #12
0
    def _check_committed(self):
        """ Check if everything is committed """
        git = shell.frompath('git')
        lines = shell.spawn(git,
                            'branch',
                            '--color=never',
                            stdout=True,
                            env=dict(_os.environ, LC_ALL='C')).splitlines()
        for line in lines:
            if line.startswith('*'):
                branch = line.split(None, 1)[1]
                break
        else:
            make.fail("Could not determine current branch.")
        if branch != 'master':
            rex = _re.compile(r'^\d+(?:\.\d+)*\.[xX]$').match
            match = rex(branch)
            if not match:
                make.fail("Not in master or release branch.")

        lines = shell.spawn(
            git,
            'status',
            '--porcelain',
            stdout=True,
            env=dict(_os.environ, LC_ALL='C'),
        )
        if lines:
            make.fail("Uncommitted changes!")
Example #13
0
    def _check_committed(self):
        """ Check if everything is committed """
        git = shell.frompath('git')
        lines = shell.spawn(
            git, 'branch', '--color=never',
            stdout=True, env=dict(_os.environ, LC_ALL='C')
        ).splitlines()
        for line in lines:
            if line.startswith('*'):
                branch = line.split(None, 1)[1]
                break
        else:
            make.fail("Could not determine current branch.")
        if branch != 'master':
            rex = _re.compile(r'^\d+(?:\.\d+)*\.[xX]$').match
            match = rex(branch)
            if not match:
                make.fail("Not in master or release branch.")

        lines = shell.spawn(
            git, 'status', '--porcelain',
            stdout=True, env=dict(_os.environ, LC_ALL='C'),
        )
        if lines:
            make.fail("Uncommitted changes!")
Example #14
0
File: make.py Project: ndparker/tdi
    def _check_committed(self):
        """ Check if everything is committed """
        git = shell.frompath("git")
        lines = shell.spawn(git, "branch", "--color=never", stdout=True, env=dict(_os.environ, LC_ALL="C")).splitlines()
        for line in lines:
            if line.startswith("*"):
                branch = line.split(None, 1)[1]
                break
        else:
            make.fail("Could not determine current branch.")
        if branch != "master":
            rex = _re.compile(r"^\d+(?:\.\d+)*\.[xX]$").match
            match = rex(branch)
            if not match:
                make.fail("Not in master or release branch.")

        lines = shell.spawn(git, "status", "--porcelain", stdout=True, env=dict(_os.environ, LC_ALL="C"))
        if lines:
            make.fail("Uncommitted changes!")