keeping a (maximally) clean active tree

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

keeping a (maximally) clean active tree

David Blank-Edelman
Hi-

Pardon me if this is an obvious question, but I'd like to know if  
there is an easy way (e.g. a script) to keep a maximally clean tree of  
active ports? I'd ideally like to have only the latest and greatest of  
every port I use installed on my machine. As new versions of ports  
(libraries in particular) get released, it seems like one starts to  
collect old versions of these ports because something else previously  
installed linked against that old version.

For example, right now my "ports outdated" says:

apr                            1.2.11_0 < 1.2.12_0
apr-util                       1.2.10_0 < 1.2.12_0
cairo                          1.4.10_0 < 1.4.12_0
freetype                       2.3.5_0 < 2.3.5_1
glib2                          2.14.3_0 < 2.14.4_1
gtk2                           2.12.1_0 < 2.12.3_0
sqlite3                        3.5.2_0 < 3.5.3_1

I'm familiar with the -u switch to ports, but just to continue this  
example, I can't say "port -u upgrade cairo" because it says:

--->  Unable to uninstall freetype 2.3.5_0, the following ports depend  
on it:
--->   fontconfig
--->   cairo
--->   Xft2
--->   gtk2
Error: Uninstall freetype 2.3.5_0 failed: Please uninstall the ports  
that depend on freetype first.
--->  Unable to uninstall cairo 1.4.10_0, the following ports depend  
on it:
--->   pango
--->   gtk2
Error: Uninstall cairo 1.4.10_0 failed: Please uninstall the ports  
that depend on cairo first.

As far as I know, the only way to keep only the latest version of  
cairo is to uninstall all of the stuff that depends on the past  
version(s) of cairo, upgrade cairo, and then rebuild/reinstall all of  
those ports. For certain ports there are enough steps in the chain  
(e.g. wireshark) that this becomes a bit of a hassle.

So my questions are:
    1) Am I missing some incantation with port that will chase these  
dependencies for me?
    2) If not, it seems like it should be possible to write a script  
that figures out the right uninstall/build/install dance in the  
shortest number of moves  to leave a ports tree with only the very  
latest things installed. Anybody have one?
    3) Another possibility would be to write something that kept a  
list of installed ports, blew away the current port installation, and  
installed that list again from scratch. This seems a bit heavy handed,  
but it would work.

Thanks for any help you can offer (and my sincere thanks to the people  
on the project plus the ports maintainers for all of the hard work  
that they do).

       -- dNb
_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

Corey Chandler
Am I missing something, or will "port upgrade outdated" solve this?  I
don't show old versions of upgraded ports...

-- Jay


David Blank-Edelman wrote:

> Hi-
>
> Pardon me if this is an obvious question, but I'd like to know if
> there is an easy way (e.g. a script) to keep a maximally clean tree of
> active ports? I'd ideally like to have only the latest and greatest of
> every port I use installed on my machine. As new versions of ports
> (libraries in particular) get released, it seems like one starts to
> collect old versions of these ports because something else previously
> installed linked against that old version.
>
> For example, right now my "ports outdated" says:
>
> apr                            1.2.11_0 < 1.2.12_0
> apr-util                       1.2.10_0 < 1.2.12_0
> cairo                          1.4.10_0 < 1.4.12_0
> freetype                       2.3.5_0 < 2.3.5_1
> glib2                          2.14.3_0 < 2.14.4_1
> gtk2                           2.12.1_0 < 2.12.3_0
> sqlite3                        3.5.2_0 < 3.5.3_1
>
> I'm familiar with the -u switch to ports, but just to continue this
> example, I can't say "port -u upgrade cairo" because it says:
>
> --->  Unable to uninstall freetype 2.3.5_0, the following ports depend
> on it:
> --->      fontconfig
> --->      cairo
> --->      Xft2
> --->      gtk2
> Error: Uninstall freetype 2.3.5_0 failed: Please uninstall the ports
> that depend on freetype first.
> --->  Unable to uninstall cairo 1.4.10_0, the following ports depend
> on it:
> --->      pango
> --->      gtk2
> Error: Uninstall cairo 1.4.10_0 failed: Please uninstall the ports
> that depend on cairo first.
>
> As far as I know, the only way to keep only the latest version of
> cairo is to uninstall all of the stuff that depends on the past
> version(s) of cairo, upgrade cairo, and then rebuild/reinstall all of
> those ports. For certain ports there are enough steps in the chain
> (e.g. wireshark) that this becomes a bit of a hassle.
>
> So my questions are:
>    1) Am I missing some incantation with port that will chase these
> dependencies for me?
>    2) If not, it seems like it should be possible to write a script
> that figures out the right uninstall/build/install dance in the
> shortest number of moves  to leave a ports tree with only the very
> latest things installed. Anybody have one?
>    3) Another possibility would be to write something that kept a list
> of installed ports, blew away the current port installation, and
> installed that list again from scratch. This seems a bit heavy handed,
> but it would work.
>
> Thanks for any help you can offer (and my sincere thanks to the people
> on the project plus the ports maintainers for all of the hard work
> that they do).
>
>       -- dNb
> _______________________________________________
> macports-users mailing list
> [hidden email]
> http://lists.macosforge.org/mailman/listinfo/macports-users

