Changeset 3035


Ignore:
Timestamp:
Jul 6, 2010, 12:27:41 AM (14 years ago)
Author:
gdb
Message:

Use the expanded commit name internally

Location:
trunk/packages/invirt-dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-dev/invirt-submit-build

    r3028 r3035  
    4242
    4343    try:
     44        # TODO: clean up this interface.
     45        b.ensureValidPackage(package)
     46        commit = b.canonicalize_commit(package, commit)
    4447        b.validateBuild(pocket, package, commit)
    4548    except b.InvalidBuild, e:
  • trunk/packages/invirt-dev/invirtibuilder

    r3032 r3035  
    289289        try:
    290290            db.failed_stage = 'validating job'
    291             src = b.validateBuild(pocket, package, commit)
    292291            # Don't expand the commit in the DB until we're sure the user
    293292            # isn't trying to be tricky.
    294             db.commit = commit = c.captureOutput(['git', 'rev-parse', commit],
    295                                                  cwd=b.getRepo(package)).strip()
     293            b.ensureValidPackage(package)
     294            db.commit = commit = b.canonicalize_commit(package, commit)
     295            src = b.validateBuild(pocket, package, commit)
    296296
    297297            db.version = str(b.getVersion(package, commit))
  • trunk/packages/invirt-dev/python/invirt/builder.py

    r3028 r3035  
    2929    return os.path.join(_REPO_DIR, 'invirt/packages', '%s.git' % package)
    3030
    31 def ensureValidRepo(package):
     31def ensureValidPackage(package):
    3232    """Perform some basic sanity checks that the requested repo is in a
    3333    subdirectory of _REPO_DIR/invirt/packages.  This prevents weirdness
     
    4242    elif not os.path.exists(repo):
    4343        raise InvalidBuild('Nonexisting package %s' % package)
     44
     45def canonicalize_commit(package, commit, shorten=False):
     46    if shorten:
     47        flags = ['--short']
     48    else:
     49        flags = []
     50    return c.captureOutput(['git', 'rev-parse'] + flags + [commit],
     51                           cwd=getRepo(package)).strip()
    4452
    4553def pocketToGit(pocket):
     
    99107    it returns True.
    100108    """
    101     ensureValidRepo(package)
     109    ensureValidPackage(package)
    102110    package_repo = getRepo(package)
    103111    new_version = getVersion(package, commit)
Note: See TracChangeset for help on using the changeset viewer.