Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions rust/agama-software/src/zypp_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,19 @@ impl ZyppServer {
break;
};

if let Err(error) = self.dispatch(action, &zypp) {
tracing::error!("Software dispatch error: {:?}", error);
}
match self.dispatch(action, &zypp) {
Ok(false) => {
break;
}
Err(error) => {
tracing::error!("Software dispatch error: {:?}", error);
}
_ => {}
};
}

// drop explicitly zypp to release lock ASAP
drop(zypp);
Ok(())
}

Expand All @@ -213,7 +221,7 @@ impl ZyppServer {
&mut self,
action: SoftwareAction,
zypp: &zypp_agama::Zypp,
) -> Result<(), ZyppDispatchError> {
) -> Result<bool, ZyppDispatchError> {
match action {
SoftwareAction::Write {
state,
Expand Down Expand Up @@ -242,12 +250,13 @@ impl ZyppServer {
}
SoftwareAction::Finish(tx) => {
self.finish(zypp, tx)?;
return Ok(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to stop the server, right? I would add a comment.

}
SoftwareAction::GetProposal(product_spec, sender) => {
self.proposal(product_spec, sender, zypp)?
}
}
Ok(())
Ok(true)
}

// Install rpms
Expand Down
2 changes: 1 addition & 1 deletion rust/zypp-agama/zypp-agama-sys/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ unsafe extern "C" {
) -> bool;
#[doc = " Runs solver\n @param zypp see \\ref init_target\n @param only_required if true, only required packages are installed (ignoring\n recommended packages)\n @param[out] status (will overwrite existing contents)\n @return true if solver pass and false if it found some dependency issues"]
pub fn run_solver(zypp: *mut Zypp, only_required: bool, status: *mut Status) -> bool;
#[doc = " Create a solver testcase, dumps all solver data (repositories, loaded\n packages...) to disk\n @param zypp see \\ref init_target\n @param dir directory path where the solver testcase is saved\n @return true if the solver testcase was successfully created"]
#[doc = " Create a solver testcase, dumps all all solver data (repositories, loaded\n packages...) to disk\n @param zypp see \\ref init_target\n @param dir directory path where the solver testcase is saved\n @return true if the solver testcase was successfully created"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you add a redundant "all" here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, this is autogenerated. I need to check why it is there twice.

pub fn create_solver_testcase(zypp: *mut Zypp, dir: *const ::std::os::raw::c_char) -> bool;
#[doc = " the last call that will free all pointers to zypp holded by agama"]
pub fn free_zypp(zypp: *mut Zypp);
Expand Down
Loading