From 04ea94103db92d6d27230794e14606547aacf670 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 24 Sep 2015 08:08:23 +0200 Subject: Factor and reuse manifest fetching code --- bpkg/rep-create.cxx | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) (limited to 'bpkg/rep-create.cxx') diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index 6ee0e87..8cb1827 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -12,9 +12,9 @@ #include // dir_iterator #include -#include #include +#include #include #include #include @@ -143,33 +143,8 @@ namespace bpkg // Load the 'repositories' file to make sure it is there and // is valid. // - // @@ The same code as in rep-fetch. - // @@ Should we check for duplicates? Or should this be done at - // the manifest level? - // - path rf (d / path ("repositories")); - - if (!exists (rf)) - fail << "file " << rf << " does not exist"; - - try - { - ifstream ifs; - ifs.exceptions (ofstream::badbit | ofstream::failbit); - ifs.open (rf.string ()); - - manifest_parser mp (ifs, rf.string ()); - repository_manifests ms (mp); - level4 ([&]{trace << ms.size () - 1 << " prerequisite repository(s)";}); - } - catch (const manifest_parsing& e) - { - fail (e.name, e.line, e.column) << e.description; - } - catch (const ifstream::failure&) - { - fail << "unable to read from " << rf; - } + repository_manifests rms (fetch_repositories (d)); + level4 ([&]{trace << rms.size () - 1 << " prerequisite repository(s)";}); // While we could have serialized as we go along, the order of // packages will be pretty much random and not reproducible. By -- cgit v1.1