From: fsLeg Date: Sat, 21 Dec 2024 14:42:45 +0000 (+0300) Subject: shadowsocks-rust: results of a helper script changes X-Git-Url: https://git.t-rg.ws/?a=commitdiff_plain;h=3708d171da21174a606997192b280270ac5c44f4;p=slackbuilds.git shadowsocks-rust: results of a helper script changes --- diff --git a/shadowsocks-rust/mkvendor.py b/shadowsocks-rust/mkvendor.py index 935bcf1..0786bd0 100755 --- a/shadowsocks-rust/mkvendor.py +++ b/shadowsocks-rust/mkvendor.py @@ -34,24 +34,22 @@ import tarfile def createVendor(vendordir, cratedir): "We extract each crate, create an empty .cargo-ok file, calculate sha256 sum for every file inside the crate and crate file itself and put it into .cargo-checksum.json" crate_path = "" - crate_checksums = [] - crate_files = [] + crate_files, crate_checksums = [], [] makedirs(vendordir, exist_ok=True) for crate in glob(f"{cratedir}/*.crate"): with tarfile.open(crate, 'r:*') as archive: archive.extractall(path=vendordir, filter='data') - crate_path = f"{vendordir}/{crate[crate.rfind('/')+1:].replace('.crate', '')}" - open(f"{crate_path}/.cargo-ok", "a").close() - for root, dirs, files in walk(f"{crate_path}"): - crate_files.extend(join(root, name) for name in files) - for file in crate_files: - with open(file, "rb") as opened_file: - crate_checksums.append(sha256(opened_file.read()).hexdigest()) - with open(f"{crate_path}/.cargo-checksum.json", "w") as crate_json: - with open(crate, 'rb') as crate_file: - json.dump({"files": dict(zip([file.replace(f"{crate_path}/", "") for file in crate_files], crate_checksums)), "package": sha256(crate_file.read()).hexdigest()}, crate_json) - crate_files = [] - crate_checksums = [] + crate_path = f"{vendordir}/{crate[crate.rfind('/')+1:].replace('.crate', '')}" + open(f"{crate_path}/.cargo-ok", "a").close() + for root, dirs, files in walk(f"{crate_path}"): + crate_files.extend(join(root, name) for name in files) + for file in crate_files: + with open(file, "rb") as opened_file: + crate_checksums.append(sha256(opened_file.read()).hexdigest()) + with open(f"{crate_path}/.cargo-checksum.json", "w") as crate_json: + with open(crate, 'rb') as crate_file: + json.dump({"files": dict(zip([file.replace(f"{crate_path}/", "") for file in crate_files], crate_checksums)), "package": sha256(crate_file.read()).hexdigest()}, crate_json) + crate_files, crate_checksums = [], [] if __name__ == "__main__": import argparse @@ -64,7 +62,4 @@ if __name__ == "__main__": parser.add_argument("-c", "--crates", help="Directory with downloaded .crate files to vendor") args = parser.parse_args() - workdir = args.directory - cratedir = args.crates - - createVendor(f"{workdir}/vendor", cratedir) + createVendor(f"{args.directory}/vendor", args.crates) diff --git a/shadowsocks-rust/shadowsocks-rust.SlackBuild b/shadowsocks-rust/shadowsocks-rust.SlackBuild index 25b84af..dcc8ce1 100755 --- a/shadowsocks-rust/shadowsocks-rust.SlackBuild +++ b/shadowsocks-rust/shadowsocks-rust.SlackBuild @@ -112,7 +112,7 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -# Use rust-opt instead of system rust +# Use rust-opt instead of system rust if it's available export PATH="/opt/rust/bin:$PATH" if [ -z "$LD_LIBRARY_PATH" ]; then export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX" diff --git a/shadowsocks-rust/shadowsocks-rust.info b/shadowsocks-rust/shadowsocks-rust.info index 0dfc6ba..5d72d18 100644 --- a/shadowsocks-rust/shadowsocks-rust.info +++ b/shadowsocks-rust/shadowsocks-rust.info @@ -320,10 +320,7 @@ DOWNLOAD="https://github.com/shadowsocks/shadowsocks-rust/archive/v1.21.2/shadow https://static.crates.io/crates/serde_yaml/serde_yaml-0.9.34+deprecated.crate \ https://static.crates.io/crates/sha1/sha1-0.10.6.crate \ https://static.crates.io/crates/sha2/sha2-0.10.8.crate \ - https://static.crates.io/crates/sha2/sha2-1.21.0.crate \ https://static.crates.io/crates/shadowsocks-crypto/shadowsocks-crypto-0.5.5.crate \ - https://static.crates.io/crates/shadowsocks-crypto/shadowsocks-crypto-1.21.2.crate \ - https://static.crates.io/crates/shadowsocks-crypto/shadowsocks-crypto-1.21.2.crate \ https://static.crates.io/crates/sharded-slab/sharded-slab-0.1.7.crate \ https://static.crates.io/crates/shlex/shlex-1.3.0.crate \ https://static.crates.io/crates/signal-hook-registry/signal-hook-registry-1.4.2.crate \ @@ -778,10 +775,7 @@ MD5SUM="0360ef67392ffbaa38ea53c76f323cd5 \ 39e3168b0ff2d77bcca05882310b2a06 \ d7602381c0bc21d10603cc940a837b06 \ 289b776935f2184c6ba2974877285013 \ - 3172cc7eed7041f89d35715a93cac031 \ cbac6a37ea78204d483d4d224de6ab90 \ - 7558b0d6a956faf7f1644b6fc7f53755 \ - c2fdaa2514e053b8a3180b528724696e \ 96261f3cee18842060fd64d618e056d8 \ 6c623a8eed8450399ec323a72e96855c \ a77d5770902a4260009320daafd1fff2 \