Skip to content

Commit

Permalink
chore: use String.format.
Browse files Browse the repository at this point in the history
  • Loading branch information
vpa1977 committed Oct 8, 2024
1 parent bd8e30f commit 1b23bce
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@ private Map<String,Object> getImageProjectParts(List<String> images) {
HashMap<String, Object> parts = new HashMap<String, Object>();
int id = 0;
for (String image : images) {
parts.put(settings.getGeneratorName() + "/rockcraft/dump"+id, getImageDumpPart(image));
parts.put(String.format("%s/rockcraft/dump%d",settings.getGeneratorName(), id), getImageDumpPart(image));
++id;
}
parts.put(settings.getGeneratorName() + "/rockcraft/deps", getDepsPart());
parts.put(String.format("%s/rockcraft/deps", settings.getGeneratorName()) , getDepsPart());
return parts;
}

private Map<String,Object> getImageDumpPart(String image) {
Map<String,Object> part = new HashMap<String, Object>();
part.put("source", ".");
part.put("plugin", "nil");
part.put("override-build", "cp --archive --link --no-dereference " + image + " /");
part.put("override-build", String.format("cp --archive --link --no-dereference %s /", image));
return part;
}

Expand All @@ -164,7 +164,7 @@ public boolean accept(File file, String name) {
Map<String, Object> serviceDefinition = new HashMap<String, Object>();
serviceDefinition.put("override", "replace");
serviceDefinition.put("summary", serviceName);
serviceDefinition.put("command", "/" + relativeImage + "/bin/" + serviceName);
serviceDefinition.put("command", String.format("/%s/bin/%s", relativeImage, serviceName));
services.put(serviceName, serviceDefinition);
}
}
Expand Down

0 comments on commit 1b23bce

Please sign in to comment.