SCIENTIFIC-LINUX-USERS Archives

July 2014

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Elias Persson <[log in to unmask]>
Reply To:
Elias Persson <[log in to unmask]>
Date:
Tue, 1 Jul 2014 16:17:01 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (60 lines)
On 2014-07-01 15:46, Lamar Owen wrote:
> On 06/30/2014 07:34 PM, Nico Kadel-Garcia wrote:
>> Given that "there can be only one" Fedora, I wouldn't expect the same
>> kind of effort to build migration tools. But it's *amazing* what you
>> can do by simply doing"
>>
>>      rm -rf /tmp/failed /tmp/success
>>      mkdir /tmp/failed /tmp/success
>>      RPMLIST=`rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}'`
>>      for name in $RPMLIST; do
>>          yum reinstall $name -y 2>/tmp/failed/$name >/tmp/success/$name
>>      done
>>
>> It's amazing how 3 or four years of sophisticated python development
>> can be replaced by a few lines of shell script, and get better error
>> reporting.
>>
>
> It's even more amazing what you can get with a single line:
> rpm -qa --qf '%{NAME}.%{ARCH}'|xargs -n 1 yum -y reinstall
>
> (the currently installed version and release may not be in the new repo
> you're going to; if those are critical, add them back to the
> --queryformat line).  In looking back at my 'switchover' from SLC 5.4
> IA64 to my CentOS 5.5 rebuild on same, this is the command line I used
> (and since I embedded some strings in the release, and since I was doing
> an update at the same time, I specifically left out %{VERSION} and
> %{RELEASE}).
>
> However, both of our approaches have at least two flaws.
>
> 1.) If we're wanting to switch from CentOS to SL, but have a lot of
> third-party repos enabled, we probably don't want to reinstall all of
> those packages;
> 2.) If we have locally installed non-repo packages those will not
> reinstall (Oracle's JRE, for instance, or GoogleEarth).
>
> It takes a bit more thought to deal with those cases; you can start with
> 'yum list installed' and parse from there.  The 'yum list extras'
> command will give you a list of packages that aren't in any current repo
> (on my system I have GoogleEarth, the Oracle JRE, the rebuilt from
> ELrepo kmod-wl nosrc.rpm, and a couple of other hand built or
> sidechannel installed packages (I have nbtscan, for instance, from
> repoforge but I don't have repoforge as a whole installed; I also have
> normalize from Fedora 11 installed (works fine, too)).

`repoquery --installed --all --qf '%{ui_from_repo} %{nvra}'` piped
through text filter of choice (grep + cut should do) should get you a
restricted package list.

You'll probably want to do
    repoquery --installed --all --qf '%{ui_from_repo}' | sort -u
first, to figure out what your filter should look like.

Probably not available in EL5 (`yum info` doesn't provide that info,
at least), but it's there in EL6.

Oh, and unless I'm mistaken, both of you are missing whitespace of
some kind in your `--qf`s. (repoquery adds a newline on its own.)

ATOM RSS1 RSS2