A useful one-liner for Tumbleweed

For 4 or 5 months, pulseeffects and lsp-plugins were out of sync, so I had to run pulseeffects as a flatpak. Once the TW packages were compatible again, I locked them so I could verify compatibility before updating them. After running “sudo zypper info lsp-plugins-common lv2-lsp-plugins pulseeffects” every time there was an update, I decided to write this one liner and put it in my ~/.bashrc. Now, I just type “zypp-locks” and I see the update status of all locked packages.


alias zypp-locks='sudo zypper info $(sudo zypper se -f -i $(sudo zypper locks | grep "^[0-9]" | cut -d "|" -f 2) | grep "^il" | cut -d "|" -f 2) | grep "^Name\|^Status" | sed -n -e "N;s/.*:\(^
]*\)
^:]*/\1/;p"'

The inner-most command does this:


> sudo zypper locks | grep "^[0-9]" | cut -d "|" -f 2
 *lsp-plugins*  
 *pulseeffects*

The next outer command does this, after substituting the results of the inner-most command:


> sudo zypper se -f -i *lsp-plugins* *pulseeffects* | grep "^il" | cut -d "|" -f 2
 lsp-plugins-common
 lv2-lsp-plugins    
 pulseeffects

And finally, after substituting the above output, the outer most zypper command does:


> sudo zypper info lsp-plugins-common lv2-lsp-plugins pulseeffects | grep "^Name\|^Status" | sed -n -e "N;s/.*:\(^
]*\)
^:]*/\1/;p"
 lsp-plugins-common: up-to-date
 lv2-lsp-plugins: up-to-date
 pulseeffects: up-to-date

The sed command joins the two lines together, strips out everything up to and including the first :, saves the next field, then strips out the next field up to, but not including the second :. Finally, the p prints out the package name and update status.

At the moment, only three packages are listed, but additional locked packages will be listed after they are locked.

Gene

Cool.
If you find yourself coming up with things like this,
Recommend you create a Wiki as a personal (and public) reference).

You can create your won Wiki for free (see my signature)

TSU

Thanks! I’m reading your wiki now. And here’s the example I left out of my original post.


> zypp-locks
 lsp-plugins-common: up-to-date
 lv2-lsp-plugins: up-to-date
 pulseeffects: up-to-date

Gene

Is there a way to edit old posts? I noticed I left a bit of residual code in my one liner, but I don’t see any options to change it. Here’s an updated version:


alias zypp-locks='sudo zypper info $(sudo zypper se -f -i $(sudo zypper locks | grep "^[0-9]" | cut -d "|" -f 2) | grep "^il" | cut -d "|" -f 2) | grep "^Name\|^Status" | sed -e "N;s/.*:\(^
]*\)
^:]*/\1/"'

There was no reason to use -n and the p command in the last sed statement. That was left over from earlier versions. :wink:

Gene