mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
Fix gnu archives
This commit is contained in:
parent
e8db15f662
commit
7ab8dda160
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -19,7 +19,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ar"
|
||||
version = "0.6.2"
|
||||
source = "git+https://github.com/mdsteele/rust-ar.git#1cfa68dcecaa063510758e8bdced7115a3393616"
|
||||
source = "git+https://github.com/bjorn3/rust-ar.git?branch=non_multiple_of_two_identifiers_gnu_format#efa2308b9ded41f4977d4fed98dac7af4d9075cf"
|
||||
dependencies = [
|
||||
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -582,7 +582,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
name = "rustc_codegen_cranelift"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ar 0.6.2 (git+https://github.com/mdsteele/rust-ar.git)",
|
||||
"ar 0.6.2 (git+https://github.com/bjorn3/rust-ar.git?branch=non_multiple_of_two_identifiers_gnu_format)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift 0.30.0 (git+https://github.com/CraneStation/cranelift.git)",
|
||||
@ -843,7 +843,7 @@ dependencies = [
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum ar 0.6.2 (git+https://github.com/mdsteele/rust-ar.git)" = "<none>"
|
||||
"checksum ar 0.6.2 (git+https://github.com/bjorn3/rust-ar.git?branch=non_multiple_of_two_identifiers_gnu_format)" = "<none>"
|
||||
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
|
||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||
"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
|
||||
|
@ -39,7 +39,7 @@ indexmap = "1.0.2"
|
||||
#gimli = { path = "../" }
|
||||
|
||||
[patch.crates-io]
|
||||
ar = { git = "https://github.com/mdsteele/rust-ar.git" }
|
||||
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "non_multiple_of_two_identifiers_gnu_format" }
|
||||
|
||||
[profile.dev.overrides."*"]
|
||||
opt-level = 3
|
||||
|
@ -36,7 +36,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
|
||||
dst: output.to_path_buf(),
|
||||
src: input.map(|p| p.to_path_buf()),
|
||||
lib_search_paths: archive_search_paths(sess),
|
||||
is_like_osx: true, //sess.target.target.options.is_like_osx,
|
||||
is_like_osx: sess.target.target.options.is_like_osx,
|
||||
};
|
||||
|
||||
let (src_archives, entries) = if let Some(src) = &config.src {
|
||||
@ -147,23 +147,8 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
|
||||
let entry = self.src_archives[archive_index].jump_to_entry(entry_index).unwrap();
|
||||
let orig_header = entry.header();
|
||||
|
||||
let orig_filename = orig_header.identifier().to_vec();
|
||||
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
let mut hasher = DefaultHasher::new();
|
||||
orig_filename.hash(&mut hasher);
|
||||
let mut filename = hasher.finish().to_le_bytes()[0..6].to_vec();
|
||||
filename.extend(&orig_filename[orig_filename.len() - 9..]);
|
||||
|
||||
assert!(
|
||||
filename.len() <= 16,
|
||||
"Filenames bigger than 16 bytes are not yet supported. Filename was: \"{}\"",
|
||||
String::from_utf8(filename).unwrap_or_else(|e| e.to_string()),
|
||||
);
|
||||
|
||||
let mut header =
|
||||
ar::Header::new(filename, orig_header.size());
|
||||
ar::Header::new(orig_header.identifier().to_vec(), orig_header.size());
|
||||
header.set_mtime(orig_header.mtime());
|
||||
header.set_uid(orig_header.uid());
|
||||
header.set_gid(orig_header.gid());
|
||||
|
Loading…
Reference in New Issue
Block a user