Skip to content

Commit

Permalink
cd: use tar command directly
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed May 7, 2024
1 parent 65db056 commit 28a2138
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
21 changes: 3 additions & 18 deletions cli/commands/build/linux.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:io/io.dart';
import 'package:args/command_runner.dart';
import 'package:intl/intl.dart';
import 'package:path/path.dart';
import 'package:archive/archive.dart';

import '../../core/env.dart';
import 'common.dart';
Expand Down Expand Up @@ -70,23 +69,9 @@ class LinuxBuildCommand extends Command with BuildCommandCommonSteps {
join(tempDir, "spotube-logo.png"),
);

final archive = Archive();

for (final entity in Directory(tempDir).listSync(recursive: true)) {
if (entity is File) {
final fileRelPath = relative(entity.path, from: tempDir);
final file = File(entity.path);
final fileData = file.readAsBytesSync();
archive.addFile(ArchiveFile(fileRelPath, fileData.length, fileData));
}
}

// convert to tar.xz
final tarEncoder = TarEncoder();
final xzEncoder = XZEncoder();
final tarXzData = xzEncoder.encode(tarEncoder.encode(archive));

await tarFile.writeAsBytes(tarXzData);
await shell.run(
"tar -cJf ${tarFile.path} -C $tempDir .",
);

final ogDeb = File(
join(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ packages:
source: hosted
version: "4.0.1"
archive:
dependency: "direct dev"
dependency: transitive
description:
name: archive
sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ dev_dependencies:
process_run: ^0.14.2
xml: ^6.5.0
io: ^1.0.4
archive: ^3.5.1

dependency_overrides:
uuid: ^4.4.0
Expand Down

0 comments on commit 28a2138

Please sign in to comment.