diff --git a/server/src/db/query/package.rs b/server/src/db/query/package.rs index 8a211bf..6cd709f 100644 --- a/server/src/db/query/package.rs +++ b/server/src/db/query/package.rs @@ -133,7 +133,7 @@ pub async fn insert(conn: &DbConn, repo_id: i32, pkg: crate::repo::package::Pack .chain( info.makedepends .iter() - .map(|s| (PackageRelatedEnum::Depend, s)), + .map(|s| (PackageRelatedEnum::Makedepend, s)), ) .chain( info.checkdepends diff --git a/server/src/repo/manager_new.rs b/server/src/repo/manager_new.rs index 5ac4e13..adf37a9 100644 --- a/server/src/repo/manager_new.rs +++ b/server/src/repo/manager_new.rs @@ -219,7 +219,7 @@ impl MetaRepoMgr { conn: &DbConn, reader: &mut R, repo: &str, - ) -> crate::Result<()> { + ) -> crate::Result<(String, String, String)> { // Copy file contents to temporary path so libarchive can work with it let uuid: uuid::fmt::Simple = Uuid::new_v4().into(); let path = self.repo_dir.join(uuid.to_string()); @@ -262,6 +262,8 @@ impl MetaRepoMgr { let dest_pkg_path = self.repo_dir.join(repo).join(pkg.file_name()); // Insert new package into database + let name = pkg.info.name.clone(); + let version = pkg.info.version.clone(); let arch = pkg.info.arch.clone(); db::query::package::insert(conn, repo_id, pkg).await?; @@ -271,9 +273,11 @@ impl MetaRepoMgr { // Synchronize archive databases if arch == ANY_ARCH { - self.generate_archives_all(conn, repo).await + self.generate_archives_all(conn, repo).await?; } else { - self.generate_archives(conn, repo, &arch).await + self.generate_archives(conn, repo, &arch).await?; } + + Ok((name, version, arch)) } } diff --git a/server/src/repo/mod.rs b/server/src/repo/mod.rs index fb00804..f5e48d4 100644 --- a/server/src/repo/mod.rs +++ b/server/src/repo/mod.rs @@ -69,19 +69,17 @@ async fn post_package_archive( Path(repo): Path, body: Body, ) -> crate::Result<()> { - let body = body.into_data_stream(); - let body = body.map_err(std::io::Error::other); - let mut body = StreamReader::new(body); - global + let mut body = StreamReader::new(body.into_data_stream().map_err(std::io::Error::other)); + let (name, version, arch) = global .repo_manager .write() .await .add_pkg_from_reader(&global.db, &mut body, &repo) .await?; - Ok(()) + tracing::info!("Added '{}-{}' to repository '{}' ({})", name, version, repo, arch); - //tracing::info!("Added '{}' to repository '{}'", pkg.file_name(), repo); + Ok(()) } async fn delete_repo(