列出将包含在主机Yocto SDK中的软件包

时间:2019-08-20 16:49:44

标签: yocto

我当前遇到一个问题,即目标映像中包含的OpenCV版本与主机SDK中包含的版本(3.4.x与3.3.x)不同。

为了更好地进行调试,我想列出import os files = ['/var/www/html/file.php', '/home/www/html/data.php'] path_list = map(lambda path: os.path.dirname(path), files) file_names = ['module.php', 'test.php'] result = [os.path.join(p, f) for p in path_list for f in file_names] print(result) 制作的主机SDK中将包含的软件包(及其版本)。

我该怎么做?注意:我使用的是命令行而不是Toaster。

谢谢。

1 个答案:

答案 0 :(得分:0)

调试此类软件包或sdk问题的一种好方法是yocto buildhistory

将以下内容添加到您的local.conf

final Dio _dio = Dio();
  PersistCookieJar persistentCookies;
  final String url = "https://www.abcd.com/user/login?_format=json";

  Future<String> get _localPath async {
    final directory = await getApplicationDocumentsDirectory();
    print(directory.path);
    return directory.path;
  }

  Future<Directory> get _localCoookieDirectory async {
    final path = await _localPath;
    final Directory dir = new Directory('$path/cookies');
    await dir.create();
    print(dir);
    return dir;
  }

  Future<String> getCsrftoken() async{
    try {
      String csrfTokenValue;
      final Directory dir = await _localCoookieDirectory;
      final cookiePath = dir.path;
      persistentCookies = new PersistCookieJar(dir: '$cookiePath');
      persistentCookies.deleteAll(); //clearing any existing cookies for a fresh start
      _dio.interceptors.add(
          CookieManager(persistentCookies) //this sets up _dio to persist cookies throughout subsequent requests
      );
      _dio.options = new BaseOptions(
        baseUrl: url,
        contentType: ContentType.json,
        responseType: ResponseType.json,
        connectTimeout: 50000,
        receiveTimeout: 50000,
        headers: {
          HttpHeaders.userAgentHeader: "dio",
          "Content-Type":"application/json",
          "Accept": "application/json",
          "Connection": "keep-alive",
        },
      ); //BaseOptions will be persisted throughout subsequent requests made with _dio
      _dio.interceptors.add(
          InterceptorsWrapper(
              onResponse:(Response response) {
                List<Cookie> cookies = persistentCookies.loadForRequest(Uri.parse("https://www.abcd.com/user/login?_format=json"));
                csrfTokenValue = cookies.firstWhere((c) => c.name == 'csrftoken', orElse: () => null)?.value;
                if (csrfTokenValue != null) {
                  _dio.options.headers['X-CSRF-TOKEN'] = csrfTokenValue; //setting the csrftoken from the response in the headers
                }
                print(response);
                return response;
              }
          )
      );
      await _dio.get("https://www.abcd.com/user/login?_format=json");
      print(csrfTokenValue);
      return csrfTokenValue;
    } catch (error, stacktrace) {
      print("Exception occured: $error stackTrace: $stacktrace");
      return null;
    }
  }

  Future<Payload> SessionId() async {
    try{
      final csrf = await getCsrftoken();
      FormData formData = new FormData.from({
        "name": "${_loginData.username}",
        "pass": "${_loginData.password}",
        "csrfmiddlewaretoken" : '$csrf'
      });
      Options optionData = new Options(
        contentType: ContentType.parse("application/json"),
      );
      Response response = await _dio.post(url,options: optionData,data: formData,);
      print("StatusCode:${response.statusCode}");
      if(response.statusCode == 200){
        return Navigator.of(context).pushReplacement(MaterialPageRoute(
          builder: (context) => Home(name : user,),
        ));
      }else{
        throw Exception;
      }
    }on DioError catch(e) {
      if(e.response != null) {
        print( e.response.statusCode.toString() + " " + e.response.statusMessage);
        print(e.response.data);
        print(e.response.headers);
        print(e.response.request);
      } else{
        print(e.request);
        print(e.message);
      }
    }catch (error, stacktrace) {
      print("Exception occured: $error stackTrace: $stacktrace");
      return null;
    }
  }

将在build / buildhistory /下创建一个新文件夹,使您可以轻松地验证软件包,sdk和映像。

编辑: 由于在编译所有内容之前都需要它:

 INHERIT += "buildhistory"
 BUILDHISTORY_COMMIT = "1"
 BUILDHISTORY_FEATURES = "image package sdk" # maybe already default value