Skip to content

Commit

Permalink
Merge 152666b into 0b36586
Browse files Browse the repository at this point in the history
  • Loading branch information
iche033 authored Feb 14, 2023
2 parents 0b36586 + 152666b commit 68709b0
Show file tree
Hide file tree
Showing 19 changed files with 226 additions and 131 deletions.
35 changes: 34 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

## Gazebo Fuel Tools 8.x

### Gazebo Fuel Tools 8.0.1

1. Forward ports.
* [Pull request #306](https://github.com/gazebosim/gz-fuel-tools/pull/306)
* [Pull request #310](https://github.com/gazebosim/gz-fuel-tools/pull/310)

1. Remove fuel.ignitionrobotics.org from ClientConfig.
* [Pull request #293](https://github.com/gazebosim/gz-fuel-tools/pull/293)

1. Clean up a few Windows warnings.
* [Pull request #308](https://github.com/gazebosim/gz-fuel-tools/pull/308)

### Gazebo Fuel Tools 8.0.0

1. Update test infrastruture
Expand Down Expand Up @@ -42,6 +54,11 @@

## Gazebo Fuel Tools 7.x

### Gazebo Fuel Tools 7.2.0 (2021-11-17)

1. Forward port 4.7.0.
* [Pull request #306](https://github.com/gazebosim/gz-fuel-tools/pull/306)

### Gazebo Fuel Tools 7.1.0 (2021-08-16)

1. Ignition to Gazebo server rename effort
Expand Down Expand Up @@ -236,6 +253,22 @@

## Gazebo Fuel Tools 4.x

### Gazebo Fuel Tools 4.8.0 (2022-12-07)

1. Reduce asset download sizes.
* [Pull request #316](https://github.com/gazebosim/gz-fuel-tools/pull/316)

1. Update tutorials to use Gazebo.
* [Pull request #303](https://github.com/gazebosim/gz-fuel-tools/pull/303)

1. Change ignitionrobotics.org to gazebosim.org.
* [Pull request #304](https://github.com/gazebosim/gz-fuel-tools/pull/304)

### Gazebo Fuel Tools 4.7.0 (2022-11-17)

1. ign -> gz Migrate Ignition Headers : gz-fuel-tools.
* [Pull request #285](https://github.com/gazebosim/gz-fuel-tools/pull/285)

### Gazebo Fuel Tools 4.6.0 (2022-08-15)

. Ignition to Gazebo server rename
Expand All @@ -253,7 +286,7 @@
1. Remove unused files (bitbucket-pipelines, docs)
* [Pull request #273](https://github.com/gazebosim/gz-fuel-tools/pull/273)

1. Disable `staging-fuel.ignitionrobotics.org` test
1. Disable `staging-fuel.gazebosim.org` test
* [Pull request #257](https://github.com/gazebosim/gz-fuel-tools/pull/257)

### Gazebo Fuel Tools 4.5.0 (2022-06-01)
Expand Down
6 changes: 6 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@

## Gazebo Fuel Tools 3.X to 4.X

### Depercations

1. The `fuel.ignitionrobotics.org` Fuel server has been deprecated, and
redirects to `fuel.gazebosim.org`. Use `fuel.gazebosim.org` in all Fuel
URLs.

### Modifications

1. `FuelClient::UploadModel` takes 2 more arguments now.
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
http://bitbucket.org/gazebosim/gz-rndf
https://gazebosim.org
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ For a complete list of commands run `gz fuel -h` on the command line.
**List all models**
```
$ gz fuel list -t model -r | head
https://fuel.gazebosim.org/1.0/09ubberboy90/models/box%205cm
https://fuel.gazebosim.org/1.0/accurrent/models/mbari%20tethys%20lrauv
https://fuel.gazebosim.org/1.0/adlarkin/models/construction%20cone%20label%20test
https://fuel.gazebosim.org/1.0/aknyunus0/models/shoe
https://fuel.gazebosim.org/1.0/aknyunus0/models/mens_asv_billfish_boat_shoe_in_tan_leather_wmuj5pbwanc
https://fuel.gazebosim.org/1.0/amangupta/models/start
https://fuel.gazebosim.org/1.0/amelhassan/models/backpack
https://fuel.gazebosim.org/1.0/amrelsersy/models/house%203
https://fuel.gazebosim.org/1.0/amrelsersy/models/coro_mike_sensor_config_2
https://fuel.gazebosim.org/1.0/andreamcr/models/stecca%20centrale
https://fuel.gazebosim.org/anonymous/test_model_595389531
https://fuel.gazebosim.org/anonymous/test_model_122023392
https://fuel.gazebosim.org/anonymous/test_model_429486665
https://fuel.gazebosim.org/anonymous/test_model_887243621
https://fuel.gazebosim.org/anonymous/test_model_084900530
https://fuel.gazebosim.org/anonymous/test_model_240061059
https://fuel.gazebosim.org/anonymous/test_model_464734097
https://fuel.gazebosim.org/anonymous/test_model_658598990
https://fuel.gazebosim.org/anonymous/test_model_834617935
https://fuel.gazebosim.org/anonymous/test_model_380348669
```

**Download a model**
Expand Down Expand Up @@ -90,7 +90,7 @@ See issues beginning with [Fuel backend] in the title. Here are two examples.
**TODO: Find a model on disk**
```
$ gz fuel locate --name am1
/home/developer/.ignition/fuel/fuel.ignitionrobotics.org/alice/am1
/home/developer/.ignition/fuel/fuel.gazebosim.org/alice/am1
```

## Dependencies
Expand Down
2 changes: 1 addition & 1 deletion conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
servers:
-
name: osrf
url: https://fuel.ignitionrobotics.org
url: https://fuel.gazebosim.org

# -
# name: another_server
Expand Down
2 changes: 1 addition & 1 deletion example/download.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char **argv)
usage += " Usage:\n ./download <options>\n\n";
usage += " Examples:\n"
"\t ./download -t model -o OpenRobotics -n Beer\n"
"\t ./download -s https://fuel.ignitionrobotics.org -t world "
"\t ./download -s https://fuel.gazebosim.org -t world "
"-o OpenRobotics"
" -n Empty\n"
"\t ./download -c /tmp/my_config.yaml -t model -o caguero -n Beer\n";
Expand Down
14 changes: 7 additions & 7 deletions include/gz/fuel_tools/FuelClient.hh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace gz

/// \brief Remove a resource, such as a model or world, from Gazebo Fuel
/// \param[in] _uri The full URI of the resource, e.g:
/// https://fuel.ignitionrobotics.org/1.0/openrobotcs/model/my_model
/// https://fuel.gazebosim.org/1.0/openrobotcs/model/my_model
/// \param[in] _headers Headers to set on the HTTP request.
/// \return Result of the delete operation
public: Result DeleteUrl(const gz::common::URI &_uri,
Expand Down Expand Up @@ -257,7 +257,7 @@ namespace gz
/// \brief Download a model from Gazebo Fuel. This will override an
/// existing local copy of the model.
/// \param[in] _modelUrl The unique URL of the model to download.
/// E.g.: https://fuel.ignitionrobotics.org/1.0/caguero/models/Beer
/// E.g.: https://fuel.gazebosim.org/1.0/caguero/models/Beer
/// \param[out] _path Path where the model was downloaded.
/// \return Result of the download operation.
public: Result DownloadModel(const common::URI &_modelUrl,
Expand All @@ -266,7 +266,7 @@ namespace gz
/// \brief Download a world from Gazebo Fuel. This will override an
/// existing local copy of the world.
/// \param[in] _worldUrl The unique URL of the world to download.
/// E.g.: https://fuel.ignitionrobotics.org/1.0/OpenRobotics/worlds/Empty
/// E.g.: https://fuel.gazebosim.org/1.0/OpenRobotics/worlds/Empty
/// \param[out] _path Path where the world was downloaded.
/// \return Result of the download operation.
public: Result DownloadWorld(const common::URI &_worldUrl,
Expand Down Expand Up @@ -296,29 +296,29 @@ namespace gz

/// \brief Check if a model is already present in the local cache.
/// \param[in] _modelUrl The unique URL of the model on a Fuel server.
/// E.g.: https://fuel.ignitionrobotics.org/1.0/caguero/models/Beer
/// E.g.: https://fuel.gazebosim.org/1.0/caguero/models/Beer
/// \param[out] _path Local path where the model can be found.
/// \return FETCH_ERROR if not cached, FETCH_ALREADY_EXISTS if cached.
public: Result CachedModel(const common::URI &_modelUrl,
std::string &_path);

/// \brief Check if a model exists in the cache.
/// \param[in] _modelUrl The unique URL of the world on a Fuel server.
/// E.g.: https://fuel.ignitionrobotics.org/1.0/caguero/models/Beer
/// E.g.: https://fuel.gazebosim.org/1.0/caguero/models/Beer
/// \return True if the model exists in the cache, false otherwise.
public: bool CachedModel(const common::URI &_modelUrl);

/// \brief Check if a world is already present in the local cache.
/// \param[in] _worldUrl The unique URL of the world on a Fuel server.
/// E.g.: https://fuel.ignitionrobotics.org/1.0/OpenRobotics/worlds/Empty
/// E.g.: https://fuel.gazebosim.org/1.0/OpenRobotics/worlds/Empty
/// \param[out] _path Local path where the world can be found.
/// \return FETCH_ERROR if not cached, FETCH_ALREADY_EXISTS if cached.
public: Result CachedWorld(const common::URI &_worldUrl,
std::string &_path);

/// \brief Check if a world exists in the cache.
/// \param[in] _worldUrl The unique URL of the world on a Fuel server.
/// E.g.: https://fuel.ignitionrobotics.org/1.0/OpenRobotics/worlds/Empty
/// E.g.: https://fuel.gazebosim.org/1.0/OpenRobotics/worlds/Empty
/// \return True if the world exists in the cache, false otherwise.
public: bool CachedWorld(const common::URI &_worldUrl);

Expand Down
7 changes: 7 additions & 0 deletions src/ClientConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ class gz::fuel_tools::ClientConfigPrivate
homePath, ".gz", "fuel");

this->servers.push_back(ServerConfig());
// Add in fuel.ignitionrobotics.org as another default server
// config.
ServerConfig ignServerConfig;
ignServerConfig.SetUrl(
common::URI("https://fuel.ignitionrobotics.org"));
ignServerConfig.SetVersion("1.0");
this->servers.push_back(ignServerConfig);
}

/// \brief Clear values.
Expand Down
14 changes: 9 additions & 5 deletions src/ClientConfig_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ std::string cachePath()
TEST(ClientConfig, InitiallyDefaultServers)
{
ClientConfig config;
EXPECT_EQ(1u, config.Servers().size());
EXPECT_EQ(2u, config.Servers().size());
}

/////////////////////////////////////////////////
Expand All @@ -88,7 +88,7 @@ TEST(ClientConfig, ServersCanBeAdded)
srv.SetUrl(common::URI("http://asdf"));
config.AddServer(srv);

ASSERT_EQ(2u, config.Servers().size());
ASSERT_EQ(3u, config.Servers().size());
EXPECT_EQ(std::string("http://asdf"), config.Servers().back().Url().Str());
}

Expand All @@ -97,9 +97,11 @@ TEST(ClientConfig, ServersCanBeAdded)
TEST(ClientConfig, CustomDefaultConfiguration)
{
ClientConfig config;
ASSERT_EQ(1u, config.Servers().size());
ASSERT_EQ(2u, config.Servers().size());
EXPECT_EQ("https://fuel.gazebosim.org",
config.Servers().front().Url().Str());
EXPECT_EQ("https://fuel.ignitionrobotics.org",
config.Servers()[1].Url().Str());

std::string defaultCacheLocation = gz::common::joinPaths(
homePath(), ".gz", "fuel");
Expand Down Expand Up @@ -134,11 +136,13 @@ TEST(ClientConfig, CustomConfiguration)

EXPECT_TRUE(config.LoadConfig(testPath));

ASSERT_EQ(3u, config.Servers().size());
ASSERT_EQ(4u, config.Servers().size());
EXPECT_EQ("https://fuel.gazebosim.org",
config.Servers().front().Url().Str());
EXPECT_EQ("https://api.gazebosim.org",
EXPECT_EQ("https://fuel.ignitionrobotics.org",
config.Servers()[1].Url().Str());
EXPECT_EQ("https://api.gazebosim.org",
config.Servers()[2].Url().Str());
EXPECT_EQ("https://myserver",
config.Servers().back().Url().Str());

Expand Down
32 changes: 29 additions & 3 deletions src/FuelClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ using namespace fuel_tools;
class gz::fuel_tools::FuelClientPrivate
{
/// \brief A model URL,
/// E.g.: https://fuel.ignitionrobotics.org/1.0/caguero/models/Beer/2
/// E.g.: https://fuel.gazebosim.org/1.0/caguero/models/Beer/2
/// Where the API version and the model version are optional.
public: const std::string kModelUrlRegexStr{
// Method
Expand All @@ -80,7 +80,7 @@ class gz::fuel_tools::FuelClientPrivate
"/?"};

/// \brief A world URL,
/// E.g.: https://fuel.ignitionrobotics.org/1.0/OpenRobotics/worlds/Empty/1
/// E.g.: https://fuel.gazebosim.org/1.0/OpenRobotics/worlds/Empty/1
/// Where the API version and the world version are optional.
public: const std::string kWorldUrlRegexStr{
// Method
Expand Down Expand Up @@ -152,7 +152,7 @@ class gz::fuel_tools::FuelClientPrivate

/// \brief A collection URL,
/// E.g.:
/// https://fuel.ignitionrobotics.org/1.0/OpenRobotics/collections/TestColl
/// https://fuel.gazebosim.org/1.0/OpenRobotics/collections/TestColl
/// Where the API version is optional
public: const std::string kCollectionUrlRegexStr{
// Method
Expand Down Expand Up @@ -199,6 +199,12 @@ class gz::fuel_tools::FuelClientPrivate
/// license information.
public: void PopulateLicenses(const ServerConfig &_server);

/// \brief Checks the provided URI for fuel.gazebosim.org, and
/// prints a deprecation warning message if found.
/// \param[in] _uri URI to check
/// DEPRECATED/DEPRECATION: remove this function in Gazebo H.
public: void CheckForDeprecatedUri(const common::URI &_uri);

/// \brief Client configuration
public: ClientConfig config;

Expand Down Expand Up @@ -538,7 +544,9 @@ void FuelClient::AddServerConfigParametersToHeaders(
Result FuelClient::DeleteUrl(const gz::common::URI &_uri,
const std::vector<std::string> &_headers)
{
this->dataPtr->CheckForDeprecatedUri(_uri);
gz::fuel_tools::Rest rest;

RestResponse resp;

std::string server;
Expand Down Expand Up @@ -640,6 +648,7 @@ Result FuelClient::DownloadModel(const ModelIdentifier &_id,
<< std::endl << _id.Server().AsString() << std::endl;
return Result(ResultType::FETCH_ERROR);
}
this->dataPtr->CheckForDeprecatedUri(_id.Server().Url());

// Route
common::URIPath route;
Expand Down Expand Up @@ -809,6 +818,8 @@ Result FuelClient::DownloadWorld(WorldIdentifier &_id,
return Result(ResultType::FETCH_ERROR);
}

this->dataPtr->CheckForDeprecatedUri(_id.Server().Url());

// Route
common::URIPath route;
route = route / _id.Owner() / "worlds" / _id.Name() / _id.VersionStr() /
Expand Down Expand Up @@ -1174,6 +1185,8 @@ bool FuelClient::ParseModelFileUrl(const common::URI &_fileUrl,
if (!_fileUrl.Valid())
return false;

this->dataPtr->CheckForDeprecatedUri(_fileUrl);

auto urlStr = _fileUrl.Str();

std::smatch match;
Expand Down Expand Up @@ -1901,3 +1914,16 @@ bool FuelClient::UpdateWorlds(const std::vector<std::string> &_headers)
}
return true;
}
//////////////////////////////////////////////////
void FuelClientPrivate::CheckForDeprecatedUri(const common::URI &_uri)
{
static std::string oldServer = "fuel.ignitionrobotics.org";
auto ignFuelPos = _uri.Str().find(oldServer);
if (ignFuelPos != std::string::npos)
{
std::string newUrl = _uri.Str();
newUrl.replace(ignFuelPos, oldServer.size(), "fuel.gazebosim.org");
ignwarn << "The " << oldServer << " URL is deprecrated. Pleasse change "
<< _uri.Str() << " to " << newUrl << std::endl;
}
}
Loading

0 comments on commit 68709b0

Please sign in to comment.