<commit_before># Copyright (c) Syn AUTHORS, 2012, under the terms and conditions of the
# AUTHORS file.

from syn.system import cd, run, mkdir, putenv, abspath, workin_tmp, cp
from syn.archive import Tarball
from syn.db import Database
import os.path


def preform_step(step_name):
    return run(["synd/build", step_name])


def compose_source_archive(unpacked_root, upstream_tarball):
    """
    Generate a signing Database, correctly named tarball and
    a syn local tarball.

     - Head over to tmp/<something/
     - Create new archive with the synd/
     - Rename upstream tarball correctly
     - Create new DB, hash tarballs
     - Move back to where we want
    """
    unpacked_root = os.path.abspath(unpacked_root)
    upstream_tarball = os.path.abspath(upstream_tarball)
    root_name = os.path.basename(unpacked_root)
    tarball_name = os.path.basename(upstream_tarball)
    # XXX: Generate the source targz

    tb = Tarball(upstream_tarball)
    tb_root = tb._root_folder()
    if root_name != tb_root:
        print "The archive's root is wrong. Fix the syn root."
        # XXX: Fix this print
        raise Exception("Bad archive")  # XXX: Fix this Exception

    with workin_tmp():
        cp(unpacked_root, "./")
        cp(upstream_tarball, "./")


def extract_source_archive(signed_database, root):<commit_msg>Just making some last notes to myself.<commit_after># Copyright (c) Syn AUTHORS, 2012, under the terms and conditions of the
# AUTHORS file.

from syn.system import cd, run, mkdir, putenv, abspath, workin_tmp, cp
from syn.archive import Tarball
from syn.db import Database
import os.path


def preform_step(step_name):
    return run(["synd/build", step_name])


def compose_source_archive(unpacked_root, upstream_tarball):
    """
    Generate a signing Database, correctly named tarball and
    a syn local tarball.

     - Head over to tmp/<something/
     - Create new archive with the synd/
     - Rename upstream tarball correctly
     - Create new DB, hash tarballs
     - Move back to where we want
    """
    unpacked_root = os.path.abspath(unpacked_root)
    upstream_tarball = os.path.abspath(upstream_tarball)
    root_name = os.path.basename(unpacked_root)
    tarball_name = os.path.basename(upstream_tarball)
    # XXX: Generate the source targz

    tb = Tarball(upstream_tarball)
    tb_root = tb._root_folder()
    if root_name != tb_root:
        # During the actual build process, we extract the root tarball, then
        # overlay the syn local changes against that. Because of that, we need
        # to make sure the syn root matches the upstream root exactly.
        print "The archive's root is wrong. Fix the syn root."
        # XXX: Fix this print
        raise Exception("Bad archive")  # XXX: Fix this Exception

    with workin_tmp():
        cp(unpacked_root, "./")
        cp(upstream_tarball, "./")


def extract_source_archive(signed_database, root):
{'fraction_non_alphanumeric': 0.0844733242134063, 'fraction_numerical': 0.0027359781121751026, 'mean_word_length': 3.2452830188679247, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '563523', 'n_tokens_mistral': 912, 'n_tokens_neox': 879, 'n_words': 295}