V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ab
V2EX  ›  macOS

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

  •  
  •   ab · 128 天前 · 1153 次点击
    这是一个创建于 128 天前的主题,其中的信息可能已经有所发展或是发生改变。
    修改: /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
    第 1 条附言  ·  127 天前
    正确姿势:
    /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 条回复    2023-12-25 17:43:21 +08:00
    alvinbone88
        1
    alvinbone88  
       128 天前
    设置一下 macports.conf 里的 preferred_hosts
    ab
        2
    ab  
    OP
       128 天前
    @alvinbone88 以下设置未起作用
    preferred_hosts mirrors.tuna.tsinghua.edu.cn
    alvinbone88
        3
    alvinbone88  
       128 天前
    呃……我设置的是 preferred_hosts *.cn.*.macports.org
    alvinbone88
        4
    alvinbone88  
       127 天前
    ab
        5
    ab  
    OP
       127 天前
    @alvinbone88 搞定完成,V 站总是有高手。
    Kobayashi
        6
    Kobayashi  
       125 天前
    macports.conf 中 rsync_server 设置的是 base ( port 命令主体) 的镜像。

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

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

    macports.confg 中 preferred_hosts 不是很确定是否影响上边全部,但肯定会影响 distfiles 获取,从源码编译软件时去哪里拉取源码。( MacPorts 不直接使用 github 等仓库中软件的源码,自己的 distfiles 优先。)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1168 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:16 · PVG 02:16 · LAX 11:16 · JFK 14:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.