indexer: More crate updates + warning fixes + 2018 edition

This commit is contained in:
Yorhel 2021-12-11 14:52:04 +01:00
parent c48feedc85
commit c9e81a8922
14 changed files with 193 additions and 499 deletions

520
indexer/Cargo.lock generated
View file

@ -1,20 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "addr2line"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "0.7.18"
@ -30,18 +15,18 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
name = "async-trait"
version = "0.1.51"
version = "0.1.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -52,7 +37,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -61,21 +46,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "backtrace"
version = "0.3.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6"
dependencies = [
"addr2line",
"cc",
"cfg-if 1.0.0",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]]
name = "base64"
version = "0.13.0"
@ -90,9 +60,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95"
dependencies = [
"generic-array",
]
@ -111,9 +81,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "0.5.6"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]]
name = "cc"
@ -121,12 +91,6 @@ version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -143,7 +107,7 @@ dependencies = [
"num-integer",
"num-traits",
"time",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -177,34 +141,24 @@ dependencies = [
]
[[package]]
name = "crypto-mac"
version = "0.9.1"
name = "crypto-common"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58bcd97a54c7ca5ce2f6eb16f6bede5b0ab5f0055fedc17d2f0b4466e21671ca"
checksum = "567569e659735adb39ff2d4c20600f7cd78be5471f8c58ab162bce3c03fdbc5f"
dependencies = [
"generic-array",
"subtle",
]
[[package]]
name = "derive_more"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d944ac6003ed268757ef1ee686753b57efc5fcf0ebe7b64c9fc81e7e32ff839"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
"rustc_version",
"syn 0.15.44",
]
[[package]]
name = "digest"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
checksum = "8549e6bfdecd113b7e221fe60b433087f6957387a20f8118ebca9b12af19143d"
dependencies = [
"block-buffer",
"crypto-common",
"generic-array",
"subtle",
]
[[package]]
@ -270,20 +224,11 @@ name = "encoding_index_tests"
version = "0.1.5"
source = "git+https://github.com/lifthrasiir/rust-encoding#eb3d3c307df864f6a25e2ca16d49703e5d963ec5"
[[package]]
name = "encoding_rs"
version = "0.8.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "env_logger"
version = "0.6.2"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
dependencies = [
"atty",
"humantime",
@ -292,28 +237,6 @@ dependencies = [
"termcolor",
]
[[package]]
name = "failure"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
dependencies = [
"backtrace",
"failure_derive",
]
[[package]]
name = "failure_derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
"synstructure",
]
[[package]]
name = "fallible-iterator"
version = "0.2.0"
@ -330,22 +253,6 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
dependencies = [
"bitflags",
"fuchsia-zircon-sys",
]
[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "futures"
version = "0.3.18"
@ -400,9 +307,9 @@ version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -430,7 +337,7 @@ dependencies = [
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite 0.2.7",
"pin-project-lite",
"pin-utils",
"slab",
]
@ -447,21 +354,15 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.1.16"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "gimli"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -473,22 +374,18 @@ dependencies = [
[[package]]
name = "hmac"
version = "0.9.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deae6d9dbb35ec2c502d62b8f7b1c000a0822c3b0794ba36b3149c0a1c840dff"
checksum = "ddca131f3e7f2ce2df364b57949a9d47915cfbd35e46cfee355ccebbf794d6a2"
dependencies = [
"crypto-mac",
"digest",
]
[[package]]
name = "humantime"
version = "1.3.0"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
dependencies = [
"quick-error",
]
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "idna"
@ -527,16 +424,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "iovec"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
"libc",
"cfg-if",
]
[[package]]
@ -548,16 +436,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -595,7 +473,7 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
]
[[package]]
@ -605,10 +483,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "md5"
version = "0.7.0"
name = "md-5"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
checksum = "e6a38fc55c8bbc10058782919516f88826e70320db6d206aebc49611d24216ae"
dependencies = [
"digest",
]
[[package]]
name = "memchr"
@ -616,67 +497,35 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "miniz_oxide"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [
"adler",
"autocfg",
]
[[package]]
name = "mio"
version = "0.6.23"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
dependencies = [
"cfg-if 0.1.10",
"fuchsia-zircon",
"fuchsia-zircon-sys",
"iovec",
"kernel32-sys",
"libc",
"log",
"miow",
"net2",
"slab",
"winapi 0.2.8",
]
[[package]]
name = "mio-uds"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
dependencies = [
"iovec",
"libc",
"mio",
"ntapi",
"winapi",
]
[[package]]
name = "miow"
version = "0.2.2"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [
"kernel32-sys",
"net2",
"winapi 0.2.8",
"ws2_32-sys",
"winapi",
]
[[package]]
name = "net2"
version = "0.2.37"
name = "ntapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae"
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
dependencies = [
"cfg-if 0.1.10",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -698,27 +547,12 @@ dependencies = [
"autocfg",
]
[[package]]
name = "object"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -736,12 +570,12 @@ version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"instant",
"libc",
"redox_syscall",
"smallvec",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -752,28 +586,22 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "phf"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f"
dependencies = [
"phf_shared",
]
[[package]]
name = "phf_shared"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
dependencies = [
"siphasher",
]
[[package]]
name = "pin-project-lite"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777"
[[package]]
name = "pin-project-lite"
version = "0.2.7"
@ -788,15 +616,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.22"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
[[package]]
name = "postgres"
version = "0.17.5"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14d864cf6c2eabf1323afe4145ff273aad1898e4f2a3bcb30347715df8624a07"
checksum = "eb76d6535496f633fa799bb872ffb4790e9cbdedda9d35564ca0252f930c0dd5"
dependencies = [
"bytes",
"fallible-iterator",
@ -808,16 +636,16 @@ dependencies = [
[[package]]
name = "postgres-protocol"
version = "0.5.3"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4888a0e36637ab38d76cace88c1476937d617ad015f07f6b669cec11beacc019"
checksum = "79ec03bce71f18b4a27c4c64c6ba2ddf74686d69b91d8714fb32ead3adaed713"
dependencies = [
"base64",
"byteorder",
"bytes",
"fallible-iterator",
"hmac",
"md5",
"md-5",
"memchr",
"rand",
"sha2",
@ -826,9 +654,9 @@ dependencies = [
[[package]]
name = "postgres-types"
version = "0.1.3"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfc08a7d94a80665de4a83942fa8db2fdeaf2f123fc0535e384dc4fff251efae"
checksum = "04619f94ba0cc80999f4fc7073607cb825bc739a883cb6d20900fc5e009d6b0d"
dependencies = [
"bytes",
"fallible-iterator",
@ -843,66 +671,37 @@ checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
[[package]]
name = "proc-macro2"
version = "0.4.30"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a"
dependencies = [
"unicode-xid 0.1.0",
"unicode-xid",
]
[[package]]
name = "proc-macro2"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid 0.2.2",
]
[[package]]
name = "quick-error"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quick-xml"
version = "0.14.0"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a8b2062cd4735d683121dbd525f5961226936229b0ac6bbbc40b34155744a41"
checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
dependencies = [
"derive_more",
"encoding_rs",
"failure",
"log",
"memchr",
]
[[package]]
name = "quote"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
dependencies = [
"proc-macro2 0.4.30",
]
[[package]]
name = "quote"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
dependencies = [
"proc-macro2 1.0.32",
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.7.3"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
dependencies = [
"getrandom",
"libc",
"rand_chacha",
"rand_core",
@ -911,9 +710,9 @@ dependencies = [
[[package]]
name = "rand_chacha"
version = "0.2.2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
@ -921,18 +720,18 @@ dependencies = [
[[package]]
name = "rand_core"
version = "0.5.1"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
dependencies = [
"rand_core",
]
@ -975,22 +774,7 @@ dependencies = [
"spin",
"untrusted",
"web-sys",
"winapi 0.3.9",
]
[[package]]
name = "rustc-demangle"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver",
"winapi",
]
[[package]]
@ -1021,32 +805,15 @@ dependencies = [
"untrusted",
]
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "sha2"
version = "0.9.8"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa"
checksum = "900d964dd36bb15bcf2f2b35694c072feab74969a54f2bbeec7a2d725d2bdcb6"
dependencies = [
"block-buffer",
"cfg-if 1.0.0",
"cfg-if",
"cpufeatures",
"digest",
"opaque-debug",
]
[[package]]
@ -1067,6 +834,16 @@ version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
[[package]]
name = "socket2"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "spin"
version = "0.5.2"
@ -1095,38 +872,15 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "syn"
version = "0.15.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
"unicode-xid 0.1.0",
]
[[package]]
name = "syn"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
"unicode-xid 0.2.2",
]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
"unicode-xid 0.2.2",
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
@ -1154,7 +908,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1174,27 +928,24 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "0.2.25"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092"
checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
dependencies = [
"autocfg",
"bytes",
"futures-core",
"iovec",
"lazy_static",
"libc",
"memchr",
"mio",
"mio-uds",
"pin-project-lite 0.1.12",
"slab",
"pin-project-lite",
"winapi",
]
[[package]]
name = "tokio-postgres"
version = "0.5.5"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55a2482c9fe4dd481723cf5c0616f34afc710e55dcda0944e12e7b3316117892"
checksum = "4b6c8b33df661b548dcd8f9bf87debb8c56c05657ed291122e1188698c2ece95"
dependencies = [
"async-trait",
"byteorder",
@ -1205,24 +956,25 @@ dependencies = [
"parking_lot",
"percent-encoding",
"phf",
"pin-project-lite 0.1.12",
"pin-project-lite",
"postgres-protocol",
"postgres-types",
"socket2",
"tokio",
"tokio-util",
]
[[package]]
name = "tokio-util"
version = "0.3.1"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"log",
"pin-project-lite 0.1.12",
"pin-project-lite",
"tokio",
]
@ -1253,12 +1005,6 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]]
name = "unicode-xid"
version = "0.2.2"
@ -1313,9 +1059,9 @@ checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm-bindgen"
@ -1323,7 +1069,7 @@ version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"wasm-bindgen-macro",
]
@ -1336,9 +1082,9 @@ dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
@ -1348,7 +1094,7 @@ version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
dependencies = [
"quote 1.0.10",
"quote",
"wasm-bindgen-macro-support",
]
@ -1358,9 +1104,9 @@ version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.82",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -1400,12 +1146,6 @@ dependencies = [
"webpki",
]
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -1416,12 +1156,6 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@ -1434,7 +1168,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1442,13 +1176,3 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]

View file

@ -2,19 +2,20 @@
name = "indexer"
version = "0.1.0"
authors = ["Yorhel <git@yorhel.nl>"]
edition = "2018"
[dependencies]
regex = "1.1.0"
log = "0.4.1"
env_logger = "0.6.0"
env_logger = "0.9.0"
lazy_static = "1.0.0"
libc = "0.2.39"
libarchive3-sys = "0.1.2"
encoding = { git = "https://github.com/lifthrasiir/rust-encoding", features = ["no-optimized-legacy-encoding"] }
ring = "0.16.20"
postgres = "0.17.5"
postgres = "0.19.0"
clap = "2.31.2"
ureq = "2.3.1"
percent-encoding = "2.0"
chrono = "0.4.0"
quick-xml = "0.14.0"
quick-xml = "0.22.0"

View file

@ -1,6 +1,5 @@
use std::str;
use std::ptr;
use std::error::Error as ErrorTrait;
use std::io::{Result,Error,Read};
use std::ffi::{CStr,CString};
@ -23,7 +22,7 @@ use libarchive3_sys::ffi;
pub struct Archive<'a> {
a: *mut ffi::Struct_archive,
rd: &'a mut Read,
rd: &'a mut dyn Read,
buf: Vec<u8>,
err: Option<Error>,
eof: bool,
@ -61,7 +60,7 @@ unsafe extern "C" fn archive_read_cb(_: *mut ffi::Struct_archive, data: *mut c_v
match arch.rd.read(&mut arch.buf[..]) {
Ok(s) => s as ssize_t,
Err(e) => {
let desc = CString::new(e.description()).unwrap();
let desc = CString::new(e.to_string()).unwrap();
let fmt = CString::new("%s").unwrap();
ffi::archive_set_error(arch.a, e.raw_os_error().unwrap_or(0), fmt.as_ptr(), desc.as_ptr());
arch.err = Some(e);
@ -72,7 +71,7 @@ unsafe extern "C" fn archive_read_cb(_: *mut ffi::Struct_archive, data: *mut c_v
impl<'a> Archive<'a> {
fn new(rd: &mut Read, a: *mut ffi::Struct_archive) -> Result<Box<Archive>> {
fn new(rd: &mut dyn Read, a: *mut ffi::Struct_archive) -> Result<Box<Archive>> {
let bufsize = 64*1024;
let mut buf = Vec::with_capacity(bufsize);
unsafe { buf.set_len(bufsize) };
@ -131,17 +130,17 @@ impl<'a> Archive<'a> {
}
}
pub fn open_archive(rd: &mut Read) -> Result<Option<ArchiveEntry>> {
pub fn open_archive(rd: &mut dyn Read) -> Result<Option<ArchiveEntry>> {
let a = unsafe {
let a = ffi::archive_read_new();
ffi::archive_read_support_filter_all(a);
ffi::archive_read_support_format_all(a);
a
};
try!(Self::new(rd, a)).entry()
Self::new(rd, a)?.entry()
}
pub fn open_raw(rd: &mut Read) -> Result<RawEntry> {
pub fn open_raw(rd: &mut dyn Read) -> Result<RawEntry> {
let a = unsafe {
let a = ffi::archive_read_new();
ffi::archive_read_support_filter_all(a);
@ -149,7 +148,7 @@ impl<'a> Archive<'a> {
ffi::archive_read_support_format_empty(a);
a
};
let mut a = try!(Self::new(rd, a));
let mut a = Self::new(rd, a)?;
let mut e: *mut ffi::Struct_archive_entry = ptr::null_mut();
let res = unsafe { ffi::archive_read_next_header(a.a, &mut e) };
match res {
@ -282,10 +281,10 @@ pub fn walk<F>(ent: Option<ArchiveEntry>, mut cb: F) -> Result<()>
{
let mut ent = ent;
while let Some(mut e) = ent {
if !try!(cb(&mut e)) {
if !cb(&mut e)? {
break;
}
ent = try!(e.next());
ent = e.next()?;
}
Ok(())
}

View file

@ -1,7 +1,7 @@
use std::io::Result;
use std::collections::HashMap;
use archive::{walk,ArchiveEntry,FileType};
use crate::archive::{walk,ArchiveEntry,FileType};
/* I had hoped that reading man pages from an archive would just be a simple:
*
@ -121,7 +121,7 @@ impl FileList {
links: Vec::new(),
};
try!(walk(ent, |mut e| {
walk(ent, |mut e| {
let path = match e.path() {
Some(x) => x.to_string(),
None => { warn!("Invalid UTF-8 filename in archive"); return Ok(true) }
@ -144,7 +144,7 @@ impl FileList {
EntryType::Hardlink
} else if interest_cb(&path) {
let pathv = [&path as &str];
try!(file_cb(&pathv[..], &mut e));
file_cb(&pathv[..], &mut e)?;
EntryType::Handled
} else {
EntryType::Regular
@ -157,7 +157,7 @@ impl FileList {
let opath = ocomp.join("/");
if interest_cb(&opath) {
let pathv = [&opath as &str];
try!(file_cb(&pathv[..], &mut e));
file_cb(&pathv[..], &mut e)?;
*fl.seen.get_mut(&opath).unwrap() = EntryType::Handled;
}
}
@ -173,7 +173,7 @@ impl FileList {
fl.seen.insert(path, et);
Ok(true)
}));
})?;
Ok(fl)
}
@ -301,7 +301,7 @@ impl MissedFiles {
walk(ent, |mut e| {
if let Some(f) = e.path().and_then(|p| self.0.remove(p)) {
let v: Vec<&str> = f.iter().map(|x| x as &str).collect();
try!(file_cb(&v, &mut e))
file_cb(&v, &mut e)?
}
Ok(self.0.len() > 0)
})

View file

@ -1,17 +1,6 @@
#[macro_use] extern crate log;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate clap;
extern crate env_logger;
extern crate regex;
extern crate libarchive3_sys;
extern crate libc;
extern crate ring;
extern crate encoding;
extern crate postgres;
extern crate ureq;
extern crate chrono;
extern crate quick_xml;
extern crate percent_encoding;
mod archive;
mod archread;

View file

@ -8,7 +8,7 @@ use encoding::{all,EncodingRef};
use encoding::label::encoding_from_whatwg_label;
use ring::digest;
use archive::Archive;
use crate::archive::Archive;
// Anything larger than this just isn't a man page. I hope.
const MAX_MAN_SIZE: u64 = 20*1024*1024;
@ -195,10 +195,10 @@ fn codec_from_path(path: &str) -> Option<EncodingRef> {
// Decompresses / decodes a man page and returns its SHA-1 hash, encoding name, and UTF-8 contents.
pub fn decode(paths: &[&str], ent: &mut Read) -> io::Result<(digest::Digest,&'static str,String)> {
let mut decomp = try!(Archive::open_raw(ent)).take(MAX_MAN_SIZE+1);
pub fn decode(paths: &[&str], ent: &mut dyn Read) -> io::Result<(digest::Digest,&'static str,String)> {
let mut decomp = Archive::open_raw(ent)?.take(MAX_MAN_SIZE+1);
let mut data = Vec::new();
try!(decomp.read_to_end(&mut data));
decomp.read_to_end(&mut data)?;
if let Some(e) = validate(&data) {
return Err(io::Error::new(io::ErrorKind::InvalidData, e));
@ -301,6 +301,6 @@ fn test_decode_zh() {
assert_eq!(dig.as_ref(), &filehash[..]);
assert_eq!(enc, "gbk");
let utf8dig = digest::digest(&digest::SHA1, s.as_bytes());
let utf8dig = digest::digest(&digest::SHA1_FOR_LEGACY_USE_ONLY, s.as_bytes());
assert_eq!(utf8dig.as_ref(), &utf8hash[..]);
}

View file

@ -19,21 +19,20 @@ pub struct Path<'a> {
}
fn fetch(url: &str) -> Result<Box<Read>> {
let res = try!(ureq::get(url)
fn fetch(url: &str) -> Result<Box<dyn Read>> {
let res = ureq::get(url)
.set("User-Agent", "Man page crawler (info@manned.org; https://manned.org/)")
.call()
.map_err(|e| Error::new(ErrorKind::Other, format!("Ureq: {}", e)))
);
.map_err(|e| Error::new(ErrorKind::Other, format!("Ureq: {}", e)))?;
if res.status() != 200 {
return Err(Error::new(ErrorKind::Other, format!("HTTP: {}", res.status()) ));
}
Ok(Box::new(res.into_reader()) as Box<Read>)
Ok(Box::new(res.into_reader()) as Box<dyn Read>)
}
fn file(path: &str) -> Result<Box<Read>> {
Ok(Box::new(try!(File::open(path))) as Box<Read>)
fn file(path: &str) -> Result<Box<dyn Read>> {
Ok(Box::new(File::open(path)?) as Box<dyn Read>)
}
@ -51,7 +50,7 @@ pub fn clear_cache() -> Result<()> {
impl<'a> Path<'a> {
pub fn open(&self) -> Result<Box<Read>> {
pub fn open(&self) -> Result<Box<dyn Read>> {
if self.path.starts_with("http://") || self.path.starts_with("https://") {
if self.cache {
let hash = digest::digest(&digest::SHA256, self.path.as_bytes())
@ -63,9 +62,9 @@ impl<'a> Path<'a> {
return Ok(f);
}
{
let mut rd = try!(fetch(self.path));
let mut wr = try!(File::create(&cfn));
try!(copy(&mut rd, &mut wr));
let mut rd = fetch(self.path)?;
let mut wr = File::create(&cfn)?;
copy(&mut rd, &mut wr)?;
}
file(&cfn)

View file

@ -3,10 +3,10 @@ use std::io::{Error,ErrorKind,Read};
use postgres;
use chrono::NaiveDateTime;
use open;
use archread;
use man;
use archive::{Format,Archive,ArchiveEntry};
use crate::open;
use crate::archread;
use crate::man;
use crate::archive::{Format,Archive,ArchiveEntry};
pub static mut DRY_RUN: bool = false;
@ -107,7 +107,7 @@ fn insert_man_row<T: postgres::GenericClient>(tr: &mut T, verid: i32, path: &str
}
fn insert_man<T: postgres::GenericClient>(tr: &mut T, verid: i32, paths: &[&str], ent: &mut Read) {
fn insert_man<T: postgres::GenericClient>(tr: &mut T, verid: i32, paths: &[&str], ent: &mut dyn Read) {
let (dig, enc, mut cont) = match man::decode(paths, ent) {
Err(e) => { error!("Error decoding {}: {}", paths[0], e); return },
Ok(x) => x,

View file

@ -4,10 +4,10 @@ use regex::Regex;
use chrono::NaiveDateTime;
use postgres;
use archive;
use open;
use man;
use pkg;
use crate::archive;
use crate::open;
use crate::man;
use crate::pkg;
struct Meta {
@ -22,8 +22,7 @@ struct Meta {
fn read_files<T: Read>(lst: T) -> Result<bool> {
let rd = BufReader::new(lst);
for line in rd.lines() {
let line = try!(line);
if man::ismanpath(&line) {
if man::ismanpath(&line?) {
return Ok(true);
}
}
@ -33,7 +32,7 @@ fn read_files<T: Read>(lst: T) -> Result<bool> {
fn read_desc(rd: &mut archive::ArchiveEntry) -> Result<Option<Meta>> {
let mut data = String::new();
try!(rd.take(64*1024).read_to_string(&mut data));
rd.take(64*1024).read_to_string(&mut data)?;
let path = rd.path().unwrap();
lazy_static! {
@ -97,9 +96,9 @@ pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, mirror: &str, repo
hasman = false;
meta = None;
} else if x.path().unwrap().ends_with("/files") {
hasman = try!(read_files(x));
hasman = read_files(x)?;
} else if x.path().unwrap().ends_with("/desc") {
meta = try!(read_desc(x));
meta = read_desc(x)?;
}
if hasman && meta.is_some() {

View file

@ -5,10 +5,10 @@ use postgres;
use regex;
use regex::bytes::Regex;
use man;
use pkg;
use open;
use archive;
use crate::man;
use crate::pkg;
use crate::open;
use crate::archive;
// Reference: https://wiki.debian.org/RepositoryFormat

View file

@ -3,8 +3,8 @@ use std::io::Result;
use regex::Regex;
use postgres;
use open;
use pkg;
use crate::open;
use crate::pkg;
// Sync a FreeBSD <= 9.2 package respository.

View file

@ -3,9 +3,9 @@ use regex::bytes::Regex;
use std::str;
use postgres;
use open;
use pkg;
use archive::{Archive,ArchiveEntry};
use crate::open;
use crate::pkg;
use crate::archive::{Archive,ArchiveEntry};
fn getpkgsite(mut ent: Option<ArchiveEntry>) -> Result<ArchiveEntry> {

View file

@ -2,41 +2,25 @@ use std::collections::HashSet;
use std::io::BufReader;
use std::str::FromStr;
use std::error::Error;
use std::fmt;
use chrono::NaiveDateTime;
use postgres;
use quick_xml as xml;
use quick_xml::events::Event;
use archive;
use open;
use pkg;
use man;
use crate::archive;
use crate::open;
use crate::pkg;
use crate::man;
// Ugh, quick-xml's Error type does not implement Error.
#[derive(Debug)]
struct XmlError(String);
impl fmt::Display for XmlError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) }
}
impl Error for XmlError {
fn description(&self) -> &str { self.0.as_ref() }
}
fn to_err(e: xml::Error) -> XmlError {
XmlError(format!("{}", e))
}
fn xml_getattr(e: &xml::events::BytesStart, attr: &str) -> Result<String,Box<Error>> {
fn xml_getattr(e: &xml::events::BytesStart, attr: &str) -> Result<String,Box<dyn Error>> {
for kv in e.attributes().with_checks(false) {
let kv = kv.map_err(to_err)?;
let kv = kv?;
if kv.key == attr.as_bytes() {
return Ok(String::from_utf8(kv.value.into_owned())?);
}
}
Err(Box::new(XmlError(format!("Attribute '{}' not found", attr))))
Err(Box::new(xml::Error::UnexpectedToken(format!("Attribute '{}' not found", attr))))
}
@ -53,7 +37,7 @@ struct PkgInfo {
// Shared function to read primary.xml.gz and filelists.xml.gz. Runs the callback for each package
// with the info that was found.
fn readpkgs<F>(url: String, mut cb: F) -> Result<(),Box<Error>>
fn readpkgs<F>(url: String, mut cb: F) -> Result<(),Box<dyn Error>>
where F: FnMut(PkgInfo)
{
debug!("Reading {}", url);
@ -74,8 +58,7 @@ fn readpkgs<F>(url: String, mut cb: F) -> Result<(),Box<Error>>
loop {
buf.clear();
let event = xml.read_event(&mut buf);
let event = event.map_err(to_err)?;
let event = xml.read_event(&mut buf)?;
match event {
@ -97,7 +80,7 @@ fn readpkgs<F>(url: String, mut cb: F) -> Result<(),Box<Error>>
Event::Text(e) =>
if savestr {
saved = Some(e.unescape_and_decode(&xml).map_err(to_err)?);
saved = Some(e.unescape_and_decode(&xml)?);
savestr = false
},
@ -126,7 +109,7 @@ fn readpkgs<F>(url: String, mut cb: F) -> Result<(),Box<Error>>
// Reads repomd.xml and returns the path to the primary.xml.gz and filelists.xml.gz
fn repomd(url: String) -> Result<(String,String),Box<Error>> {
fn repomd(url: String) -> Result<(String,String),Box<dyn Error>> {
debug!("Reading {}", url);
let mut fd = open::Path{path: &url, cache: true, canbelocal: false}.open()?;
let mut xml = xml::Reader::from_reader(
@ -143,7 +126,7 @@ fn repomd(url: String) -> Result<(String,String),Box<Error>> {
loop {
buf.clear();
let event = xml.read_event(&mut buf).map_err(to_err)?;
let event = xml.read_event(&mut buf)?;
match event {
Event::Start(ref e) |
Event::Empty(ref e) => {
@ -173,7 +156,7 @@ fn repomd(url: String) -> Result<(String,String),Box<Error>> {
}
pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, cat: &str, mirror: &str) -> Result<(),Box<Error>> {
pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, cat: &str, mirror: &str) -> Result<(),Box<dyn Error>> {
let(primary, filelists) = repomd(format!("{}repodata/repomd.xml", mirror))?;
let mut pkgswithman = HashSet::new();

View file

@ -2,8 +2,8 @@ use std::io::Result;
use regex::Regex;
use postgres;
use open;
use pkg;
use crate::open;
use crate::pkg;
pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, cat: &str, mirror: &str) -> Result<()> {
let pkgs : Vec<String> = open::Path{path: mirror, cache: true, canbelocal: false}