Skip to content

Extract poll and finish methods of install progress - #270

Merged
mvo5 merged 3 commits into
mvo5:masterfrom
andy128k:poll-progress
Aug 1, 2026
Merged

Extract poll and finish methods of install progress#270
mvo5 merged 3 commits into
mvo5:masterfrom
andy128k:poll-progress

Conversation

@andy128k

Copy link
Copy Markdown
Contributor

This PR:

  • extracts poll method so polling could be done externally (and interspersed with other UI updates if needed).
  • adds finish method and use polymorphism instead of preprocessor.
  • removes goto by using std::unique_ptr.

Comment thread common/rinstallprogress.cc Outdated
{
int ret;
if (waitpid(_child_id, &ret, WNOHANG) == 0) {
return pkgPackageManager::OrderResult::Incomplete;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

So pkgPackageManager::OrderResult::Incomplete traditionally means that a media-swap (cdrom) is required. Those are of course nowdays extremly rare and maybe we should drop that but AIUI this change would break this support. I tink its fine to just make it bool RInstallProgress::poll()

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, does it really matter why the process is "incomplete"? I mean it could be waiting for a next CD/DVD or a next batch downloaded from internet. In both cases reaction is the same -- continue polling.

OTOH If you think that these two states should be separate, then both start and poll methods should be changed to return something else (e.g. std::optional<OrderResult>).


This PR alone will not help to achieve a separation of installation process and UI. Unfortunately the interface of pkgAcquire is synchronous. I am afraid the best option would be to move the whole process into an own thread and communicate with UI via channels.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

So the issue is that on a real media-swap event the exit code is the same (incomplete) and the UI would assume it is finished and keep polling. But incomplete from the package manager is an end-state, i.e. the loop needs to exit and the dialog with "please insert next disk" needs to come up. its all a bit academic of course as there are no cdrom based distros anymore :)

But I love your suggestions about std::optional - updated the code and pushed here (hope that is okay) and once green will mrege, the refactor itself is very nice.

@mvo5

mvo5 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Thanks! There is lots to like here, this is some very old (and inelegant) code so a cleanup/refactor is appreciated (but see my inline comment)

@mvo5
mvo5 merged commit 26ab2db into mvo5:master Aug 1, 2026
2 checks passed
@andy128k
andy128k deleted the poll-progress branch August 2, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants