mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-08 00:17:29 +00:00
cd: use dart tar archive for creating tar file
This commit is contained in:
parent
bb3f83d46b
commit
f021c4f996
@ -5,6 +5,7 @@ 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';
|
||||
@ -48,26 +49,39 @@ class LinuxBuildCommand extends Command with BuildCommandCommonSteps {
|
||||
final bundleDirPath =
|
||||
join(cwd.path, "build", "linux", "x64", "release", "bundle");
|
||||
|
||||
final tarPath = join(
|
||||
final tarFile = File(join(
|
||||
cwd.path,
|
||||
"build",
|
||||
"dist",
|
||||
"spotube-linux-"
|
||||
"${CliEnv.channel == BuildChannel.nightly ? "nightly" : versionWithoutBuildNumber}"
|
||||
"-x86_64.tar.xz",
|
||||
);
|
||||
));
|
||||
|
||||
await copyPath(bundleDirPath, tempDir);
|
||||
|
||||
await shell.run(
|
||||
"""
|
||||
cp ${join(cwd.path, "linux", "spotube.desktop")} $tempDir
|
||||
cp ${join(cwd.path, "linux", "com.github.KRTirtho.Spotube.appdata.xml")} $tempDir
|
||||
cp ${join(cwd.path, "assets", "spotube-logo.png")} $tempDir
|
||||
tar -cJf $tarPath -C $tempDir .
|
||||
""",
|
||||
await copyPath(join(cwd.path, "linux", "spotube.desktop"), tempDir);
|
||||
await copyPath(
|
||||
join(cwd.path, "linux", "com.github.KRTirtho.Spotube.appdata.xml"),
|
||||
tempDir,
|
||||
);
|
||||
await copyPath(join(cwd.path, "assets", "spotube-logo.png"), tempDir);
|
||||
|
||||
await File(tarPath).copy(join(cwd.path, "dist"));
|
||||
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);
|
||||
|
||||
final ogDeb = File(
|
||||
join(
|
||||
|
||||
14
pubspec.lock
14
pubspec.lock
@ -42,13 +42,13 @@ packages:
|
||||
source: hosted
|
||||
version: "4.0.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: archive
|
||||
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
|
||||
sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.10"
|
||||
version: "3.5.1"
|
||||
args:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1702,14 +1702,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
pointycastle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointycastle
|
||||
sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.8.0"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -147,6 +147,7 @@ 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user