Ejemplo n.º 1
0
def get_new_dependencies(dir, accepted_tag_pattern=None):
    cfile = ControlFile(filename=os.path.join(dir, 'debian', 'control'))
    packages = cfile.get_packages()

    version = ".".join(map(str, compute_version(get_git_describe(repository_directory=dir, fix_environment=True, accepted_tag_pattern=accepted_tag_pattern))))
    for p in packages:
        p.version = version

    return packages
Ejemplo n.º 2
0
 def test_higher_version_preferred_even_when_tag_is_on_top_of_the_tree(self):
     """
     As previous test, but some git versions change their output when tagged version is also HEAD
     """
     try:
         self.prepare(tag_latest_version=True)
         self.assertEquals((1, 3, 0), compute_version(
             get_git_describe(repository_directory=self.repo, fix_environment=True, accepted_tag_pattern='repo-*')
         ))
     finally:
         rmtree(self.repo)
         os.chdir(self.oldcwd)
Ejemplo n.º 3
0
def get_package_path(package_name, module_name, current_version=None):
    """ Return filesystem path to debian package build by bdist_deb"""
    if not current_version:
        #FIXME: not to hardcode
        format = "%s-[0-9]*" % module_name
        current_version = '.'.join(map(str, compute_version(get_git_describe(accepted_tag_pattern=format))))
    package_name = u"%(name)s_%(version)s_%(arch)s.deb" % {
        'name' : package_name,
        'version' : current_version,
        'arch' : 'all'
    }
    return os.path.normpath(os.path.join(os.curdir, os.pardir, package_name))
Ejemplo n.º 4
0
def compute_version_git(options):
    from citools.version import get_git_describe, compute_version

    if not getattr(options, "accepted_tag_pattern", None):
        options.accepted_tag_pattern = "%s-[0-9]*" % options.name

    current_git_version = get_git_describe(accepted_tag_pattern=options.accepted_tag_pattern)

    options.version = compute_version(current_git_version)
    options.version_str = '.'.join(map(str, options.version))

    print options.version_str
Ejemplo n.º 5
0
 def test_higher_version_always_preferred(self):
     """
     Check we're retrieving "higher" version, meaning number of tags since higher version tag,
     unlike git describe which is prefferring tag that has lower number of commits to current HEAD.
     """
     try:
         self.prepare()
         self.assertEquals((1, 2, 4), compute_version(
             get_git_describe(repository_directory=self.repo, fix_environment=True, accepted_tag_pattern='repo-*')
         ))
     finally:
         rmtree(self.repo)
         os.chdir(self.oldcwd)
Ejemplo n.º 6
0
def compute_version_git(options):
    from citools.version import get_git_describe, compute_version, get_branch_suffix, retrieve_current_branch
    if not getattr(options, "accepted_tag_pattern", None):
        options.accepted_tag_pattern = "%s-[0-9]*" % options.name

    dist = _get_distribution()

    current_git_version = get_git_describe(accepted_tag_pattern=options.accepted_tag_pattern)
    branch_suffix = get_branch_suffix(dist.metadata, retrieve_current_branch())

    options.version = compute_version(current_git_version)
    dist.metadata.version = options.version_str = '.'.join(map(str, options.version))

    dist.metadata.branch_suffix = options.branch_suffix = branch_suffix

    print options.version_str
Ejemplo n.º 7
0
def get_new_dependencies(dir, accepted_tag_pattern=None, branch="master"):
    
    version = compute_version(get_git_describe(repository_directory=dir, fix_environment=True, accepted_tag_pattern=accepted_tag_pattern))
    control = os.path.join(dir, 'debian', 'control')

    version = ".".join(map(str, version))
    
    ### FIXME: We shall not do this again AND should only use templates
    from citools.build import replace_template_files
    replace_template_files(root_directory=dir, variables={
        'branch' : branch,
        'version' : version,
    })

    
    cfile = ControlFile(filename=control)
    packages = cfile.get_packages()

    for p in packages:
        p.version = version

    return packages
Ejemplo n.º 8
0
def bump():
    """
    Bump most-minor tagged version. Assumes git.
    
    Bump is completed only since last release. This is assumed to have
    $projectname-[digit]* format. If not, it shall be configured
    as options.release_tag_format.
    """

    if getattr(options, "release_tag_format", False):
        format = release_tag_format
    else:
        format = "%s-[0-9]*" % options.name

    from citools.version import get_git_describe, compute_version
    version = compute_version(get_git_describe(accepted_tag_pattern=format))

    new_version = list(version[:-1])
    new_version[len(new_version)-1] += 1

    tag = options.name + "-" + ".".join(map(str, new_version))

    sh('git tag -a %s -m "paver bump to version %s"' % (tag, tag))
Ejemplo n.º 9
0
 def test_after_tag_twodigit(self):
     self.assertEquals((234, 7, 20), compute_version('tools-234.7-20-g1754c3f'))
Ejemplo n.º 10
0
 def test_on_tag(self):
     self.assertEquals((0, 7, 0), compute_version('tools-0.7'))
Ejemplo n.º 11
0
 def test_project_with_digit_in_name(self):
     self.assertEquals((9, 7, 3, 45, 532, 11, 44), compute_version('log4j-9.7.3.45.532.11-44-g1754c3f'))
Ejemplo n.º 12
0
 def test_multiple_digit_versin(self):
     self.assertEquals((0, 10, 2), compute_version('log4j-0.10-2-gbb6aff8'))
Ejemplo n.º 13
0
 def test_first_release_tag(self):
     self.assertEquals((0, 0, 1), compute_version('0.0'))
Ejemplo n.º 14
0
 def test_on_tag_with_suffix_four_digits(self):
     self.assertEquals((0, 7, 3, 0), compute_version('0.7.3-our-tools-project'))
Ejemplo n.º 15
0
 def test_on_tag_with_suffix(self):
     self.assertEquals((0, 7, 0), compute_version('0.7-our-tools-project'))
Ejemplo n.º 16
0
 def test_fetched_repository_has_same_version(self):
     dir = mkdtemp()
     repodir = fetch_repository(repository=self.repo_two, workdir=dir)
     self.assertEquals((2, 0, 12), compute_version(get_git_describe(repository_directory=repodir, fix_environment=True)))
     rmtree(dir)
Ejemplo n.º 17
0
 def test_proper_second_child_version(self):
     self.assertEquals((2, 0, 12), compute_version(get_git_describe(repository_directory=self.repo_two, fix_environment=True)))
Ejemplo n.º 18
0
 def test_proper_child_version(self):
     self.assertEquals((1, 0, 59, 1), compute_version(get_git_describe(repository_directory=self.repo_one, fix_environment=True)))
Ejemplo n.º 19
0
 def test_after_tag(self):
     self.assertEquals((0, 7, 20), compute_version('tools-0.7-20-g1754c3f'))
Ejemplo n.º 20
0
 def test_after_tag_with_project_suffix(self):
     self.assertEquals((0, 7, 20), compute_version('0.7-our-tools-project-20-g1754c3f'))
Ejemplo n.º 21
0
 def test_after_tag_without_name(self):
     self.assertEquals((0, 7, 20), compute_version('0.7-20-g1754c3f'))