1 /* 2 * Copyright (C) 2013 Red Hat, Inc. 3 * 4 * Licensed under the GNU Lesser General Public License Version 2.1 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef HY_SUBJECT_H 22 #define HY_SUBJECT_H 23 24 #include <stdlib.h> 25 #include <solv/util.h> 26 #include "dnf-types.h" 27 #include "hy-types.h" 28 29 #include <glib.h> 30 #include <stdbool.h> 31 32 G_BEGIN_DECLS 33 34 typedef enum _HyForm { 35 HY_FORM_NEVRA = 1, 36 HY_FORM_NEVR = 2, 37 HY_FORM_NEV = 3, 38 HY_FORM_NA = 4, 39 HY_FORM_NAME = 5, 40 _HY_FORM_STOP_ = -1 41 } HyForm; 42 43 typedef enum _HyModuleForm { 44 HY_MODULE_FORM_NSVCAP = 1, 45 HY_MODULE_FORM_NSVCA = 2, 46 HY_MODULE_FORM_NSVAP = 3, 47 HY_MODULE_FORM_NSVA = 4, 48 HY_MODULE_FORM_NSAP = 5, 49 HY_MODULE_FORM_NSA = 6, 50 HY_MODULE_FORM_NSVCP = 7, 51 HY_MODULE_FORM_NSVP = 8, 52 HY_MODULE_FORM_NSVC = 9, 53 HY_MODULE_FORM_NSV = 10, 54 HY_MODULE_FORM_NSP = 11, 55 HY_MODULE_FORM_NS = 12, 56 HY_MODULE_FORM_NAP = 13, 57 HY_MODULE_FORM_NA = 14, 58 HY_MODULE_FORM_NP = 15, 59 HY_MODULE_FORM_N = 16, 60 _HY_MODULE_FORM_STOP_ = -1 61 } HyModuleForm; 62 63 extern const HyForm HY_FORMS_MOST_SPEC[]; 64 extern const HyModuleForm HY_MODULE_FORMS_MOST_SPEC[]; 65 66 HySubject hy_subject_create(const char * pattern); 67 void hy_subject_free(HySubject subject); 68 69 HyQuery hy_subject_get_best_solution(HySubject subject, DnfSack *sack, HyForm *forms, 70 HyNevra *out_nevra, gboolean icase, gboolean with_nevra, 71 gboolean with_provides, gboolean with_filenames, 72 gboolean with_src); 73 HyQuery hy_subject_get_best_query(HySubject subject, DnfSack *sack, gboolean with_provides); 74 75 /** 76 * @brief Returns HySelector with packages that represents subject. Subject can be NEVRA, provide, 77 * or file provide. Additionally result can be enrich for obsoletes if subject is NEVRA with just 78 * name. 79 * 80 * @param subject subject 81 * @param sack DnfSack 82 * @param forms HyForm *forms or NULL 83 * @param obsoletes If TRUE, obsoletes will be added to result 84 * @param reponame Id of repo 85 * @param with_src Include source packages 86 * @return HySelector 87 */ 88 HySelector hy_subject_get_best_selector(HySubject subject, DnfSack *sack, HyForm *forms, 89 bool obsoletes, const char *reponame); 90 91 G_END_DECLS 92 93 G_DEFINE_AUTO_CLEANUP_FREE_FUNC(HySubject, hy_subject_free, NULL) 94 95 #endif 96