mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-09 08:47:31 +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:args/command_runner.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
|
import 'package:archive/archive.dart';
|
||||||
|
|
||||||
import '../../core/env.dart';
|
import '../../core/env.dart';
|
||||||
import 'common.dart';
|
import 'common.dart';
|
||||||
@ -48,26 +49,39 @@ class LinuxBuildCommand extends Command with BuildCommandCommonSteps {
|
|||||||
final bundleDirPath =
|
final bundleDirPath =
|
||||||
join(cwd.path, "build", "linux", "x64", "release", "bundle");
|
join(cwd.path, "build", "linux", "x64", "release", "bundle");
|
||||||
|
|
||||||
final tarPath = join(
|
final tarFile = File(join(
|
||||||
cwd.path,
|
cwd.path,
|
||||||
"build",
|
"dist",
|
||||||
"spotube-linux-"
|
"spotube-linux-"
|
||||||
"${CliEnv.channel == BuildChannel.nightly ? "nightly" : versionWithoutBuildNumber}"
|
"${CliEnv.channel == BuildChannel.nightly ? "nightly" : versionWithoutBuildNumber}"
|
||||||
"-x86_64.tar.xz",
|
"-x86_64.tar.xz",
|
||||||
);
|
));
|
||||||
|
|
||||||
await copyPath(bundleDirPath, tempDir);
|
await copyPath(bundleDirPath, tempDir);
|
||||||
|
await copyPath(join(cwd.path, "linux", "spotube.desktop"), tempDir);
|
||||||
await shell.run(
|
await copyPath(
|
||||||
"""
|
join(cwd.path, "linux", "com.github.KRTirtho.Spotube.appdata.xml"),
|
||||||
cp ${join(cwd.path, "linux", "spotube.desktop")} $tempDir
|
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, "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(
|
final ogDeb = File(
|
||||||
join(
|
join(
|
||||||
|
|||||||
14
pubspec.lock
14
pubspec.lock
@ -42,13 +42,13 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.1"
|
version: "4.0.1"
|
||||||
archive:
|
archive:
|
||||||
dependency: transitive
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: archive
|
name: archive
|
||||||
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
|
sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.4.10"
|
version: "3.5.1"
|
||||||
args:
|
args:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -1702,14 +1702,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
pointycastle:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: pointycastle
|
|
||||||
sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.8.0"
|
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -147,6 +147,7 @@ dev_dependencies:
|
|||||||
process_run: ^0.14.2
|
process_run: ^0.14.2
|
||||||
xml: ^6.5.0
|
xml: ^6.5.0
|
||||||
io: ^1.0.4
|
io: ^1.0.4
|
||||||
|
archive: ^3.5.1
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
uuid: ^4.4.0
|
uuid: ^4.4.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user