Example #1
0
    def create_database(self):
        os.chdir(paths.mirror)

        if len(conf.updated) == 0:
            return

        print(title("Create database") + "\n")

        strict_execute("""
        rm -f {path}/{database}.old;
        rm -f {path}/{database}.files;
        rm -f {path}/{database}.files.tar.gz;
        rm -f {path}/{database}.files.tar.gz.old;
        """.format(database=conf.db, path=paths.mirror))

        for package in conf.updated:
            name = package["name"]
            version = package["version"]

            strict_execute(f"""
            repo-add \
                --nocolor \
                --remove \
                {paths.mirror}/{conf.db}.db.tar.gz \
                {paths.mirror}/{name}-{version}-*.pkg.tar.xz
            """)
Example #2
0
    def _deploy_ssh(self):
        print(title("Deploy to host remote") + "\n")

        strict_execute(f"""
        rsync \
            --archive \
            --copy-links \
            --delete \
            --recursive \
            --update \
            --verbose \
            --progress -e 'ssh -i {paths.base}/deploy_key -p {conf.ssh_port}' \
            {paths.mirror}/ \
            {conf.ssh_user}@{conf.ssh_host}:{conf.ssh_path}
        """)
Example #3
0
    def _commit_readme(self):
        path = paths.base + "/README.md"
        packages = []

        if (has_git_changes(path) is False or len(conf.updated) == 0):
            return

        print(title("Build README.md and mirror page:") + "\n")

        for package in conf.updated:
            packages.append(package["name"])

        commit_msg = "Doc: Bump " + ", ".join(packages) + " in packages information table"
        strict_execute(f"""
        git add {path};
        git commit -m "{commit_msg}";
        """)
Example #4
0
    def _deploy_git(self):
        if IS_DEVELOPMENT:
            return

        print(title("Deploy to git remote") + "\n")

        try:
            remote_path = git_remote_path()

            subprocess.check_call(f"""
            git push https://{conf.github_token}@{remote_path} HEAD:master &> /dev/null
            """,
                                  shell=True)

            print("Sucessufly push on git remote")
        except:
            sys.exit("Error: Failed to push some refs to 'https://%s'" %
                     git_remote_path())
Example #5
0
 def separator(self):
     print(title(self.name))