Skip to content

Commit 76b4bae

Browse files
lzma support
1 parent 6ba215f commit 76b4bae

File tree

4 files changed

+129
-60
lines changed

4 files changed

+129
-60
lines changed

deb-to-ipa-app.xcodeproj/project.pbxproj

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
CE1D968128F9E3D7006AC6D2 /* Zip in Frameworks */ = {isa = PBXBuildFile; productRef = CE1D968028F9E3D7006AC6D2 /* Zip */; };
11+
CE1D968428F9E781006AC6D2 /* SWCompression in Frameworks */ = {isa = PBXBuildFile; productRef = CE1D968328F9E781006AC6D2 /* SWCompression */; };
1012
CE66018B28F83F33000EC344 /* deb_to_ipa_appApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE66018A28F83F33000EC344 /* deb_to_ipa_appApp.swift */; };
1113
CE66018D28F83F33000EC344 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE66018C28F83F33000EC344 /* ContentView.swift */; };
1214
CE66018F28F83F34000EC344 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE66018E28F83F34000EC344 /* Assets.xcassets */; };
1315
CE66019228F83F34000EC344 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE66019128F83F34000EC344 /* Preview Assets.xcassets */; };
1416
CE66019A28F85705000EC344 /* ArArchiveKit in Frameworks */ = {isa = PBXBuildFile; productRef = CE66019928F85705000EC344 /* ArArchiveKit */; };
15-
CE6AEB4928F8B99800FF43A9 /* Gzip in Frameworks */ = {isa = PBXBuildFile; productRef = CE6AEB4828F8B99800FF43A9 /* Gzip */; };
16-
CE6AEB4C28F8BA7600FF43A9 /* Light-Swift-Untar in Frameworks */ = {isa = PBXBuildFile; productRef = CE6AEB4B28F8BA7600FF43A9 /* Light-Swift-Untar */; };
17-
CE6AEB5128F8BD3F00FF43A9 /* Zip in Frameworks */ = {isa = PBXBuildFile; productRef = CE6AEB5028F8BD3F00FF43A9 /* Zip */; };
1817
/* End PBXBuildFile section */
1918

2019
/* Begin PBXFileReference section */
@@ -30,10 +29,9 @@
3029
isa = PBXFrameworksBuildPhase;
3130
buildActionMask = 2147483647;
3231
files = (
33-
CE6AEB4928F8B99800FF43A9 /* Gzip in Frameworks */,
32+
CE1D968428F9E781006AC6D2 /* SWCompression in Frameworks */,
3433
CE66019A28F85705000EC344 /* ArArchiveKit in Frameworks */,
35-
CE6AEB5128F8BD3F00FF43A9 /* Zip in Frameworks */,
36-
CE6AEB4C28F8BA7600FF43A9 /* Light-Swift-Untar in Frameworks */,
34+
CE1D968128F9E3D7006AC6D2 /* Zip in Frameworks */,
3735
);
3836
runOnlyForDeploymentPostprocessing = 0;
3937
};
@@ -45,6 +43,7 @@
4543
children = (
4644
CE66018928F83F33000EC344 /* deb-to-ipa-app */,
4745
CE66018828F83F33000EC344 /* Products */,
46+
CE7B175B28F9D4E000B65A74 /* Frameworks */,
4847
);
4948
sourceTree = "<group>";
5049
};
@@ -75,6 +74,13 @@
7574
path = "Preview Content";
7675
sourceTree = "<group>";
7776
};
77+
CE7B175B28F9D4E000B65A74 /* Frameworks */ = {
78+
isa = PBXGroup;
79+
children = (
80+
);
81+
name = Frameworks;
82+
sourceTree = "<group>";
83+
};
7884
/* End PBXGroup section */
7985

