}
+/** Prepend protocol if necessary
+ */
+static gchar *
+prepend_protocol(const gchar *url)
+{
+ if (url && *url == '/')
+ return g_strconcat("file://", url, NULL);
+ return g_strdup(url);
+}
+
+
int
koji_stuff_prepare(struct KojiMergedReposStuff **koji_stuff_ptr,
struct CmdOptions *cmd_options,
list = g_slist_prepend(list, pkg);
if ((!pkg->location_base || *pkg->location_base == '\0') && repopath) {
_cleanup_free_ gchar *repopath_with_protocol = NULL;
- if (*repopath == '/')
- // Repo path is local absolute path
- repopath_with_protocol = g_strconcat("file://", repopath, NULL);
- else
- repopath_with_protocol = g_strdup(repopath);
+ repopath_with_protocol = prepend_protocol(repopath);
pkg->location_base = cr_safe_string_chunk_insert(pkg->chunk, repopath_with_protocol);
}
g_hash_table_insert (merged, (gpointer) pkg->name, (gpointer) list);
}
-
long
merge_repos(GHashTable *merged,
GSList *repo_list,
repo_loaded_packages++;
// Koji-mergerepos specific behaviour -----------
if (koji_stuff && koji_stuff->pkgorigins) {
- gchar *nvra = cr_package_nvra(pkg);
+ _cleanup_free_ gchar *nvra = cr_package_nvra(pkg);
+ _cleanup_free_ gchar *url = prepend_protocol(ml->original_url);
+
cr_printf(NULL,
koji_stuff->pkgorigins,
"%s\t%s\n",
- nvra, ml->original_url);
- g_free(nvra);
+ nvra, url);
}
// Koji-mergerepos specific behaviour - end -----
}