_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

David Blank-Edelman
Thanks for the response.

On Dec 6, 2007, at 1:16 AM, Jay Chandler wrote:

> Am I missing something, or will "port upgrade outdated" solve this?  
> I don't show old versions of upgraded ports...

How are you checking? If I type:

$ port upgrade apr

just to upgrade that package, I see:

$ port installed apr
The following ports are currently installed:
   apr @1.2.11_0+darwin_9
   apr @1.2.12_0+darwin_9 (active)

       -- dNb
_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

Corey Chandler
David Blank-Edelman wrote:

> Thanks for the response.
>
> On Dec 6, 2007, at 1:16 AM, Jay Chandler wrote:
>
>> Am I missing something, or will "port upgrade outdated" solve this?  
>> I don't show old versions of upgraded ports...
>
> How are you checking? If I type:
>
> $ port upgrade apr
>
> just to upgrade that package, I see:
>
> $ port installed apr
> The following ports are currently installed:
>   apr @1.2.11_0+darwin_9
>   apr @1.2.12_0+darwin_9 (active)
>
>       -- dNb
Whoops, you're right.

Okay..
  glib2 @2.14.4_0+darwin_9
  glib2 @2.14.4_1+darwin_9 (active)



bash-3.2# port uninstall  glib2 @2.14.4_0+darwin_9--->  Unable to
uninstall glib2 2.14.4_0+darwin_9, the following ports depend on it:
--->      atk
--->      pango
--->      gtk2
--->      wireshark
--->      gmime
--->      py25-gobject
--->      gtk2
Error: port uninstall failed: Please uninstall the ports that depend on
glib2 first.
bash-3.2# port -f uninstall  glib2 @2.14.4_0+darwin_9
--->  Unable to uninstall glib2 2.14.4_0+darwin_9, the following ports
depend on it:
--->      atk
--->      pango
--->      gtk2
--->      wireshark
--->      gmime
--->      py25-gobject
--->      gtk2
Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Uninstalling glib2 2.14.4_0+darwin_9
bash-3.2#

Not sure if this is "approved," but it sure worked, and none of the deps
broke...
-- Jay


_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

Corey Chandler
Jay Chandler wrote:
> David Blank-Edelman wrote:
>> Thanks for the response.

And lastly, to distill this down to one line:

port -uf uninstall

Unless someone else has a reason this shouldn't be done?

-- Jay
_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

Ryan Schmidt-24
In reply to this post by David Blank-Edelman
On Dec 5, 2007, at 23:56, David Blank-Edelman wrote:

> Pardon me if this is an obvious question, but I'd like to know if  
> there is an easy way (e.g. a script) to keep a maximally clean tree  
> of active ports? I'd ideally like to have only the latest and  
> greatest of every port I use installed on my machine. As new  
> versions of ports (libraries in particular) get released, it seems  
> like one starts to collect old versions of these ports because  
> something else previously installed linked against that old version.
>
> For example, right now my "ports outdated" says:
>
> apr                            1.2.11_0 < 1.2.12_0
> apr-util                       1.2.10_0 < 1.2.12_0
> cairo                          1.4.10_0 < 1.4.12_0
> freetype                       2.3.5_0 < 2.3.5_1
> glib2                          2.14.3_0 < 2.14.4_1
> gtk2                           2.12.1_0 < 2.12.3_0
> sqlite3                        3.5.2_0 < 3.5.3_1
>
> I'm familiar with the -u switch to ports, but just to continue this  
> example, I can't say "port -u upgrade cairo" because it says:
>
> --->  Unable to uninstall freetype 2.3.5_0, the following ports  
> depend on it:
> --->   fontconfig
> --->   cairo
> --->   Xft2
> --->   gtk2
> Error: Uninstall freetype 2.3.5_0 failed: Please uninstall the  
> ports that depend on freetype first.
> --->  Unable to uninstall cairo 1.4.10_0, the following ports  
> depend on it:

