maximbaz / rebuild-detector

Detects which Arch Linux packages need to be rebuilt
ISC License
214 stars 11 forks source link

Output doesn't play nicely with other commands #26

Closed Fabian42 closed 1 year ago

Fabian42 commented 1 year ago

I've tried to debug this for a while now, but I can't quite figure out when this happens. At least most of the time, something like this reproduces the issue:

checkrebuild | sed "s/foreign //"

The output is still e.g. "foreign insync".

BTW, why this word "foreign" anyway? What's so foreign about it and why should I see that in every single line? It makes feeding the output into e.g. yay -S needlessly complicated.

maximbaz commented 1 year ago

Hey, I believe those are tab separated, try checkrebuild | cut -f2.

Every line in the output prints the repository, where this package is located, followed by the package name.

When the package is not coming from a repository, but is built using tools like yay, pacman calls those packages "foreign".

It's preserved so that the output format is predictable, if you have one package broken in "myrepo" and another one built by yay (aka foreign), to be able to consistently do | cut -f2 the foreign is printed in place of the repo name.

Hope that clarifies things?

Fabian42 commented 1 year ago

Oh, it's actually a tab!

[fabian@laptop ~]$ tabs 20     
[fabian@laptop ~]$ checkrebuild                                                                                                                                                                                                            
foreign             insync

But because 99.9% of my packages are installed via yay, it always appears as exactly 1 space, even when copied out into another program!

checkrebuild | sed "s/foreign\\t//" (or for theoretically better accuracy, checkrebuild | sed "s/[^\\t]+\\t//") works. Thanks!