~jan0sch/smederee
Showing details for patch f915b8874c2ba49e48b06e17d379b0c830f7e470.
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-01-12 22:01:36.969734088 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-01-12 22:01:36.969734088 +0000 @@ -215,13 +215,15 @@ repositoryName: String, targetDirectory: os.Path ): F[(Int, Chain[String], Chain[String])] = { - val targetFile = targetDirectory / s"${repositoryName}.tar.gz" - val tempTargetFile = Files.createTempFile(targetDirectory.toNIO, "download", s"${repositoryName}.tar.gz") - log.debug(s"Packaging repository $repositoryName into $targetFile.") - val tarOptions = List("-czf", tempTargetFile.toString, "--exclude=_darcs", repositoryName.toString) - val externalCommand = os.proc("tar", tarOptions) + val targetFile = targetDirectory / s"${repositoryName}.tar.gz" for { - _ <- Sync[F].delay(Files.createDirectories(targetDirectory.toNIO)) + _ <- Sync[F].delay(Files.createDirectories(targetDirectory.toNIO)) + tempTargetFile <- Sync[F].delay( + Files.createTempFile(targetDirectory.toNIO, "download", s"${repositoryName}.tar.gz") + ) + _ <- Sync[F].delay(log.debug(s"Packaging repository $repositoryName into $targetFile.")) + tarOptions = List("-czf", tempTargetFile.toString, "--exclude=_darcs", repositoryName.toString) + externalCommand = os.proc("tar", tarOptions) process <- Sync[F].delay(externalCommand.call(cwd = basePath, check = false)) _ <- Sync[F].delay(os.remove(targetFile)) _ <- Sync[F].delay(os.move(os.Path(tempTargetFile), targetFile))