8086
/* Begin PBXNativeTarget section */
@@ -93,9 +99,8 @@
9399
name = "deb-to-ipa-app";
94100
packageProductDependencies = (
95101
CE66019928F85705000EC344 /* ArArchiveKit */,
96-
CE6AEB4828F8B99800FF43A9 /* Gzip */,
97-
CE6AEB4B28F8BA7600FF43A9 /* Light-Swift-Untar */,
98-
CE6AEB5028F8BD3F00FF43A9 /* Zip */,
102+
CE1D968028F9E3D7006AC6D2 /* Zip */,
103+
CE1D968328F9E781006AC6D2 /* SWCompression */,
99104
);
100105
productName = "deb-to-ipa-app";
101106
productReference = CE66018728F83F33000EC344 /* deb-to-ipa-app.app */;
@@ -127,9 +132,8 @@
127132
mainGroup = CE66017E28F83F33000EC344;
128133
packageReferences = (
129134
CE66019828F85705000EC344 /* XCRemoteSwiftPackageReference "ArArchiveKit" */,
130-
CE6AEB4728F8B99800FF43A9 /* XCRemoteSwiftPackageReference "GzipSwift" */,
131-
CE6AEB4A28F8BA7600FF43A9 /* XCRemoteSwiftPackageReference "Light-Swift-Untar" */,
132135
CE6AEB4F28F8BD3F00FF43A9 /* XCRemoteSwiftPackageReference "Zip" */,
136+
CE1D968228F9E781006AC6D2 /* XCRemoteSwiftPackageReference "SWCompression" */,
133137
);
134138
productRefGroup = CE66018828F83F33000EC344 /* Products */;
135139
projectDirPath = "";
@@ -365,28 +369,20 @@
365369
/* End XCConfigurationList section */
366370

