Exemple #1
0
def tar_pack(label, co_dir, co_leaf, repo, output_dir, manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s'%('_'.join(domparts), label.name)
    else:
        name = label.name

    tar_filename = '%s.tgz'%name
    tar_path = os.path.join(output_dir, tar_filename)

    parent_dir = deduce_checkout_parent_dir(co_dir)

    # *Should* check that neither of the requested revision ids
    # are above the id of the checkout we have to hand?

    cmd = 'tar -C %s -zcf %s %s'%(parent_dir, tar_path, co_leaf)
    print '..',cmd
    rv = subprocess.call(cmd, shell=True)
    if rv:
        raise LocalError('tar -zcf returned %d'%rv)

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        # It should be much more information than we need, but still
        fd.write('[TAR %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n'%(name, label, co_dir, co_leaf, tar_filename))
Exemple #2
0
def tar_pack(label, co_dir, co_leaf, repo, output_dir, manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s' % ('_'.join(domparts), label.name)
    else:
        name = label.name

    tar_filename = '%s.tgz' % name
    tar_path = os.path.join(output_dir, tar_filename)

    parent_dir = deduce_checkout_parent_dir(co_dir)

    # *Should* check that neither of the requested revision ids
    # are above the id of the checkout we have to hand?

    cmd = 'tar -C %s -zcf %s %s' % (parent_dir, tar_path, co_leaf)
    print '..', cmd
    rv = subprocess.call(cmd, shell=True)
    if rv:
        raise LocalError('tar -zcf returned %d' % rv)

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        # It should be much more information than we need, but still
        fd.write('[TAR %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n' % (name, label, co_dir, co_leaf, tar_filename))
Exemple #3
0
def bzr_send(label, co_dir, co_leaf, repo, rev1, rev2, output_dir,
             manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s' % ('_'.join(domparts), label.name)
    else:
        name = label.name

    if BZR_DO_IT_PROPERLY:
        output_filename = '%s.bzr_send' % name
    else:
        output_filename = '%s.diff' % name

    output_path = os.path.join(output_dir, output_filename)

    checkout_dir = deduce_checkout_dir(co_dir, co_leaf)

    # *Should* check that neither of the requested revision numbers
    # are above the revno of the checkout we have to hand? Anyway,
    # probably the checks in Bazaar.revision_to_checkout() are what
    # we would want to be doing...

    if BZR_DO_IT_PROPERLY:
        cmd = 'cd %s; bzr send --output=%s --revision=%s..%s -v' % (
            checkout_dir, output_path, rev1, rev2)
        print '..', cmd
        rv = subprocess.call(cmd, shell=True)
        if rv != 0:
            raise LocalError('bzr send for %s returned %d' % (label, rv))
    else:
        cmd = 'cd %s; bzr diff -p1 -r%s..%s -v > %s' % (checkout_dir, rev1,
                                                        rev2, output_path)
        print '..', cmd
        rv = subprocess.call(cmd, shell=True)
        if rv != 1:  # for some reason
            raise LocalError('bzr send for %s returned %d' % (name, rv))

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        fd.write('[BZR %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n'
                 'old_revision=%s\n'
                 'new_revision=%s\n' %
                 (name, label, co_dir, co_leaf, output_filename, rev1, rev2))
Exemple #4
0
def bzr_send(label, co_dir, co_leaf, repo, rev1, rev2, output_dir, manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s'%('_'.join(domparts), label.name)
    else:
        name = label.name

    if BZR_DO_IT_PROPERLY:
        output_filename = '%s.bzr_send'%name
    else:
        output_filename = '%s.diff'%name

    output_path = os.path.join(output_dir, output_filename)

    checkout_dir = deduce_checkout_dir(co_dir, co_leaf)

    # *Should* check that neither of the requested revision numbers
    # are above the revno of the checkout we have to hand? Anyway,
    # probably the checks in Bazaar.revision_to_checkout() are what
    # we would want to be doing...

    if BZR_DO_IT_PROPERLY:
        cmd = 'cd %s; bzr send --output=%s --revision=%s..%s -v'%(checkout_dir,
                output_path, rev1, rev2)
        print '..',cmd
        rv = subprocess.call(cmd, shell=True)
        if rv != 0:
            raise LocalError('bzr send for %s returned %d'%(label,rv))
    else:
        cmd = 'cd %s; bzr diff -p1 -r%s..%s -v > %s'%(checkout_dir, rev1, rev2, output_path)
        print '..',cmd
        rv = subprocess.call(cmd, shell=True)
        if rv != 1:     # for some reason
            raise LocalError('bzr send for %s returned %d'%(name,rv))

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        fd.write('[BZR %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n'
                 'old_revision=%s\n'
                 'new_revision=%s\n'%(name, label, co_dir, co_leaf,
                     output_filename, rev1, rev2))
Exemple #5
0
def git_format_patch(label, co_dir, co_leaf, repo, rev1, rev2, output_dir,
                     manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s' % ('_'.join(domparts), label.name)
    else:
        name = label.name

    output_directory = '%s.git_patch' % name
    output_path = os.path.join(output_dir, output_directory)

    checkout_dir = deduce_checkout_dir(co_dir, co_leaf)

    # *Should* check that neither of the requested revision ids
    # are above the id of the checkout we have to hand?

    if rev1 is None:
        raise LocalError('Cannot do git-format patch: rev1 is None')

    if rev2 is None:
        raise LocalError('Cannot do git-format patch: rev2 is None')

    cmd = 'cd %s; git format-patch -o %s' \
          ' %s..%s'%(checkout_dir, output_path, rev1, rev2)
    print '..', cmd
    rv = subprocess.call(cmd, shell=True)
    if rv:
        raise LocalError('git format-patch returned %d' % rv)

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        fd.write('[GIT %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n'
                 'old_revision=%s\n'
                 'new_revision=%s\n' %
                 (name, label, co_dir, co_leaf, output_path, rev1, rev2))
Exemple #6
0
def git_format_patch(label, co_dir, co_leaf, repo, rev1, rev2, output_dir, manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s'%('_'.join(domparts), label.name)
    else:
        name = label.name

    output_directory = '%s.git_patch'%name
    output_path = os.path.join(output_dir, output_directory)

    checkout_dir = deduce_checkout_dir(co_dir, co_leaf)

    # *Should* check that neither of the requested revision ids
    # are above the id of the checkout we have to hand?

    if rev1 is None:
        raise LocalError('Cannot do git-format patch: rev1 is None')

    if rev2 is None:
        raise LocalError('Cannot do git-format patch: rev2 is None')

    cmd = 'cd %s; git format-patch -o %s' \
          ' %s..%s'%(checkout_dir, output_path, rev1, rev2)
    print '..',cmd
    rv = subprocess.call(cmd, shell=True)
    if rv:
        raise LocalError('git format-patch returned %d'%rv)

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        fd.write('[GIT %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n'
                 'old_revision=%s\n'
                 'new_revision=%s\n'%(name, label, co_dir, co_leaf,
                     output_path, rev1, rev2))
Exemple #7
0
def svn_diff(label, co_dir, co_leaf, repo, rev1, rev2, output_dir,
             manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s' % ('_'.join(domparts), label.name)
    else:
        name = label.name

    output_filename = '%s.svn_diff' % name
    output_path = os.path.join(output_dir, output_filename)

    checkout_dir = deduce_checkout_dir(co_dir, co_leaf)

    # *Should* check that neither of the requested revision numbers
    # are above the revno of the checkout we have to hand? Anyway,
    # probably the checks in Bazaar.revision_to_checkout() are what
    # we would want to be doing...

    # 'svn diff' is probably the best we can do
    cmd = 'cd %s; svn diff -r %s:%s > %s' % (checkout_dir, rev1, rev2,
                                             output_path)
    print '..', cmd
    rv = subprocess.call(cmd, shell=True)
    if rv:
        raise LocalError('svn diff returned %d' % rv)

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        fd.write('[SVN %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n'
                 'old_revision=%s\n'
                 'new_revision=%s\n' %
                 (name, label, co_dir, co_leaf, output_filename, rev1, rev2))
Exemple #8
0
def svn_diff(label, co_dir, co_leaf, repo, rev1, rev2, output_dir, manifest_filename):

    if label.domain:
        domparts = Label.split_domains(label.domain)
        name = '%s-%s'%('_'.join(domparts), label.name)
    else:
        name = label.name

    output_filename = '%s.svn_diff'%name
    output_path = os.path.join(output_dir, output_filename)

    checkout_dir = deduce_checkout_dir(co_dir, co_leaf)

    # *Should* check that neither of the requested revision numbers
    # are above the revno of the checkout we have to hand? Anyway,
    # probably the checks in Bazaar.revision_to_checkout() are what
    # we would want to be doing...

    # 'svn diff' is probably the best we can do
    cmd = 'cd %s; svn diff -r %s:%s > %s'%(checkout_dir,
                                           rev1, rev2, output_path)
    print '..',cmd
    rv = subprocess.call(cmd, shell=True)
    if rv:
        raise LocalError('svn diff returned %d'%rv)

    with open(manifest_filename, 'a') as fd:
        # Lazily, just write this out by hand
        fd.write('[SVN %s]\n'
                 'co_label=%s\n'
                 'co_dir=%s\n'
                 'co_leaf=%s\n'
                 'patch=%s\n'
                 'old_revision=%s\n'
                 'new_revision=%s\n'%(name, label, co_dir, co_leaf,
                     output_filename, rev1, rev2))