Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix APT output in docker #5

Closed
Enchufa2 opened this issue Jul 9, 2020 · 6 comments
Closed

Fix APT output in docker #5

Enchufa2 opened this issue Jul 9, 2020 · 6 comments

Comments

@Enchufa2
Copy link
Member

Enchufa2 commented Jul 9, 2020

For some reason, the line width is not calculated correctly and the output is messed up.

@Enchufa2
Copy link
Member Author

Not sure why, but this is what happens in an R session inside docker:

> bspm::install_sys("units")
Install system packages as root...
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading package lists... Done    
Building dependency tree          
Reading state information... Done
Get:1 http://deb.debian.org/debian testing/main amd64 r-cran-units amd64 0.6-6-1+b1 [744 kB]                                            
Fetched 744 kB in 0s (0 B/s)                                                                                                            
Running dpkg ...
                Selecting previously unselected package r-cran-units.
(Reading database ... 53485 files and directories currently installed.)
Preparing to unpack .../r-cran-units_0.6-6-1+b1_amd64.deb ...
Preparing r-cran-units (amd64) ...
                                  Unpacking r-cran-units (0.6-6-1+b1) ...
Unpacking r-cran-units (amd64) ...
                                  Installing r-cran-units (amd64) ...
                                                                     Running dpkg ...
                                                                                     Setting up r-cran-units (0.6-6-1+b1) ...
Preparing to configure r-cran-units (amd64) ...
                                               Configuring r-cran-units (amd64) ...
                                                                                   Installed r-cran-units (amd64) ...
                                                                                                                     >

@eddelbuettel
Copy link
Contributor

If you replace the status_change function you add at the top of apt.py then it looks better.

I also added "/dev/null" as argument to OpProgress() and AcquireProgress() but that may make it "too quiet". But you probably want to change TextInstallProgress.

@Enchufa2
Copy link
Member Author

This is the output piped into a file:

Install system packages as root...
Selecting previously unselected package r-cran-rcpp.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 22468 files and directories currently installed.)
Preparing to unpack .../r-cran-rcpp_1.0.4.6-1+b1_amd64.deb ...
Unpacking r-cran-rcpp (1.0.4.6-1+b1) ...
Setting up r-cran-rcpp (1.0.4.6-1+b1) ...
^MGet:1 http://deb.debian.org/debian testing/main amd64 r-cran-rcpp amd64 1.0.4.6-1+b1 [1951 kB]
^MFetched 1951 kB in 0s (0 B/s)                                                   
Running dpkg ...
Preparing r-cran-rcpp (amd64) ...
Unpacking r-cran-rcpp (amd64) ...
Installing r-cran-rcpp (amd64) ...
Running dpkg ...
Preparing to configure r-cran-rcpp (amd64) ...
Configuring r-cran-rcpp (amd64) ...
Installed r-cran-rcpp (amd64) ...

Why is apt using Windows newline characters?? This is what is messing the output, because you pipe that into sed 's/^M//g' and the output is ok.

@Enchufa2
Copy link
Member Author

Could you please test this last commit? I ended up using Windows terminators (i.e. \r\n) as end of line in TextInstallProgress too and it seems to fix the issue.

@eddelbuettel
Copy link
Contributor

Inserts extra newlines. You want just \r.

Which is ... the same as not setting the optional output manager so I would skip it, as I suggested to you before.

@Enchufa2
Copy link
Member Author

Damn, I don't know what I tested before, but I thought there was no output for the packages at all without the InstallProgress object, and that's not true. Ok, removing that in 3, 2, 1...

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

No branches or pull requests

2 participants