V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ab
V2EX  ›  macOS

话说 macports 到底怎么用镜像加速?

  •  
  •   ab · Dec 22, 2023 · 2485 views
    This topic created in 861 days ago, the information mentioned may be changed or developed.
    修改: /opt/local/etc/macports/sources.conf
    rsync://pek.cn.rsync.macports.org/macports/release/tarballs/ports.tar [default]

    修改: /opt/local/etc/macports/macports.conf
    rsync_server pek.cn.rsync.macports.org
    rsync_dir macports/release/tarballs/base.tar

    在 /opt/local/etc/macports/archive_sites.conf 添加:
    name macports_archives
    urls https://mirrors.tuna.tsinghua.edu.cn/macports/packages/
    type tbz2

    已经做了上面三处的的配置了,依旧从官方源拉取的包?

    ab@localhost ~ % sudo port install p7zip
    Password:
    ---> Fetching archive for p7zip
    ---> Attempting to fetch p7zip-16.02_5.darwin_20.x86_64.tbz2 from https://packages.macports.org/p7zip
    ---> Attempting to fetch p7zip-16.02_5.darwin_20.x86_64.tbz2.rmd160 from https://packages.macports.org/p7zip
    ---> Installing p7zip @16.02_5
    ---> Activating p7zip @16.02_5
    Supplement 1  ·  Dec 23, 2023
    正确姿势:
    /opt/local/etc/macports/sources.conf: 修改一个参数:
    rsync://pek.cn.rsync.macports.org/macports/release/tarballs/ports.tar [default]

    /opt/local/etc/macports/macports.conf: 修改三个参数
    rsync_server pek.cn.rsync.macports.org
    rsync_dir macports/release/tarballs/base.tar
    preferred_hosts *.cn.*.macports.org
    6 replies    2023-12-25 17:43:21 +08:00
    alvinbone88
        1
    alvinbone88  
       Dec 22, 2023
    设置一下 macports.conf 里的 preferred_hosts
    ab
        2
    ab  
    OP
       Dec 22, 2023
    @alvinbone88 以下设置未起作用
    preferred_hosts mirrors.tuna.tsinghua.edu.cn
    alvinbone88
        3
    alvinbone88  
       Dec 23, 2023
    呃……我设置的是 preferred_hosts *.cn.*.macports.org
    alvinbone88
        4
    alvinbone88  
       Dec 23, 2023
    ab
        5
    ab  
    OP
       Dec 23, 2023
    @alvinbone88 搞定完成,V 站总是有高手。
    Kobayashi
        6
    Kobayashi  
       Dec 25, 2023
    macports.conf 中 rsync_server 设置的是 base ( port 命令主体) 的镜像。

    sources.conf 设置 ports 文件(软件如何打包的定义文件 Portfile ) 镜像。

    archive_sites.conf 对应的是一个软件编译后的预编译文件,类似 Homebrew bottle 。

    macports.confg 中 preferred_hosts 不是很确定是否影响上边全部,但肯定会影响 distfiles 获取,从源码编译软件时去哪里拉取源码。( MacPorts 不直接使用 github 等仓库中软件的源码,自己的 distfiles 优先。)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2495 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 10:02 · PVG 18:02 · LAX 03:02 · JFK 06:02
    ♥ Do have faith in what you're doing.