79 | 79 |
#define PyUnicode_FromString PyString_FromString
|
80 | 80 |
#endif
|
81 | 81 |
|
82 | |
using namespace tinyxml2;
|
83 | |
|
84 | 82 |
// TODO:
|
85 | 83 |
// recrawl on:
|
86 | 84 |
// package not found in cache
|
|
115 | 113 |
static const int MAX_DEPENDENCY_DEPTH = 1000;
|
116 | 114 |
static const double DEFAULT_MAX_CACHE_AGE = 60.0;
|
117 | 115 |
|
118 | |
XMLElement* get_manifest_root(Stackage* stackage);
|
|
116 |
tinyxml2::XMLElement* get_manifest_root(Stackage* stackage);
|
119 | 117 |
double time_since_epoch();
|
120 | 118 |
|
121 | 119 |
#ifdef __APPLE__
|
|
152 | 150 |
// \brief have we already loaded the manifest?
|
153 | 151 |
bool manifest_loaded_;
|
154 | 152 |
// \brief TinyXML structure, filled in during parsing
|
155 | |
XMLDocument manifest_;
|
|
153 |
tinyxml2::XMLDocument manifest_;
|
156 | 154 |
std::vector<Stackage*> deps_;
|
157 | 155 |
bool deps_computed_;
|
158 | 156 |
bool is_wet_package_;
|
|
167 | 165 |
manifest_path_(manifest_path),
|
168 | 166 |
manifest_name_(manifest_name),
|
169 | 167 |
manifest_loaded_(false),
|
|
168 |
manifest_(true, tinyxml2::COLLAPSE_WHITESPACE),
|
170 | 169 |
deps_computed_(false),
|
171 | 170 |
is_metapackage_(false)
|
172 | 171 |
{
|
|
178 | 177 |
assert(is_wet_package_);
|
179 | 178 |
assert(manifest_loaded_);
|
180 | 179 |
// get name from package.xml instead of folder name
|
181 | |
XMLElement* root = get_manifest_root(this);
|
182 | |
for(XMLElement* el = root->FirstChildElement("name"); el; el = el->NextSiblingElement("name"))
|
|
180 |
tinyxml2::XMLElement* root = get_manifest_root(this);
|
|
181 |
for(tinyxml2::XMLElement* el = root->FirstChildElement("name"); el; el = el->NextSiblingElement("name"))
|
183 | 182 |
{
|
184 | 183 |
name_ = el->GetText();
|
185 | 184 |
break;
|
186 | 185 |
}
|
187 | 186 |
// Get license texts, where there may be multiple elements for.
|
188 | 187 |
std::string tagname_license = "license";
|
189 | |
for(XMLElement* el = root->FirstChildElement(tagname_license.c_str()); el; el = el->NextSiblingElement(tagname_license.c_str()))
|
|
188 |
for(tinyxml2::XMLElement* el = root->FirstChildElement(tagname_license.c_str()); el; el = el->NextSiblingElement(tagname_license.c_str()))
|
190 | 189 |
{
|
191 | 190 |
licenses_.push_back(el->GetText());
|
192 | 191 |
}
|
193 | 192 |
// check if package is a metapackage
|
194 | |
for(XMLElement* el = root->FirstChildElement("export"); el; el = el->NextSiblingElement("export"))
|
|
193 |
for(tinyxml2::XMLElement* el = root->FirstChildElement("export"); el; el = el->NextSiblingElement("export"))
|
195 | 194 |
{
|
196 | 195 |
if(el->FirstChildElement("metapackage"))
|
197 | 196 |
{
|
|
735 | 734 |
void
|
736 | 735 |
Rosstackage::_rosdeps(Stackage* stackage, std::set<std::string>& rosdeps, const char* tag_name)
|
737 | 736 |
{
|
738 | |
XMLElement* root = get_manifest_root(stackage);
|
739 | |
for(XMLElement* ele = root->FirstChildElement(tag_name);
|
|
737 |
tinyxml2::XMLElement* root = get_manifest_root(stackage);
|
|
738 |
for(tinyxml2::XMLElement* ele = root->FirstChildElement(tag_name);
|
740 | 739 |
ele;
|
741 | 740 |
ele = ele->NextSiblingElement(tag_name))
|
742 | 741 |
{
|
|
778 | 777 |
it != deps_vec.end();
|
779 | 778 |
++it)
|
780 | 779 |
{
|
781 | |
XMLElement* root = get_manifest_root(*it);
|
782 | |
for(XMLElement* ele = root->FirstChildElement(MANIFEST_TAG_VERSIONCONTROL);
|
|
780 |
tinyxml2::XMLElement* root = get_manifest_root(*it);
|
|
781 |
for(tinyxml2::XMLElement* ele = root->FirstChildElement(MANIFEST_TAG_VERSIONCONTROL);
|
783 | 782 |
ele;
|
784 | 783 |
ele = ele->NextSiblingElement(MANIFEST_TAG_VERSIONCONTROL))
|
785 | 784 |
{
|
|
1020 | 1019 |
const std::string& attrib,
|
1021 | 1020 |
std::vector<std::string>& flags)
|
1022 | 1021 |
{
|
1023 | |
XMLElement* root = get_manifest_root(stackage);
|
1024 | |
for(XMLElement* ele = root->FirstChildElement(MANIFEST_TAG_EXPORT);
|
|
1022 |
tinyxml2::XMLElement* root = get_manifest_root(stackage);
|
|
1023 |
for(tinyxml2::XMLElement* ele = root->FirstChildElement(MANIFEST_TAG_EXPORT);
|
1025 | 1024 |
ele;
|
1026 | 1025 |
ele = ele->NextSiblingElement(MANIFEST_TAG_EXPORT))
|
1027 | 1026 |
{
|
1028 | 1027 |
bool os_match = false;
|
1029 | 1028 |
const char *best_match = NULL;
|
1030 | |
for(XMLElement* ele2 = ele->FirstChildElement(lang.c_str());
|
|
1029 |
for(tinyxml2::XMLElement* ele2 = ele->FirstChildElement(lang.c_str());
|
1031 | 1030 |
ele2;
|
1032 | 1031 |
ele2 = ele2->NextSiblingElement(lang.c_str()))
|
1033 | 1032 |
{
|
|
1126 | 1125 |
it != stackages.end();
|
1127 | 1126 |
++it)
|
1128 | 1127 |
{
|
1129 | |
XMLElement* root = get_manifest_root(*it);
|
1130 | |
for(XMLElement* ele = root->FirstChildElement(MANIFEST_TAG_EXPORT);
|
|
1128 |
tinyxml2::XMLElement* root = get_manifest_root(*it);
|
|
1129 |
for(tinyxml2::XMLElement* ele = root->FirstChildElement(MANIFEST_TAG_EXPORT);
|
1131 | 1130 |
ele;
|
1132 | 1131 |
ele = ele->NextSiblingElement(MANIFEST_TAG_EXPORT))
|
1133 | 1132 |
{
|
1134 | |
for(XMLElement* ele2 = ele->FirstChildElement(name.c_str());
|
|
1133 |
for(tinyxml2::XMLElement* ele2 = ele->FirstChildElement(name.c_str());
|
1135 | 1134 |
ele2;
|
1136 | 1135 |
ele2 = ele2->NextSiblingElement(name.c_str()))
|
1137 | 1136 |
{
|
|
1562 | 1561 |
if(stackage->manifest_loaded_)
|
1563 | 1562 |
return;
|
1564 | 1563 |
|
1565 | |
if(stackage->manifest_.LoadFile(stackage->manifest_path_.c_str()) != XML_SUCCESS)
|
|
1564 |
if(stackage->manifest_.LoadFile(stackage->manifest_path_.c_str()) != tinyxml2::XML_SUCCESS)
|
1566 | 1565 |
{
|
1567 | 1566 |
std::string errmsg = std::string("error parsing manifest of package ") +
|
1568 | 1567 |
stackage->name_ + " at " + stackage->manifest_path_;
|
|
1608 | 1607 |
void
|
1609 | 1608 |
Rosstackage::computeDepsInternal(Stackage* stackage, bool ignore_errors, const std::string& depend_tag, bool ignore_missing)
|
1610 | 1609 |
{
|
1611 | |
XMLElement* root;
|
|
1610 |
tinyxml2::XMLElement* root;
|
1612 | 1611 |
root = get_manifest_root(stackage);
|
1613 | 1612 |
|
1614 | 1613 |
const char* dep_pkgname;
|
1615 | |
for(XMLElement *dep_ele = root->FirstChildElement(depend_tag.c_str());
|
|
1614 |
for(tinyxml2::XMLElement *dep_ele = root->FirstChildElement(depend_tag.c_str());
|
1616 | 1615 |
dep_ele;
|
1617 | 1616 |
dep_ele = dep_ele->NextSiblingElement(depend_tag.c_str()))
|
1618 | 1617 |
{
|
|
2337 | 2336 |
return "stack";
|
2338 | 2337 |
}
|
2339 | 2338 |
|
2340 | |
XMLElement*
|
|
2339 |
tinyxml2::XMLElement*
|
2341 | 2340 |
get_manifest_root(Stackage* stackage)
|
2342 | 2341 |
{
|
2343 | |
XMLElement* ele = stackage->manifest_.RootElement();
|
|
2342 |
tinyxml2::XMLElement* ele = stackage->manifest_.RootElement();
|
2344 | 2343 |
if(!ele)
|
2345 | 2344 |
{
|
2346 | 2345 |
std::string errmsg = std::string("error parsing manifest of package ") +
|