wellbehavedsoftware / btrfs-dedupe

MIT License
31 stars 5 forks source link

Compilation/Install Failing on Rust 1.55 #9

Open naftulikay opened 2 years ago

naftulikay commented 2 years ago

I had to apply the following code and dependency changes to get it to compile and install:

Git Patch ```diff diff --git a/Cargo.lock b/Cargo.lock index fce7bee..40cb874 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,390 +1,431 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ansi_term" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi 0.3.9", +] [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] [[package]] name = "btrfs" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92f4527795dbab99ea5d15231b167f085e25908975f902b04e41ebf8deb19ccf" dependencies = [ - "crc 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "minilzo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crc", + "flate2", + "ioctl", + "lazy_static", + "libc", + "minilzo", + "uuid", ] [[package]] name = "btrfs-dedupe" version = "1.1.0" dependencies = [ - "btrfs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "output 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.111 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "btrfs", + "clap", + "flate2", + "output", + "rustc-serialize", + "serde", + "serde_json", + "sha2", + "time", ] [[package]] -name = "byte-tools" -version = "0.1.2" +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.20.0" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_size 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags 1.3.2", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] -name = "crc" -version = "1.4.0" +name = "cpufeatures" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" dependencies = [ - "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] -name = "digest" -version = "0.4.0" +name = "crc" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc1914fae6f18ae347320f0ba5e4fc270e17c037ea621fe41ec7e8adf67d11b0" dependencies = [ - "generic-array 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", ] [[package]] -name = "digest-buffer" -version = "0.2.0" +name = "digest" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "byte-tools 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "flate2" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" dependencies = [ - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "miniz-sys", ] [[package]] name = "gcc" version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3689e1982a563af74960ae3a4758aa632bb8fd984cfc3cc3b60ee6109477ab6e" [[package]] name = "generic-array" -version = "0.6.0" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "ioctl" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913c6d845a9bcf05a135ee4a4aeaafdca2ca1ee9725a5ebbdb6258bb5239002c" dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.7.0", + "libc", ] [[package]] name = "itoa" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" [[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 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" [[package]] name = "libc" -version = "0.2.18" +version = "0.2.101" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" [[package]] name = "minilzo" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4d5a2c254366545276c5a9203fb2e3a699df6ea15a625bea1df367270a3a80" dependencies = [ - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "minilzo-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "minilzo-sys", ] [[package]] name = "minilzo-sys" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce123edaa554212f9aef7466ae6805c59ce71edd79ead0c2aa8e828e444de9e5" dependencies = [ - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "miniz-sys" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54" dependencies = [ - "gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nodrop" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc", + "libc", ] [[package]] -name = "odds" -version = "0.2.25" +name = "opaque-debug" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "output" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa48553a7b3daf627fb657b93589c7ec94ec2048dc8c1445eba00f6d21676772" dependencies = [ - "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "libc", + "termion", ] [[package]] name = "proc-macro2" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid", ] [[package]] name = "quote" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rustc-serialize" version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b" [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "serde" version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9124df5b40cbd380080b2cc6ab894c040a3070d995f5c9dc77e18c34a8ae37d" dependencies = [ - "serde_derive 1.0.111 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2c3ac8e6ca1e9c80b8be1023940162bf81ae3cffbb1809474152f2ce1eb250" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "serde_json" version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" dependencies = [ - "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.111 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha2" -version = "0.4.0" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" dependencies = [ - "byte-tools 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "cfg-if", + "cpufeatures", + "digest", + "opaque-debug", ] [[package]] name = "strsim" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] -name = "term_size" -version = "0.2.1" +name = "termion" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a90df1ede85b25f0bbb50b6313f8fab00e30b3b251f1cc2165faa40924e1417" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] -name = "termion" -version = "1.1.4" +name = "textwrap" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "time" version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys", + "libc", + "winapi 0.2.8", ] [[package]] name = "typenum" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-segmentation" -version = "1.0.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] name = "unicode-width" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" [[package]] name = "unicode-xid" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" [[package]] name = "uuid" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9ff57156caf7e22f37baf3c9d8f6ce8194842c23419dafcb0716024514d162" [[package]] name = "vec_map" -version = "0.6.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[metadata] -"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" -"checksum btrfs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "92f4527795dbab99ea5d15231b167f085e25908975f902b04e41ebf8deb19ccf" -"checksum byte-tools 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "974792df7c06743ecc47412bc2b0ff63f6b60813ed3bc52fabe0ee1b2b785bec" -"checksum clap 2.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd1cb22651881e6379f4492d0d572ecb8022faef8c8aaae285bb18cb307bfa30" -"checksum crc 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc1914fae6f18ae347320f0ba5e4fc270e17c037ea621fe41ec7e8adf67d11b0" -"checksum digest 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41a0f307b67d9f0e57edc00804d3146f9f889fe8b2422825566c8e8dd2b5733c" -"checksum digest-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79472b4b47364a1f1c23122d5b5e481b4657714c61617ea91daf6f57549b5f00" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" -"checksum gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)" = "3689e1982a563af74960ae3a4758aa632bb8fd984cfc3cc3b60ee6109477ab6e" -"checksum generic-array 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7229d82657e79be00d5f2a110a973ab5340681b945cf1bc022be7cfebf2dc00c" -"checksum ioctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "913c6d845a9bcf05a135ee4a4aeaafdca2ca1ee9725a5ebbdb6258bb5239002c" -"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" -"checksum libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a51822fc847e7a8101514d1d44e354ba2ffa7d4c194dcab48870740e327cac70" -"checksum minilzo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d5a2c254366545276c5a9203fb2e3a699df6ea15a625bea1df367270a3a80" -"checksum minilzo-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce123edaa554212f9aef7466ae6805c59ce71edd79ead0c2aa8e828e444de9e5" -"checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54" -"checksum nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbadd3f4c98dea0bd3d9b4be4c0cdaf1ab57035cb2e41fce3983db5add7cc5" -"checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba" -"checksum output 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fa48553a7b3daf627fb657b93589c7ec94ec2048dc8c1445eba00f6d21676772" -"checksum proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" -"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum serde 1.0.111 (registry+https://github.com/rust-lang/crates.io-index)" = "c9124df5b40cbd380080b2cc6ab894c040a3070d995f5c9dc77e18c34a8ae37d" -"checksum serde_derive 1.0.111 (registry+https://github.com/rust-lang/crates.io-index)" = "3f2c3ac8e6ca1e9c80b8be1023940162bf81ae3cffbb1809474152f2ce1eb250" -"checksum serde_json 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)" = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" -"checksum sha2 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "edb7da6a2ed37c4f3090012c8a8eb085da2aa6465e6df21d9a245e294f4a59e8" -"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" -"checksum syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" -"checksum term_size 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f7f5f3f71b0040cecc71af239414c23fd3c73570f5ff54cf50e03cef637f2a0" -"checksum termion 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9a90df1ede85b25f0bbb50b6313f8fab00e30b3b251f1cc2165faa40924e1417" -"checksum time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af" -"checksum typenum 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8f87f6fc2d9e77d3721d04d87a637ed3dfbd1ffe21490edb69075de985c36d" -"checksum unicode-segmentation 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7baebdc1df1363fa66161fca2fe047e4f4209011cc7e045948298996afdf85df" -"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a9ff57156caf7e22f37baf3c9d8f6ce8194842c23419dafcb0716024514d162" -"checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index cb3ddb7..fc27b86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ rustc-serialize = "0.3" serde = { version = "1", features = ["derive"] } serde_json = "1" - sha2 = "0.4" + sha2 = "0.9" time = "0.1" [profile.dev] diff --git a/src/operations/content_hasher.rs b/src/operations/content_hasher.rs index 574a2df..3dc6680 100644 --- a/src/operations/content_hasher.rs +++ b/src/operations/content_hasher.rs @@ -226,7 +226,7 @@ fn calculate_hash_for_file ( break; } - hasher.input ( + hasher.update ( & buffer [ 0 .. bytes_read]); @@ -236,7 +236,7 @@ fn calculate_hash_for_file ( [0u8; HASH_SIZE]; result.copy_from_slice ( - & hasher.result ()); + & hasher.finalize ()); Ok (result) diff --git a/src/operations/extent_hasher.rs b/src/operations/extent_hasher.rs index 0ce5e56..3438f9a 100644 --- a/src/operations/extent_hasher.rs +++ b/src/operations/extent_hasher.rs @@ -17,232 +17,164 @@ use time; use database::*; use types::*; -pub struct ExtentHasher <'a> { +pub struct ExtentHasher<'a> { + root_paths_set: HashSet, - root_paths_set: HashSet , + batch_size: u64, - batch_size: u64, - - file_database: & 'a mut FileDatabase, - - num_ignored: u64, - num_fresh: u64, - num_updated: u64, - num_remaining: u64, - num_errors: u64, + file_database: &'a mut FileDatabase, + num_ignored: u64, + num_fresh: u64, + num_updated: u64, + num_remaining: u64, + num_errors: u64, } -impl <'a> ExtentHasher <'a> { - - pub fn new ( - root_paths: & 'a [PathRef], - batch_size: u64, - file_database: & 'a mut FileDatabase, - ) -> ExtentHasher <'a> { - - let root_paths_set: HashSet > = - root_paths.iter ().map ( - |root_path| - root_path.clone () - ).collect (); - - ExtentHasher { - - root_paths_set: root_paths_set, - - batch_size: batch_size, - - file_database: file_database, - - num_ignored: 0, - num_fresh: 0, - num_updated: 0, - num_remaining: 0, - num_errors: 0, - - } - - } - - pub fn calculate_hashes ( - & mut self, - output: & Output, - ) { - - let mut num_ignored = 0; - let mut num_fresh = 0; - let mut num_remaining = 0; - let mut num_updated = 0; - let mut num_errors = 0; - - let mut size_hashed: u64 = 0; - - for ref mut file_data - in self.file_database.iter_mut () { - - if ( - - ( - - file_data.root_path.is_none () - - ) || ( - - file_data.root_path.is_some () - - && ! self.root_paths_set.contains ( - & file_data.root_path.as_ref ().unwrap ().clone ()) - - ) - - ) { - - num_ignored += 1; - - continue; - - } else if file_data.extent_hash_time != 0 { - - num_fresh += 1; - - continue; - - } else if ( - num_updated > 0 - && size_hashed + file_data.size > self.batch_size - ) { - - num_remaining += 1; - - continue; - - } else { - - output.status_format ( - format_args! ( - "Extent hash: {}", - file_data.path.to_string_lossy ())); - - let extent_hash_time = - time::get_time (); - - if let Ok (extent_hash) = ( - calculate_extent_hash_for_file ( - file_data.path.clone ()) - ) { - - let extent_hash = - extent_hash.unwrap_or ( - ZERO_HASH); - - if extent_hash != file_data.extent_hash { - - file_data.extent_hash = extent_hash; - file_data.extent_hash_time = extent_hash_time.sec; - - file_data.defragment_time = 0; - file_data.deduplicate_time = 0; - - } - - num_updated += 1; - - } else { - - num_errors += 1; - - } - - size_hashed += file_data.size; - - } - - } - - self.num_ignored = num_ignored; - self.num_fresh = num_fresh; - self.num_remaining = num_remaining; - self.num_updated += num_updated; - self.num_errors += num_errors; - - output.clear_status (); - - } - - pub fn file_database (& self) -> & FileDatabase { - self.file_database - } - - pub fn num_fresh (& self) -> u64 { - self.num_fresh - } - - pub fn num_remaining (& self) -> u64 { - self.num_remaining - } - - pub fn num_updated (& self) -> u64 { - self.num_updated - } - - pub fn num_errors (& self) -> u64 { - self.num_errors - } - +impl<'a> ExtentHasher<'a> { + pub fn new( + root_paths: &'a [PathRef], + batch_size: u64, + file_database: &'a mut FileDatabase, + ) -> ExtentHasher<'a> { + let root_paths_set: HashSet> = root_paths + .iter() + .map(|root_path| root_path.clone()) + .collect(); + + ExtentHasher { + root_paths_set: root_paths_set, + + batch_size: batch_size, + + file_database: file_database, + + num_ignored: 0, + num_fresh: 0, + num_updated: 0, + num_remaining: 0, + num_errors: 0, + } + } + + pub fn calculate_hashes(&mut self, output: &Output) { + let mut num_ignored = 0; + let mut num_fresh = 0; + let mut num_remaining = 0; + let mut num_updated = 0; + let mut num_errors = 0; + + let mut size_hashed: u64 = 0; + + for ref mut file_data in self.file_database.iter_mut() { + if ((file_data.root_path.is_none()) + || (file_data.root_path.is_some() + && !self + .root_paths_set + .contains(&file_data.root_path.as_ref().unwrap().clone()))) + { + num_ignored += 1; + + continue; + } else if file_data.extent_hash_time != 0 { + num_fresh += 1; + + continue; + } else if (num_updated > 0 && size_hashed + file_data.size > self.batch_size) { + num_remaining += 1; + + continue; + } else { + output.status_format(format_args!( + "Extent hash: {}", + file_data.path.to_string_lossy() + )); + + let extent_hash_time = time::get_time(); + + if let Ok(extent_hash) = (calculate_extent_hash_for_file(file_data.path.clone())) { + let extent_hash = extent_hash.unwrap_or(ZERO_HASH); + + if extent_hash != file_data.extent_hash { + file_data.extent_hash = extent_hash; + file_data.extent_hash_time = extent_hash_time.sec; + + file_data.defragment_time = 0; + file_data.deduplicate_time = 0; + } + + num_updated += 1; + } else { + num_errors += 1; + } + + size_hashed += file_data.size; + } + } + + self.num_ignored = num_ignored; + self.num_fresh = num_fresh; + self.num_remaining = num_remaining; + self.num_updated += num_updated; + self.num_errors += num_errors; + + output.clear_status(); + } + + pub fn file_database(&self) -> &FileDatabase { + self.file_database + } + + pub fn num_fresh(&self) -> u64 { + self.num_fresh + } + + pub fn num_remaining(&self) -> u64 { + self.num_remaining + } + + pub fn num_updated(&self) -> u64 { + self.num_updated + } + + pub fn num_errors(&self) -> u64 { + self.num_errors + } } -pub fn calculate_extent_hash_for_file ( - path: RecursivePathRef, -) -> Result

I essentially needed to upgrade sha2, and update its usages in a few areas. I think rustfmt mangled the files, so I'm sorry about that but IMHO it should be applied across the codebase because the extant style is pretty hard to read.