The message should say "Won't uninstall cairo 1.4.10_0 because the  
following ports depend on cairo:"

Ports don't depend on specific versions of ports. If you've just  
installed cairo 1.4.12_0, then the ports that depend on cairo will be  
happy with that version as well, and you're free to forcibly  
uninstall the old 1.4.10_0 version.

> --->   pango
> --->   gtk2
> Error: Uninstall cairo 1.4.10_0 failed: Please uninstall the ports  
> that depend on cairo first.
>
> As far as I know, the only way to keep only the latest version of  
> cairo is to uninstall all of the stuff that depends on the past  
> version(s) of cairo, upgrade cairo, and then rebuild/reinstall all  
> of those ports. For certain ports there are enough steps in the  
> chain (e.g. wireshark) that this becomes a bit of a hassle.
>
> So my questions are:
>    1) Am I missing some incantation with port that will chase these  
> dependencies for me?
>    2) If not, it seems like it should be possible to write a script  
> that figures out the right uninstall/build/install dance in the  
> shortest number of moves  to leave a ports tree with only the very  
> latest things installed. Anybody have one?
>    3) Another possibility would be to write something that kept a  
> list of installed ports, blew away the current port installation,  
> and installed that list again from scratch. This seems a bit heavy  
> handed, but it would work.
>
> Thanks for any help you can offer (and my sincere thanks to the  
> people on the project plus the ports maintainers for all of the  
> hard work that they do).

Someone posted a recipe some time ago which I now agree with, which is:

