From 28a213831d14a44c403b49e8c3df92d53af7a2e0 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Tue, 7 May 2024 23:19:15 +0600 Subject: [PATCH] cd: use tar command directly --- cli/commands/build/linux.dart | 21 +++------------------ pubspec.lock | 2 +- pubspec.yaml | 1 - 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/cli/commands/build/linux.dart b/cli/commands/build/linux.dart index 7f0e49957..a218720ce 100644 --- a/cli/commands/build/linux.dart +++ b/cli/commands/build/linux.dart @@ -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'; @@ -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( diff --git a/pubspec.lock b/pubspec.lock index 20166a3d0..df623b9e1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -42,7 +42,7 @@ packages: source: hosted version: "4.0.1" archive: - dependency: "direct dev" + dependency: transitive description: name: archive sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265 diff --git a/pubspec.yaml b/pubspec.yaml index fae2d946a..7435e077c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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