Archives and Version Control Systems

If you have your programs in a git archive, you can use GitArchive as input parameter and build the software every time from scratch in order to have a clean enviroment for the experiment. Similar you can use a tar achive for this purpose.

class versuchung.archives.GitArchive(clone_url=None, ref='refs/heads/master', shallow=False, branches=None, tags=None)[source]

Can be used as: input parameter

The git repository given in clone_url will be cloned to a temporary directory. It will be removed after the experiment is over. If shallow == True Only the files and not the .git is copied (cloned). This is especially useful for large git repositories like the Linux kernel tree.

clone_url can either be a string or any object that has a .path attribute (like e.g. TarArchive). Of course the refenced path must be a directory.

This parameter can be used as argument to the with keyword, to change to the temporary directory:

with self.inputs.git_archive as path:
    # Here we have path == os.path.abspath(os.curdir)
    # Do something in the extracted copy
    print path
branches()[source]

Like references, but returns a list of branches/heads in the repository. The keys are transformed (refs/heads/$X -> $X). The GitArchive(branches=…) filter applies!

@returns dictionary of tag name to commit hashes

checkout_hash()[source]

Return the hash of the HEAD commit hash as string

checkout_ref()[source]

Return git ref which was checked out

checkout_url()[source]

Return git url which was checked out

path

Return the string to the extract directory (same as .value.path)

references(regex_filter=None)[source]

Inspect reference list of the repository. This reference list includes all branches, tags, and whatsoever. All reference names are fully qualified (refs/tags/, refs/heads).

If the regex_filter is given, only reference names that match the regex are returned.

@returns a dictionary that maps references to commit hashes

tags()[source]

Like references, but returns a list of tags in the repository. The keys are transformed (refs/tags/$X -> $X). The GitArchive(tags=…) filter applies!

@returns dictionary of tag name to commit hashes

value

Return a versuchung.files.Directory instance to the cloned git directory

class versuchung.archives.GzipFile(default_filename='')[source]
after_read(value)[source]

To provide filtering of file contents in subclasses, overrwrite this method. It is gets the file content as a string and returns the value()

before_write(value)[source]

To provide filtering of file contents in subclasses, overrwrite this method. This method gets the value() and returns a string, when the file is written to disk

path

Decompress file into the temporary directory and return path to this location

class versuchung.archives.TarArchive(filename=None)[source]

Can be used as: input parameter

The archive will be extracted to a temporary directory. It will be removed after the experiment is over.

clone_url can either be a string or any object that has a .path attribute (like e.g. File). Of course the referenced file must be a single file.

This parameter can be used as argument to the with keyword, to change to the temporary directory:

with self.inputs.tar_archive as path:
    # Here we have path == os.path.abspath(os.curdir)
    # Do something in the extracted copy
    print path
path

Return the string to the extract directory (same as .value.path)

value

Return a versuchung.files.Directory instance to the extracted tar archive. If it contains only one directory the instance will point there. Otherwise it will point to a directory containing the contents of the archive