28 const std::string &manifest_path,
const std::string &repo_url,
29 const std::string &spooler_definition,
const std::string &
temp_dir,
30 const std::string &certificate,
const std::string &priv_key,
31 const std::string &repo_name,
const std::string &pwd,
32 const std::string &
meta_info,
const std::string &reflog_chksum_path,
33 const std::string &proxy,
34 const bool garbage_collectable,
const bool bootstrap_shortcuts,
35 const bool return_early,
const std::vector<shash::Any> reflog_catalogs) {
37 if (reflog_chksum_path !=
"") {
53 const bool follow_redirects =
false;
67 if (!manifest.IsValid()) {
74 if (reflog_chksum_path.empty()) {
75 reflog_hash = manifest->reflog_hash();
80 manifest->GetHashAlgorithm());
81 spooler = upload::Spooler::Construct(sd);
82 if (!spooler.IsValid()) {
88 if (!reflog_hash.
IsNull()) {
96 if (spooler->Peek(
".cvmfsreflog")) {
98 "no reflog hash specified but reflog is present");
106 upload::Spooler::CallbackPtr callback =
110 spooler->ProcessCertificate(certificate);
112 spooler->UnregisterListener(callback);
114 if (certificate_hash.
IsNull()) {
120 shash::Any metainfo_hash = manifest->meta_info();
121 if (!meta_info.empty()) {
122 upload::Spooler::CallbackPtr callback =
124 spooler->ProcessMetainfo(meta_info);
126 spooler->UnregisterListener(callback);
128 if (metainfo_hash.
IsNull()) {
138 if (!reflog->
AddCatalog(manifest->catalog_hash())) {
148 if (!manifest->history().IsNull()) {
149 if (!reflog->
AddHistory(manifest->history())) {
155 if (!metainfo_hash.
IsNull()) {
164 std::vector<shash::Any>::const_iterator i = reflog_catalogs.begin();
165 std::vector<shash::Any>::const_iterator iend = reflog_catalogs.end();
166 for (; i != iend; ++i) {
169 "Failed to add additional catalog %s to Reflog",
170 (*i).ToString().c_str());
181 spooler->UploadReflog(reflog_db_file);
182 spooler->WaitForUpload();
183 reflog_hash.
algorithm = manifest->GetHashAlgorithm();
185 unlink(reflog_db_file.c_str());
186 if (spooler->GetNumberOfErrors()) {
188 spooler->GetNumberOfErrors());
191 if (!reflog_chksum_path.empty())
202 manifest->set_certificate(certificate_hash);
203 manifest->set_repository_name(repo_name);
204 manifest->set_publish_timestamp(time(NULL));
205 manifest->set_garbage_collectability(garbage_collectable);
206 manifest->set_has_alt_catalog_path(bootstrap_shortcuts);
207 if (!metainfo_hash.
IsNull()) {
208 manifest->set_meta_info(metainfo_hash);
210 if (!reflog_hash.
IsNull()) {
211 manifest->set_reflog_hash(reflog_hash);
214 std::string signed_manifest = manifest->ExportString();
215 shash::Any published_hash(manifest->GetHashAlgorithm());
217 reinterpret_cast<const unsigned char *>(signed_manifest.data()),
218 signed_manifest.length(), &published_hash);
219 signed_manifest +=
"--\n" + published_hash.ToString() +
"\n";
222 if (manifest->has_alt_catalog_path()) {
224 spooler->PlaceBootstrappingShortcut(manifest->certificate()) &&
225 spooler->PlaceBootstrappingShortcut(manifest->catalog_hash()) &&
226 (manifest->history().IsNull() ||
227 spooler->PlaceBootstrappingShortcut(manifest->history())) &&
228 (metainfo_hash.
IsNull() ||
229 spooler->PlaceBootstrappingShortcut(metainfo_hash));
233 "failed to place VOMS bootstrapping "
243 reinterpret_cast<const unsigned char *>(published_hash.ToString().data()),
244 published_hash.GetHexSize(), &sig, &sig_size);
245 if (!manifest_was_signed) {
250 signed_manifest += std::string(reinterpret_cast<char *>(sig), sig_size);
259 spooler->UploadManifest(manifest_path);
260 spooler->WaitForUpload();
261 unlink(manifest_path.c_str());
262 if (spooler->GetNumberOfErrors()) {
264 spooler->GetNumberOfErrors());
278 "Failed to upload certificate "
int return_code
the return value of the spooler operation
std::string database_file() const
const manifest::Manifest * manifest() const
SharedPtr< string > temp_dir
bool AddHistory(const shash::Any &history)
HttpObjectFetcher ObjectFetcher
static bool ReadChecksum(const std::string &path, shash::Any *checksum)
bool SafeWriteToFile(const std::string &content, const std::string &path, int mode)
upload::Spooler * spooler
void Set(const T &object)
bool AddCatalog(const shash::Any &catalog)
bool AddMetainfo(const shash::Any &metainfo)
bool Sign(const unsigned char *buffer, const unsigned buffer_size, unsigned char **signature, unsigned *signature_size)
static void HashDatabase(const std::string &database_path, shash::Any *hash_reflog)
manifest::Reflog * reflog
void DropDatabaseFileOwnership()
bool DirectoryExists(const std::string &path)
bool AddCertificate(const shash::Any &certificate)
void HashMem(const unsigned char *buffer, const unsigned buffer_size, Any *any_digest)
std::string meta_info() const
static bool WriteChecksum(const std::string &path, const shash::Any &value)
static Manifest * LoadFile(const std::string &path)
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)