-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
add http/socks5 proxy support for package manager #15048
Comments
personally more interested in this so that Zig supports Tor |
What is the progress on this? I am also suffering from censorship of github. |
You can download the dependency into |
Here is my workaround for the proxy issue. After building my patched zig from source, I could use I'm still confused that there are two https://github.com/tizee/zig/tree/feature/http-socks5-proxy-support |
|
My temporary workaround is to manually download the package, host it locally and change the dependency URL accordingly: {
.binned_allocator = .{
.url = "http://localhost:8080/8372900fcc09e38d7b0b6bbaddad3904-6c3321e0969ff2463f8335da5601986cf2108690.tar.gz",
.hash = "1220363c7e27b2d3f39de6ff6e90f9537a0634199860fea237a55ddb1e1717f5d6a5",
},
} If anyone wants to implement |
any update? |
A dirty script to workaround the issue. #!/bin/bash
set -e
forceupdate=false
if [ "$1" = "-f" ]; then
forceupdate=true
shift
fi
do_fetch() {
for d in `grep -o 'url *=.*' $1 | cut -d = -f 2`; do
d=`echo $d | grep -o 'https://[^"]*'`
echo -e "\n>>> Deal with $d"
if echo $d | grep -q '\.tar\.gz$'; then
url=$d
elif echo $d | grep -q '#[.0-9a-z]*$'; then
url_base=`echo $d | awk -F \# '{print $1}'`
url_base=${url_base%.git}
url_commit=`echo $d | awk -F \# '{print $2}'`
url="${url_base}/archive/${url_commit}.tar.gz"
else
echo ">>> Ignored $d, unable to resolve it!"
continue
fi
hash=`grep -m 1 -A 1 "$d" $1 | grep hash | awk -F \" '{print $(NF-1)}'`
if [ -z "$hash" ]; then
forceupdate=true
fi
if ! $forceupdate && [ -e ~/.cache/zig/p/$hash ]; then
echo ">>> Found $url in cache, ignored"
continue
fi
wget $url
tarfile=${url##*/}
hash=`zig fetch --debug-hash $tarfile | tail -n 1`
echo ">> hash of $d:"
echo -e "\t$hash"
rm $tarfile
if [ -e ~/.cache/zig/p/$hash/build.zig.zon ]; then
do_fetch ~/.cache/zig/p/$hash/build.zig.zon
fi
done
for d in `grep -o 'path *=.*' $1 | cut -d = -f 2`; do
path=`echo $d | awk -F \" '{print $(NF-1)}'`
if [ -e $path/build.zig.zon ]; then
do_fetch $path/build.zig.zon
fi
done
}
zonfile=$1
if [ -z "$zonfile" ]; then
zonfile=build.zig.zon
fi
if ! [ -e $zonfile ]; then
echo "can't find build.zig.zon!"
exit 1
fi
do_fetch $zonfile EDIT 1: Eliminate redundant downloading |
or manually manage plugins like this project. |
For someone using this script, a little fix to find the global caching directory instead of hardcoded |
Not all people have unrestricted network access to package source, for example: github is censored by some countries, it would be good to add proxy support for package manager so that user under restricted network can fetch package successfully.
The text was updated successfully, but these errors were encountered: