From b0b00cf1ffddb9656510d6ec636596fb76ebf2fa Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 6 Dec 2009 09:29:38 +0100 Subject: [PATCH] xbps-repo: when adding local repos always create XBPS_META_PATH. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091206082938-4adrlgkbsz6lsz5y --- bin/xbps-repo/repository.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/xbps-repo/repository.c b/bin/xbps-repo/repository.c index aa00a184..d5f0bc20 100644 --- a/bin/xbps-repo/repository.c +++ b/bin/xbps-repo/repository.c @@ -149,7 +149,7 @@ unregister_repository(const char *uri) int register_repository(const char *uri) { - char *plist, idxstr[PATH_MAX]; + char *metadir, *plist, idxstr[PATH_MAX]; int rv = 0; if (xbps_check_is_repo_string_remote(uri)) { @@ -173,6 +173,21 @@ register_repository(const char *uri) if (!sanitize_url(idxstr, uri)) return errno; + /* + * Create metadir if necessary. + */ + metadir = xbps_xasprintf("%s/%s", xbps_get_rootdir(), + XBPS_META_PATH); + if (metadir == NULL) + return errno; + + if (xbps_mkpath(metadir, 0755) == -1) { + printf("E: couldn't create metadata dir! (%s)\n", + strerror(errno)); + free(metadir); + return EXIT_FAILURE; + } + free(metadir); plist = xbps_get_pkg_index_plist(idxstr); }