<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def upgrade(self, only):
 """Remove all package lists with changelog and checksums files and create lists again"""

        repositories = self.meta.repositories
        if only:
            repositories = only
        for repo in repositories:
            changelogs = "{0}{1}{2}".format(self.log_path, repo,
                                            "/ChangeLog.txt")
            if os.path.isfile(changelogs):
                os.remove(changelogs)
            if os.path.isdir(self.lib_path + "{0}_repo/".format(repo)):
                for f in (os.listdir(self.lib_path + "{0}_repo/".format(
                        repo))):
                    files = "{0}{1}_repo/{2}".format(self.lib_path, repo, f)
                    if os.path.isfile(files):
                        os.remove(files)
                    elif os.path.isdir(files):
                        shutil.rmtree(files)
        Update().repository(only)