feat: log added packages

concurrent-repos
Jef Roosens 2024-05-29 10:02:38 +02:00
parent 60d4478d83
commit fc844c685f
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 12 additions and 10 deletions

View File

@ -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

View File

@ -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))
}
}

View File

@ -69,19 +69,17 @@ async fn post_package_archive(
Path(repo): Path<String>,
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(