prepare method

Future<bool> prepare({
  1. String? excludedLibs,
  2. String? excludedPackages,
})

Fetches the needed info of the yaml file and the program arguments.

Returns false on error.

Implementation

Future<bool> prepare({
  String? excludedLibs,
  String? excludedPackages,
}) async {
  bool rc = true;
  File yaml = File("debian/debian.yaml");

  if (await yaml.exists()) {
    try {
      final debianYaml = loadYaml(await yaml.readAsString());
      if (debianYaml.containsKey('control')) {
        if (debianYaml['control'].containsKey('Architecture')) {
          preferredArchitecture = debianYaml['control']['Architecture'];
        }
        if (debianYaml['control'].containsKey('Package')) {
          this.excludedPackages.add(debianYaml['control']['Package']);
        }
      }
      if (preferredArchitecture != 'amd64') {
        excludedArchitecture = RegExp(r'-i386$');
      }
    } catch (e) {
      rethrow;
    }
  }
  if (excludedLibs != null) this.excludedLibs = RegExp(excludedLibs);
  if (excludedPackages != null)
    this.excludedPackages = excludedPackages.split(',');
  return rc;
}