Hello, On Thu, 09 Apr 2015, Carlos E. R. wrote:
On 2015-04-09 09:32, David Haller wrote:
zypper pa -iN | tr -d '|' | \ awk -F' ' '$1 == "i" {printf("%s\t%s\t%s\n", $3, $2, $5); }'
(or start with a file for each repo, e.g. 'zypper pa -i -r Packman |...')
Or rather: let zypper write a file first and then work on that or those.
Interesting...
I tried:
cer@minas-tirith:~> zypper pa -iN -r Ext_Packman Repository 'Packman Repository' is out-of-date. You can run 'zypper refresh' as root to update it. Loading repository data... Reading installed packages... S | Repository | Name | Version | Arch - --+--------------------+--------------------------------------------+--------------------------------------+------- i | @System | AdobeICCProfiles | 2.0-150.1.6 | noarch [..] i | Packman Repository | audacious | 3.6-3.1 | x86_64
I suspect that the packages listed under @system are "orphaned" ... Have a look at e.g. what versions of AdobeICCProfiles you have available in your repos (e.g. in Yast in the version tab). At least, here, it works, with 'zypper pa -iN -r packman' I do not get any @system packages, just "packman' ones. How about checking about orphaned and if not, open a bug ...
Your line with awk produces interesting output:
AdobeICCProfiles openSUSE-13.1-Non-Oss noarch ConsoleKit openSUSE-13.1-1.10 x86_64 [...] Repository Packman 2.0.8-4.2 LibreOffice OBS: fh2epub LibreOffice OBS: fh2odg [..] It appears to be having problems with repository names with spaces:
Yeah, I chose spaces as field seperator, as using '|' gave those wide spacefilled fields. Just as a "stop-gap" measure, needing some "space-pruning" later, just use "|" as seperator. This looks good: head -20 /tmp/dh/zypper-pa.txt | \ awk -F'|' ' $1 ~ /^i/ { gsub(" ", "", $0); printf("%s\t%s\t%s\n", $3, $2, $5); }' (That'll waste your inner spaces in repos though, using head -20 /tmp/dh/zypper-pa.txt | \ awk -F'|' ' $1 ~ /^i/ { gsub(" ", "", $3); gsub("^ *", "", $2); gsub(" *$", "", $2); gsub(" ", "", $5); printf("%s\t%s\t%s\n", $3, $2, $5); }' should work though.
cer@minas-tirith:~> zypper lr # | Alias | Name | Enabled | Refresh - ---+----------------------------+------------------------------------+---------+-------- 1 | Ext_Packman | Packman Repository | Yes | Yes
I generally edit my /etc/zypp/repos.d/*.repo files to get sane repo names ;) Some (home) repos have _reeaaaaallly_ long "names" ... e.g. name=Printing System Development Project (openSUSE_12.1) The "actual" name (also in the OBS-URL is simply "Printing"), and I usually use just that repo-name part from the URL, possibly exchanging ':' with '_' or not ;)
The command is quite interesting, it can be refined to produce a list of packages related to repos.
Jep. Some tweaks might be required (and I'm not sure if the ARCH is even relevant).
Maybe for reinstall, or backup/restore, the best thing would be a file per repo, and a line per package. Then another concoction could be fed from that with zypper install to install the correct things from the right places, yes.
Yeah, command-line length might be a problem though, but installing "by repo" won't work anyway, I'd guess, so 'in --force' might be needed anyway, so you could do that for the repos and than do a complete 'zypper dup' to clean up or so ;) Or you could just sort and diff those 'zypper pa' files and do it manually :) HTH, -dnh -- BOFH excuse #438: sticky bit has come loose -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org