Unexpectedly easy reinstall with portmaster of some ports (mostly Perl)

I was taken aback by the hundreds of ports (p5- mostly) which were installed (per the find below); but the man pages were often not found. It appeared most of these had a +CONTENTS.bak in /var/db/pkg
So...
Code:
cd /var/db/pkg
script -a /tmp/p5_replace.log find . -type f -name "*.bak" -exec cp -v {} /tmp \;
/bin/rm -v /tmp/+CONTENTS.bak
# (First, edit the p5_replace.log so just the lines with port names remain )
#  Then, we can process it in a loop that derives the port names from the file, as the [FILE].log[/FILE]
#  file has extraneous text in it...
cd /tmp
for i in $( cut -d / -f 2 p5_replace.log ); do ( portmaster -d -B -i -g /var/db/pkg/"$i"); done 
# edited /var/db/pkg"$i" to /var/db/pkg/"$i" (typo...) 
# BTW I've not checked the [FILE]cut[/FILE] command as precisely the same
# in other shells, the [FILE]script [/FILE] log may be different...

One may wish to one-by-one reinstall non-perl ports in that file first, or delete them from the
file... YMMV. (I only worked out this method today, so only used it more or less this way.)
( BTW it may take many hours... despite working flawlessly ( unless I've made some typo in
the instructions))...
..../edit/
To restart more effortlessly (say if one's computer is off for the night, or
in case of some other glitch...), check the latest packages saved with that portmaster command to /usr/ports/packages/All, and delete them from the top
of the p5_replace.log file to rerun the command, which will thence
rebuild the smaller number of non-completed ports.
..../end edit/


I tentatively intend to run it after each version bump (major) of perl
(and/or maybe some other similar ports) from now on,
depending upon the number of .bak files found.
 
portmaster has a -r flag, which makes it update all ports which depend on a given port.
# portmaster -r lang/perl5.8
Why not use that?
 
1...Only about one third of the perl ports needed to be reinstalled. I suspect that
the -r option would take a many many days more, rebuilding many of
the gnome, multimedia, etc ports.
2...Other ports besides perl ones also had the extraneous +CONTENTS.bak
3...A file from which to work is needed in this case for the restart after overnight
shutdown (as it turned out), so the full process is not restarted.
4...About every tenth perl port needed manual intervention (could not fetch, did not build, needed clang >> gcc, maybe three other less common reasons).
 
why wouldnt you just use
Code:
portmaster --list-origins > ~/installed-ports-list
portmaster -g `cat ~/installed-portlist`

shouldnt do that the same?
and after that just

Code:
portmaster -PP --local-pakagedir=/usr/ports/packages/All -a

shouldnt that be suffice?
 
Code:
 portmaster -g  # AFAIK...
...would rebuild all ports while creating the packages. ( I've way too many to do more than a subset at a time... (First install early 2004. By late 2004 I had many many more... portmaster did not appear til 2006...), nor the time to reinstall more than a few per day without preplanning and scripting usually. )
Also, more than one machine.
I usually copy the .tbz to another machine with a thumbdrive, install them
locally, and upgrade a few at a time...
Code:
grep p5 upgrade.fil | grep -v PGPLOT | awk '{print $1} | xargs -J % portmaster -d -B -P -i -g --upgrade-if-newer % && yell || yell 
...
grep devel ...
...
grep graphics...
 
Back
Top