Skip to content

Commit 3ec888c

Browse files
committed
Remove hash path from local project variables.
1 parent 31bbc6f commit 3ec888c

5 files changed

Lines changed: 24 additions & 14 deletions

File tree

src/common/constants.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ constexpr auto operator "" _GB(unsigned long long int i)
3636
return i * 1024_MB;
3737
}
3838

39-
constexpr auto operator "" _PB(unsigned long long int i)
39+
constexpr auto operator "" _TB(unsigned long long int i)
4040
{
4141
return i * 1024_GB;
4242
}
4343

44+
constexpr auto operator "" _PB(unsigned long long int i)
45+
{
46+
return i * 1024_TB;
47+
}

src/common/http.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616

1717
#pragma once
1818

19-
#include <openssl/evp.h>
20-
2119
#include "cppan_string.h"
2220
#include "constants.h"
2321
#include "filesystem.h"
24-
#include "property_tree.h"
2522

2623
struct ProxySettings
2724
{

src/common/package.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,16 @@ void Package::createNames()
9797

9898
target_name = ppath.toString() + (v == "*" ? "" : ("-" + v));
9999

100-
variable_name = ppath.toString() + (v == "*" ? "" : ("_" + v));
100+
// for local projects we use simplified variable name without
101+
// the second dir hash argument
102+
auto vname = ppath.toString();
103+
if (ppath.is_loc())
104+
vname = ppath[PathElementType::Namespace] / ppath[PathElementType::Tail];
105+
106+
variable_name = vname + (v == "*" ? "" : ("_" + v));
101107
std::replace(variable_name.begin(), variable_name.end(), '.', '_');
102108

103-
variable_no_version_name = ppath.toString();
109+
variable_no_version_name = vname;
104110
std::replace(variable_no_version_name.begin(), variable_no_version_name.end(), '.', '_');
105111

106112
target_name_hash = getHashShort();

src/common/project_path.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,17 @@ bool ProjectPath::is_relative(const String &username) const
149149

150150
ProjectPath ProjectPath::operator[](PathElementType e) const
151151
{
152+
if (path_elements.empty())
153+
return *this;
152154
switch (e)
153155
{
154156
case PathElementType::Namespace:
155-
if (path_elements.empty())
156-
return *this;
157-
return PathElements{ path_elements.begin(), path_elements.begin() + 1 };
157+
return path_elements[0];
158158
case PathElementType::Owner:
159-
if (path_elements.size() < 2)
160-
return *this;
161-
return PathElements{ path_elements.begin() + 1, path_elements.begin() + 2 };
159+
return get_owner();
162160
case PathElementType::Tail:
163-
if (path_elements.size() >= 2)
164-
return *this;
161+
if (path_elements.size() < 2)
162+
return ProjectPath();
165163
return PathElements{ path_elements.begin() + 2, path_elements.end() };
166164
}
167165
return *this;

src/common/project_path.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ class ProjectPath
127127

128128
bool operator<(const ProjectPath &rhs) const;
129129

130+
operator String() const
131+
{
132+
return toString();
133+
}
134+
130135
ROOT_PROJECT_PATH(com);
131136
ROOT_PROJECT_PATH(loc);
132137
ROOT_PROJECT_PATH(org);

0 commit comments

Comments
 (0)