1. Run "port outdated"
2. If there aren't any listed, go to 5.
3. Pick the first port in the list (let's call it "foo") and say  
"sudo port upgrade foo". This might upgrade just foo, or if foo has  
outdated dependencies, it will update those too.
4. Go back to 1.
5. Uninstall all now-inactive old versions with "sudo port -f  
uninstall inactive"


_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

David Blank-Edelman
Hi Ryan-

On Dec 6, 2007, at 2:36 AM, Ryan Schmidt wrote:

> The message should say "Won't uninstall cairo 1.4.10_0 because the  
> following ports depend on cairo:"
>
> Ports don't depend on specific versions of ports. If you've just  
> installed cairo 1.4.12_0, then the ports that depend on cairo will  
> be happy with that version as well, and you're free to forcibly  
> uninstall the old 1.4.10_0 version.

Ah, ok. I just assumed that each port knew what it took to build it  
and would would attempt to keep that dependency around because it has  
no way of knowing that the old program will work with the new shared  
lib. I guess this shows my pre-OSX *NIX roots.

> Someone posted a recipe some time ago which I now agree with, which  
> is:
>
> 1. Run "port outdated"
> 2. If there aren't any listed, go to 5.
> 3. Pick the first port in the list (let's call it "foo") and say  
> "sudo port upgrade foo". This might upgrade just foo, or if foo has  
> outdated dependencies, it will update those too.
> 4. Go back to 1.
> 5. Uninstall all now-inactive old versions with "sudo port -f  
> uninstall inactive"

Great, I'll do just that.

I usually think of "force" switches as something you only do when the  
normal procedure fails. It is a little strange to me that one would  
want to force things as a matter of course. It also means that the  
default situation leaves inactive and unneeded ports hanging around by  
default. Just our of curiosity,  can someone say a little bit more  
about why it is done that way?

Thanks again for your help.

     -- dNb
_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

Ryan Schmidt-24
On Dec 6, 2007, at 01:52, David Blank-Edelman wrote:

> On Dec 6, 2007, at 2:36 AM, Ryan Schmidt wrote:
>
>> The message should say "Won't uninstall cairo 1.4.10_0 because the  
>> following ports depend on cairo:"
>>
>> Ports don't depend on specific versions of ports. If you've just  
>> installed cairo 1.4.12_0, then the ports that depend on cairo will  
>> be happy with that version as well, and you're free to forcibly  
>> uninstall the old 1.4.10_0 version.
>
> Ah, ok. I just assumed that each port knew what it took to build it  
> and would would attempt to keep that dependency around because it  
> has no way of knowing that the old program will work with the new  
> shared lib. I guess this shows my pre-OSX *NIX roots.

Well, you're right, of course. If a new version of some software  
installs new libraries that aren't ABI-compatible with the old  
libraries, everything that depends on that software will break. This  
happened, for example, with the upgrade from gettext 0.14.x to  
0.15.x, and workarounds for this situation were posted here:

http://trac.macosforge.org/projects/macports/wiki/ 
ProblemHotlist#a2.Aportfailedtobuildupgradeorrunwithamessagereferringtol
ibintl.3.dylib

>> Someone posted a recipe some time ago which I now agree with,  
>> which is:
>>
>> 1. Run "port outdated"
>> 2. If there aren't any listed, go to 5.
>> 3. Pick the first port in the list (let's call it "foo") and say  
>> "sudo port upgrade foo". This might upgrade just foo, or if foo  
>> has outdated dependencies, it will update those too.
>> 4. Go back to 1.
>> 5. Uninstall all now-inactive old versions with "sudo port -f  
>> uninstall inactive"
>
> Great, I'll do just that.
>
> I usually think of "force" switches as something you only do when  
> the normal procedure fails. It is a little strange to me that one  
> would want to force things as a matter of course. It also means  
> that the default situation leaves inactive and unneeded ports  
> hanging around by default. Just our of curiosity,  can someone say  
> a little bit more about why it is done that way?

I agree here again. You should not have to force anything in normal  
use. But you currently do, to uninstall old versions of software on  
which other software depends. Discussion of how this situation could  
be improved would probably be welcomed on the macports-dev list.


_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

Paul Beard-2
On 12/5/07, Ryan Schmidt <[hidden email]> wrote:
>
> I agree here again. You should not have to force anything in normal
> use. But you currently do, to uninstall old versions of software on
> which other software depends. Discussion of how this situation could
> be improved would probably be welcomed on the macports-dev list.
>

is there a reason not to make what we now use as "-f" the default
behavior? If I use "port upgrade foo" I expect foo to be upgraded to
the latest version. the use of "upgrade" implies that I have an
existing version that may be out of date and if it is, I want it
upgraded.

I realize, in circumstances like the gettext issue mentioned above,
that can hose things up, but that could be something is flagged in a
Portfile that might display a message like:

####
Installed port foo 0.6-7,1 is superceded by foo 0.7. foo 0.7 is
incompatible with installed ports
bar 1.1
baz 0.9-1
quux 0.2-3,1_3

To upgrade foo correctly, please uninstall the ports that depend on
it, upgrade foo and reinstall the dependents.

####

here's a particularly hairy example from FreeBSD's UPDATING file:

20050201:
  AFFECTS: users of lang/perl5 and lang/perl5.8
  AUTHOR: [hidden email]

  lang/perl5 has been updated to 5.6.2, and lang/perl5.8 has been
  updated to 5.8.6. you should update everything depending on perl, that
  is:

    * first, upgrade your perl installation (use either lang/perl5 or
      lang/perl5.8, the latter being recommended);
    * for FreeBSD 4.X, run "use.perl port", so that the system knows you
      have 5.8.6 or 5.6.2; this step is not needed on FreeBSD 5.X and
      FreeBSD -CURRENT;
    * run some magic incantations to upgrade all ports depending on perl,
      that is run something like :
      portupgrade -f `(pkg_info -R perl-5\* |tail +4; \
        find /usr/local/lib/perl5/site_perl/5.[68].[1245] -type f -print0 \
        | xargs -0 pkg_which -fv | sed -e '/: ?/d' -e 's/.*: //')|sort -u`
      This is likely to fail for a few ports, you'll have to upgrade them
      afterwards by hand.

Personally, I would have this be dumped out to the console when an
upgrade matches the date and version that this applies to. But that's
cuz I am too lazy/absent-minded to read UPDATING as often as I should.


--
Paul Beard / www.paulbeard.org/
<[hidden email]/[hidden email]>
_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

William Davis

On Dec 7, 2007, at 1:09 PM, paul beard wrote:

> On 12/5/07, Ryan Schmidt <[hidden email]> wrote:
>>
>> I agree here again. You should not have to force anything in normal
>> use. But you currently do, to uninstall old versions of software on
>> which other software depends. Discussion of how this situation could
>> be improved would probably be welcomed on the macports-dev list.
>>
>
> is there a reason not to make what we now use as "-f" the default
> behavior? If I use "port upgrade foo" I expect foo to be upgraded to
> the latest version. the use of "upgrade" implies that I have an
> existing version that may be out of date and if it is, I want it
> upgraded.
>
> I realize, in circumstances like the gettext issue mentioned above,
> that can hose things up, but that could be something is flagged in a
> Portfile that might display a message like:
>
> ####
> Installed port foo 0.6-7,1 is superceded by foo 0.7. foo 0.7 is
> incompatible with installed ports
> bar 1.1
> baz 0.9-1
> quux 0.2-3,1_3
>
> To upgrade foo correctly, please uninstall the ports that depend on
> it, upgrade foo and reinstall the dependents.
>
> ####
>
> here's a particularly hairy example from FreeBSD's UPDATING file:
>
> 20050201:
>  AFFECTS: users of lang/perl5 and lang/perl5.8
>  AUTHOR: [hidden email]
>
>  lang/perl5 has been updated to 5.6.2, and lang/perl5.8 has been
>  updated to 5.8.6. you should update everything depending on perl,  
> that
>  is:
>
>    * first, upgrade your perl installation (use either lang/perl5 or
>      lang/perl5.8, the latter being recommended);
>    * for FreeBSD 4.X, run "use.perl port", so that the system knows  
> you
>      have 5.8.6 or 5.6.2; this step is not needed on FreeBSD 5.X and
>      FreeBSD -CURRENT;
>    * run some magic incantations to upgrade all ports depending on  
> perl,
>      that is run something like :
>      portupgrade -f `(pkg_info -R perl-5\* |tail +4; \
>        find /usr/local/lib/perl5/site_perl/5.[68].[1245] -type f -
> print0 \
>        | xargs -0 pkg_which -fv | sed -e '/: ?/d' -e 's/.*: //')|
> sort -u`
>      This is likely to fail for a few ports, you'll have to upgrade  
> them
>      afterwards by hand.
>
> Personally, I would have this be dumped out to the console when an
> upgrade matches the date and version that this applies to. But that's
> cuz I am too lazy/absent-minded to read UPDATING as often as I should.
>
>
> --
> Paul Beard / www.paulbeard.org/
> <[hidden email]/[hidden email]>
> _______________________________________________
> macports-users mailing list
> [hidden email]
> http://lists.macosforge.org/mailman/listinfo/macports-users

pardon, but doesnt using -R  (-dfunR) take care of this?

William Davis
frstanATbellsouthDOTnet
Mac OS X.5.1 Darwin 9.1.0
X11.app 2.1.0 - X.org X11R7.2
Mac Mini Intel Duo @ 1.86 GHz

Mundus vult decepi, ego non

_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

Paul Beard-2
On 12/7/07, William Davis <[hidden email]> wrote:
>
> pardon, but doesnt using -R  (-dfunR) take care of this?

Yes, it does The Right Thing if there a newly-introduced mismatch in a
port that has dependents.

   -R       also upgrade dependents (only for upgrading)

But I think that the OP was looking for a simpler way to upgrade
existing ports without using "force" or ideally with no flags at all
(well, maybe an optional -c).

using -fundR is 5 flags, and I usually add -c, so we're up to 6
arguments to do what many would expect to be the default operaion.
--
Paul Beard / www.paulbeard.org/
<[hidden email]/[hidden email]>
_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users
Reply | Threaded
Open this post in threaded view
|

Re: keeping a (maximally) clean active tree

William Davis

On Dec 7, 2007, at 6:41 PM, paul beard wrote:

> On 12/7/07, William Davis <[hidden email]> wrote:
>>
>> pardon, but doesnt using -R  (-dfunR) take care of this?
>
> Yes, it does The Right Thing if there a newly-introduced mismatch in a
> port that has dependents.
>
>   -R       also upgrade dependents (only for upgrading)
>
> But I think that the OP was looking for a simpler way to upgrade
> existing ports without using "force" or ideally with no flags at all
> (well, maybe an optional -c).
>
> using -fundR is 5 flags, and I usually add -c, so we're up to 6
> arguments to do what many would expect to be the default operaion.
> --
> Paul Beard / www.paulbeard.org/
> <[hidden email]/[hidden email]>


yep, (except posibly -d) I prefer those as the defaults meself. :)

btw you know you find out what's outdated with
port outdated
very logical -- but then you would expected to update them with
port update foo (or all)
but you cant, you have to say
port upgrade foo  (and upgrade "all" installs all uninstalled ports).
Then to upgrade the port system itsself you'd expect
port selfupgrade but you cant. Instead you must say
port selfupdate.

;)

William Davis
frstanATbellsouthDOTnet
Mac OS X.5.1 Darwin 9.1.0
X11.app 2.1.0 - X.org X11R7.2
Mac Mini Intel Duo @ 1.86 GHz

Mundus vult decepi, ego non

_______________________________________________
macports-users mailing list
[hidden email]
http://lists.macosforge.org/mailman/listinfo/macports-users