<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def changelog(build):
 """ create a changelog """

    build.packages.install("gitchangelog")
    changelog_text = subprocess.check_output(["gitchangelog", "HEAD...v0.2.9"])
    with open(os.path.join(build.root, "CHANGELOG"), "wb+") as fh:
        fh.write(changelog_text)