Commit f829c16 1 parent e3f6174 commit f829c16 Copy full SHA for f829c16
File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 34
34
*/
35
35
36
36
#include "conf/OptionBool.hpp"
37
+ #include "conf/ConfigParser.hpp"
37
38
38
39
#include "dnf-context.hpp"
39
40
#include "hy-repo-private.hpp"
45
46
#include <glib/gstdio.h>
46
47
#include "hy-util.h"
47
48
#include <librepo/librepo.h>
49
+ #include <librepo/url_substitution.h>
48
50
#include <rpm/rpmts.h>
49
51
#include <librepo/yum.h>
50
52
@@ -242,14 +244,17 @@ static gchar *
242
244
dnf_repo_substitute (DnfRepo * repo , const gchar * url )
243
245
{
244
246
DnfRepoPrivate * priv = GET_PRIVATE (repo );
245
- char * tmp ;
246
- gchar * substituted ;
247
247
248
- /* do a little dance so we can use g_free() rather than lr_free() */
249
- tmp = lr_url_substitute (url , priv -> urlvars );
250
- substituted = g_strdup (tmp );
251
- lr_free (tmp );
248
+ std ::map < std ::string , std ::string > substitutions ;
249
+ for (LrUrlVars * elem = priv -> urlvars ; elem ; elem = g_slist_next (elem )) {
250
+ const auto * pair = static_cast < LrVar * > (elem -> data );
251
+ substitutions .insert ({std ::string {pair -> var }, std ::string {pair -> val }});
252
+ }
253
+
254
+ std ::string tmp {url };
255
+ libdnf ::ConfigParser ::substitute (tmp , substitutions );
252
256
257
+ auto * substituted = g_strdup (tmp .c_str ());
253
258
return substituted ;
254
259
}
255
260
You can’t perform that action at this time.
0 commit comments