367371
/* Begin XCRemoteSwiftPackageReference section */
368-
CE66019828F85705000EC344 /* XCRemoteSwiftPackageReference "ArArchiveKit" */ = {
372+
CE1D968228F9E781006AC6D2 /* XCRemoteSwiftPackageReference "SWCompression" */ = {
369373
isa = XCRemoteSwiftPackageReference;
370-
repositoryURL = "https://github.com/LebJe/ArArchiveKit";
374+
repositoryURL = "https://github.com/tsolomko/SWCompression";
371375
requirement = {
372-
kind = upToNextMajorVersion;
373-
minimumVersion = 0.3.0;
376+
branch = develop;
377+
kind = branch;
374378
};
375379
};
376-
CE6AEB4728F8B99800FF43A9 /* XCRemoteSwiftPackageReference "GzipSwift" */ = {
380+
CE66019828F85705000EC344 /* XCRemoteSwiftPackageReference "ArArchiveKit" */ = {
377381
isa = XCRemoteSwiftPackageReference;
378-
repositoryURL = "https://github.com/1024jp/GzipSwift";
382+
repositoryURL = "https://github.com/LebJe/ArArchiveKit";
379383
requirement = {
380384
kind = upToNextMajorVersion;
381-
minimumVersion = 5.0.0;
382-
};
383-
};
384-
CE6AEB4A28F8BA7600FF43A9 /* XCRemoteSwiftPackageReference "Light-Swift-Untar" */ = {
385-
isa = XCRemoteSwiftPackageReference;
386-
repositoryURL = "https://github.com/UInt2048/Light-Swift-Untar";
387-
requirement = {
388-
branch = main;
389-
kind = branch;
385+
minimumVersion = 0.3.0;
390386
};
391387
};
392388
CE6AEB4F28F8BD3F00FF43A9 /* XCRemoteSwiftPackageReference "Zip" */ = {
@@ -400,25 +396,20 @@
400396
/* End XCRemoteSwiftPackageReference section */
401397

402398
/* Begin XCSwiftPackageProductDependency section */
403-
CE66019928F85705000EC344 /* ArArchiveKit */ = {
404-
isa = XCSwiftPackageProductDependency;
405-
package = CE66019828F85705000EC344 /* XCRemoteSwiftPackageReference "ArArchiveKit" */;
406-
productName = ArArchiveKit;
407-
};
408-
CE6AEB4828F8B99800FF43A9 /* Gzip */ = {
399+
CE1D968028F9E3D7006AC6D2 /* Zip */ = {
409400
isa = XCSwiftPackageProductDependency;
410-
package = CE6AEB4728F8B99800FF43A9 /* XCRemoteSwiftPackageReference "GzipSwift" */;
411-
productName = Gzip;
401+
package = CE6AEB4F28F8BD3F00FF43A9 /* XCRemoteSwiftPackageReference "Zip" */;
402+
productName = Zip;
412403
};
413-
CE6AEB4B28F8BA7600FF43A9 /* Light-Swift-Untar */ = {
404+
CE1D968328F9E781006AC6D2 /* SWCompression */ = {
414405
isa = XCSwiftPackageProductDependency;
415-
package = CE6AEB4A28F8BA7600FF43A9 /* XCRemoteSwiftPackageReference "Light-Swift-Untar" */;
416-
productName = "Light-Swift-Untar";
406+
package = CE1D968228F9E781006AC6D2 /* XCRemoteSwiftPackageReference "SWCompression" */;
407+
productName = SWCompression;
417408
};
418-
CE6AEB5028F8BD3F00FF43A9 /* Zip */ = {
409+
CE66019928F85705000EC344 /* ArArchiveKit */ = {
419410
isa = XCSwiftPackageProductDependency;
420-
package = CE6AEB4F28F8BD3F00FF43A9 /* XCRemoteSwiftPackageReference "Zip" */;
421-
productName = Zip;
411+
package = CE66019828F85705000EC344 /* XCRemoteSwiftPackageReference "ArArchiveKit" */;
412+
productName = ArArchiveKit;
422413
};
423414
/* End XCSwiftPackageProductDependency section */
424415
};

deb-to-ipa-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deb-to-ipa-app.xcodeproj/xcuserdata/exerhythm.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,70 @@
33
uuid = "B3561551-DDD0-42BB-A196-828812B38615"
44
type = "1"
55
version = "2.0">
6+
<Breakpoints>
7+
<BreakpointProxy
8+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
9+
<BreakpointContent
10+
uuid = "FF354493-45C0-4E69-ADBA-1B1B7B7532CA"
11+
shouldBeEnabled = "Yes"
12+
ignoreCount = "0"
13+
continueAfterRunningActions = "No"
14+
filePath = "../../../Library/Developer/Xcode/DerivedData/deb-to-ipa-app-fqrvqtsyzsybavgkcaeysuyujmwg/SourcePackages/checkouts/Zip/Zip/minizip/unzip.c"
15+
startingColumnNumber = "9223372036854775807"
16+
endingColumnNumber = "9223372036854775807"
17+
startingLineNumber = "1321"
18+
endingLineNumber = "1321"
19+
landmarkName = "unzReadCurrentFile(file, buf, len)"
20+
landmarkType = "9">
21+
</BreakpointContent>
22+
</BreakpointProxy>
23+
<BreakpointProxy
24+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
25+
<BreakpointContent
26+
uuid = "BB533451-E8AF-44F2-B77B-7954B4325A62"
27+
shouldBeEnabled = "Yes"
28+
ignoreCount = "0"
29+
continueAfterRunningActions = "No"
30+
filePath = "../../../Library/Developer/Xcode/DerivedData/deb-to-ipa-app-fqrvqtsyzsybavgkcaeysuyujmwg/SourcePackages/checkouts/Zip/Zip/Zip.swift"
31+
startingColumnNumber = "9223372036854775807"
32+
endingColumnNumber = "9223372036854775807"
33+
startingLineNumber = "212"
34+
endingLineNumber = "212"
35+
landmarkName = "unzipFile(_:destination:overwrite:password:progress:fileOutputHandler:)"
36+
landmarkType = "7">
37+
</BreakpointContent>
38+
</BreakpointProxy>
39+
<BreakpointProxy
40+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
41+
<BreakpointContent
42+
uuid = "8BE8ACE8-CCDF-44D1-A301-6D0F47AD4FC1"
43+
shouldBeEnabled = "Yes"
44+
ignoreCount = "0"
45+
continueAfterRunningActions = "No"
46+
filePath = "../../../Library/Developer/Xcode/DerivedData/deb-to-ipa-app-fqrvqtsyzsybavgkcaeysuyujmwg/SourcePackages/checkouts/Light-Swift-Untar/Light-Swift-Untar.swift"
47+
startingColumnNumber = "9223372036854775807"
48+
endingColumnNumber = "9223372036854775807"
49+
startingLineNumber = "49"
50+
endingLineNumber = "49"
51+
landmarkName = "createFilesAndDirectories(path:tarObject:size:progress:)"
52+
landmarkType = "7">
53+
</BreakpointContent>
54+
</BreakpointProxy>
55+
<BreakpointProxy
56+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
57+
<BreakpointContent
58+
uuid = "3A92D434-B076-437A-BEB6-729AC3780C28"
59+
shouldBeEnabled = "Yes"
60+
ignoreCount = "0"
61+
continueAfterRunningActions = "No"
62+
filePath = "../../../Library/Developer/Xcode/DerivedData/deb-to-ipa-app-fqrvqtsyzsybavgkcaeysuyujmwg/SourcePackages/checkouts/Light-Swift-Untar/Light-Swift-Untar.swift"
63+
startingColumnNumber = "9223372036854775807"
64+
endingColumnNumber = "9223372036854775807"
65+
startingLineNumber = "29"
66+
endingLineNumber = "29"
67+
landmarkName = "createFilesAndDirectories(path:tarObject:size:progress:)"
68+
landmarkType = "7">
69+
</BreakpointContent>
70+
</BreakpointProxy>
71+
</Breakpoints>
672
</Bucket>

deb-to-ipa-app/ContentView.swift

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
import SwiftUI
99
import ArArchiveKit
10-
import Gzip
11-
import Light_Swift_Untar
1210
import Zip
11+
import SWCompression
1312

1413
struct ContentView: View {
1514
@State private var isImporting = false
@@ -30,7 +29,7 @@ struct ContentView: View {
3029
.background(Color.blue)
3130
.cornerRadius(8)
3231
.foregroundColor(.white)
33-
Text("By sourcelocation\n\nCredits: itsnebulalol,\n LebJe/ArArchiveKit, \n1024jp/GzipSwift,\nmarmelroy/Zip,\nUInt2048/Light-Swift-Untar")
32+
Text("By sourcelocation\n\nCredits: itsnebulalol,\nLebJe/ArArchiveKit,\nmarmelroy/Zip,\ntsolomko/SWCompression")
3433
.foregroundColor(Color.secondary)
3534
.font(.caption)
3635
.multilineTextAlignment(.center)
@@ -60,29 +59,42 @@ struct ContentView: View {
6059
let tempDir = fm.temporaryDirectory
6160
let extractedDir = tempDir.appendingPathComponent("extracted")
6261
let ipaPayloadDir = tempDir.appendingPathComponent("Payload")
63-
let dataURL = tempDir.appendingPathComponent("deb.tar.gz")
62+
var dataURL: URL?
6463
var zipFilePath: URL?
6564
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: {
66-
6765
do {
6866
guard url.startAccessingSecurityScopedResource() else { throw ConversionError.noPermission }
6967
let reader = try ArArchiveReader(archive: Array<UInt8>(Data(contentsOf: url)))
7068

7169
// Extract .deb
7270
var foundData = false
7371
for (header, dataInts) in reader {
74-
if header.name == "data.tar.gz" {
72+
if header.name == "data.tar.gz" || header.name == "data.tar.lzma" {
73+
dataURL = tempDir.appendingPathComponent(header.name)
74+
foundData = true
75+
7576
// Extract data.tar.gz
7677
let data = Data(dataInts)
77-
try data.write(to: dataURL, options: .atomic)
78-
foundData = true
79-
let decompressedData = try data.gunzipped()
80-
try fm.createFilesAndDirectories(url: extractedDir, tarData: decompressedData)
78+
try data.write(to: dataURL!, options: .atomic)
79+
80+
let decompressedData = header.name == "data.tar.gz" ? try GzipArchive.unarchive(archive:data) : try LZMA.decompress(data: data)
81+
try decompressedData.write(to: extractedDir.appendingPathExtension("tar"))
82+
let tarContainer = try TarContainer.open(container: decompressedData)
83+
// try fm.createFilesAndDirectories(url: extractedDir, tarData: decompressedData)
84+
for entry in tarContainer {
85+
if entry.info.type == .directory {
86+
try fm.createDirectory(at: extractedDir.appendingPathComponent(entry.info.name), withIntermediateDirectories: true)
87+
} else if entry.info.type == .regular {
88+
try entry.data?.write(to: extractedDir.appendingPathComponent(entry.info.name))
89+
} else {
90+
alert("unknown")
91+
}
92+
print(entry.info)
93+
}
8194

8295
// Create .ipa archive
8396
try fm.createDirectory(at: ipaPayloadDir, withIntermediateDirectories: true)
8497

85-
// Copy apps to the archive
8698
for url in try fm.contentsOfDirectory(at: tempDir.appendingPathComponent( "extracted/Applications/"), includingPropertiesForKeys: nil) {
8799
try fm.moveItem(at: url, to: ipaPayloadDir.appendingPathComponent( url.lastPathComponent))
88100
}
@@ -116,7 +128,7 @@ struct ContentView: View {
116128
}
117129
url.stopAccessingSecurityScopedResource()
118130
// clean up
119-
try? fm.removeItem(at: dataURL)
131+
if (dataURL != nil) { try? fm.removeItem(at: dataURL!) }
120132
try? fm.removeItem(at: extractedDir)
121133
try? fm.removeItem(at: ipaPayloadDir)
122134
if zipFilePath != nil {

0 commit comments

Comments
 (0)