Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to set mirror url to speedup download package #1358

Closed
waruqi opened this issue Apr 23, 2021 · 12 comments
Closed

Support to set mirror url to speedup download package #1358

waruqi opened this issue Apr 23, 2021 · 12 comments

Comments

@waruqi
Copy link
Member

waruqi commented Apr 23, 2021

xmake g --proxy_pac=/xxx/pac.lua

default path: ~/.xmake/pac.lua

Switch to fastgit mirror for github site.

pac.lua

function mirror(url)
     return url:gsub("github.com", "hub.fastgit.org")
end
$ xrepo install libpng
> curl https://hub.fastgit.org/glennrp/libpng/archive/v1.6.37.zip -o v1.6.37.zip

Some github mirror sites

  • hub.fastgit.org
  • github.com.cnpmjs.org
  • git.zhlh6.cn
  • ...

related issues: #854

@waruqi
Copy link
Member Author

waruqi commented Apr 23, 2021

done

@wangzhankun
Copy link
Contributor

wangzhankun commented Apr 23, 2021

ENV

  • OS : Ubuntu20.04 x86-64
  • xmake: 2.5.3

error

I set the pac.lua and excute xmake g --proxy_pac=/home/wang/.xmake/pac.lua, but errors happened.
image

@waruqi
Copy link
Member Author

waruqi commented Apr 23, 2021

Are you sure you have updated to the latest dev version? and let me see your pac.lua

@wangzhankun
Copy link
Contributor

No, I'm using xmake 2.5.3. When I try to build xmake on dev branch, I got the following errors:

clean xmake
clean lcurses
clean sv
clean luajit
clean lua-cjson
clean tbox
clean xmake
clean demo
make xmake
make lcurses
make sv
make lua-cjson
make luajit
make tbox
make xmake
make[3]: *** No rule to make target 'sv/src/comp.c', needed by 'sv/src/comp.o'.  Stop.
make[2]: *** [/home/wang/Downloads/xmake/core/suffix.mak:305: DEP_PROS_sv_all] Error 2
make[2]: *** Waiting for unfinished jobs....
compile.r lcurses.c
make[3]: *** No rule to make target 'luajit/src/lib_aux.c', needed by 'luajit/src/lib_aux.o'.  Stop.
make[2]: *** [/home/wang/Downloads/xmake/core/suffix.mak:305: DEP_PROS_luajit_all] Error 2
make[3]: *** No rule to make target 'lua-cjson/dtoa.c', needed by 'lua-cjson/dtoa.o'.  Stop.
make[2]: *** [/home/wang/Downloads/xmake/core/suffix.mak:305: DEP_PROS_lua-cjson_all] Error 2
compile.r engine.c
compile.r hash/sha256.c
compile.r hash/uuid4.c
compile.r io/file_close.c
compile.r io/file_flush.c
make[3]: *** No rule to make target 'tbox/src/tbox/algorithm/binary_find.c', needed by 'tbox/src/tbox/algorithm/binary_find.o'.  Stop.
make[2]: *** [/home/wang/Downloads/xmake/core/suffix.mak:305: DEP_PROS_tbox_all] Error 2
compile.r io/file_isatty.c
compile.r io/file_open.c
compile.r io/file_rawfd.c
compile.r io/file_read.c
compile.r io/file_seek.c
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: engine.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: hash/sha256.o] Error 1
compile.r io/file_size.c
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: hash/uuid4.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_close.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_flush.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_isatty.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_open.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_rawfd.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: lcurses.o] Error 1
make[2]: *** [/home/wang/Downloads/xmake/core/suffix.mak:305: DEP_PROS_lcurses_all] Error 2
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_read.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_seek.o] Error 1
make[3]: *** [/home/wang/Downloads/xmake/core/suffix.mak:303: io/file_size.o] Error 1
make[2]: *** [/home/wang/Downloads/xmake/core/suffix.mak:305: DEP_PROS_xmake_all] Error 2
In file included from io/../prefix/prefix.h:27,
                 from io/../prefix.h:27,
                 from io/prefix.h:27,
                 from io/file_size.c:31:
io/../prefix/config.h:28:10: fatal error: tbox/tbox.h: No such file or directory
   28 | #include "tbox/tbox.h"
      |          ^~~~~~~~~~~~~
compilation terminated.

@waruqi
Copy link
Member Author

waruqi commented Apr 23, 2021

only run xmake update -s dev

@wangzhankun
Copy link
Contributor

wangzhankun commented Apr 23, 2021

error

Same error happened. But before I set the proxy_pac, I run xrepo install libpng successfully downloading from github.com
image

pac.lua

function mirror(url)
     return url:gsub("github.com", "hub.fastgit.org")
end

configure

configure
{
    network = public
    theme = default
    proxy_pac = /home/wang/.xmake/pac.lua
}

xmake version

xmake v2.5.3+202104191802(I have execute xmake update -s dev)

@waruqi
Copy link
Member Author

waruqi commented Apr 23, 2021

你之前是怎么安装的,安装在哪个目录下,给我看下? 如果之前走 get.sh 脚本装的,应该在 ~/local/xmake 下,xmake update -s dev 才会生效,如果走 make install 装在 /usr/local 下,这个 update 是不生效的。。

你得走完整更新,切到 ~/local/xmake:

xmake update dev
source ~/.xmake/profile

可以自行找下 proxy.lua 对比下 是否跟 dev版本保持一致:https://github.com/xmake-io/xmake/blob/dev/xmake/modules/net/proxy.lua

@wangzhankun
Copy link
Contributor

你之前是怎么安装的,安装在哪个目录下,给我看下? 如果之前走 get.sh 脚本装的,应该在 ~/local/xmake 下,xmake update -s dev 才会生效,如果走 make install 装在 /usr/local 下,这个 update 是不生效的。。

你得走完整更新,切到 ~/local/xmake:

xmake update dev
source ~/.xmake/profile

可以自行找下 proxy.lua 对比下 是否跟 dev版本保持一致:https://github.com/xmake-io/xmake/blob/dev/xmake/modules/net/proxy.lua

内容完全一致。

@waruqi
Copy link
Member Author

waruqi commented Apr 23, 2021

已经更新过去了?还是不行?/home/wang/.xmake/pac.lua 内容贴我下呢。。

@wangzhankun
Copy link
Contributor

ENV

  • OS WSL Ubuntu 20.04

pac.lua

function mirror(url)
     return url:gsub("github.com", "hub.fastgit.org")
end

@waruqi
Copy link
Member Author

waruqi commented Apr 23, 2021

既然已经更新了,按理应该可以的,这个就只能你这自己调下了。。比如到 本地 proxy.lua 下,这个位置,自己加点 print 看下 url 是否被正常替换了,,有没有执行进去

function mirror(url)
local proxy_pac = _proxy_pac()
if proxy_pac and proxy_pac.mirror then
return proxy_pac.mirror(url)
end
return url
end

@shuike520
Copy link

可以测试一下这个,github资源下载很快
~/.xmake/pac.lua
内容如下

function mirror(url)
     return url:gsub("https://github.com/", "https://github.91chi.fun/https://github.com//")
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants