@@ -7,7 +7,9 @@ use std::str::FromStr;
77use bzip2:: read:: BzDecoder ;
88use flate2:: read:: GzDecoder ;
99#[ cfg( feature = "xz" ) ]
10- use xz:: read:: XzDecoder ;
10+ use xz:: bufread:: XzDecoder ;
11+ #[ cfg( feature = "xz" ) ]
12+ use xz:: stream:: Stream as XzStream ;
1113use zip:: ZipArchive ;
1214
1315use crate :: { Error , Metadata } ;
@@ -32,6 +34,8 @@ enum SDistType {
3234 #[ cfg( feature = "bzip2" ) ]
3335 BzTar ,
3436 #[ cfg( feature = "xz" ) ]
37+ LzTar ,
38+ #[ cfg( feature = "xz" ) ]
3539 XzTar ,
3640}
3741
@@ -65,6 +69,8 @@ impl FromStr for SDistType {
6569 #[ cfg( feature = "bzip2" ) ]
6670 "bz2" | "tbz" => SDistType :: BzTar ,
6771 #[ cfg( feature = "xz" ) ]
72+ "lz" | "lzma" | "tlz" => SDistType :: LzTar ,
73+ #[ cfg( feature = "xz" ) ]
6874 "txz" | "xz" => SDistType :: XzTar ,
6975 _ => return Err ( Error :: UnknownDistributionType ) ,
7076 } ;
@@ -160,6 +166,11 @@ impl Distribution {
160166 Self :: parse_tar ( BzDecoder :: new ( BufReader :: new ( fs_err:: File :: open ( path) ?) ) )
161167 }
162168 #[ cfg( feature = "xz" ) ]
169+ SDistType :: LzTar => Self :: parse_tar ( XzDecoder :: new_stream (
170+ BufReader :: new ( fs_err:: File :: open ( path) ?) ,
171+ XzStream :: new_lzma_decoder ( u64:: max_value ( ) ) . unwrap ( ) ,
172+ ) ) ,
173+ #[ cfg( feature = "xz" ) ]
163174 SDistType :: XzTar => {
164175 Self :: parse_tar ( XzDecoder :: new ( BufReader :: new ( fs_err:: File :: open ( path) ?) ) )
165176 }
0 commit comments