View previous topic :: View next topic |
Author |
Message |
leha n00b
Joined: 15 Apr 2004 Posts: 29
|
Posted: Sat May 21, 2005 10:34 am Post subject: Update packages with a major change in version number |
|
|
I was looking for some utility that would allow to update only packages with major change in version number. It is not fun to compile 20Mb of code just to update some program from X.X.100 to X.X.101
Does anybody know some utility/option that would do this?
I was not able to find anything so I wrote a perl filter . Here it is
Code: |
#! /usr/bin/perl -w
# File: everge.pl , made by leha
use strict;
use warnings;
if ( @ARGV > 0 ){ #if there is argument
if ( $ARGV[0] =~ /^\d+(?:\.\d+){0,2}$/ ){ #check for correct input argument
my @diff = split(/[^0-9a-zA-Z]/, $ARGV[0]); #minimal difference to install package
my @curver; #installed version
my @newver; #version in the portage
my $package; #package name
NLINE: while (my $line = <STDIN>){ #read from stdin
if ( $line =~ /^\[ebuild.*\]\s([\w\/\-]+)-([\d\.]+.*)\s\[(.*)\].*/ ){ #find versions and package name
$package = $1;
@newver = split(/[^0-9a-zA-Z]/, $2);
@curver = split(/[^0-9a-zA-Z]/, $3);
for (my $i=0; $i<$#diff+1; $i++){ #check all subversions
if ( $curver[$i] =~ /^\d+$/ && $newver[$i] =~ /^\d+$/ && $newver[$i]> $curver[$i]+$diff[$i] ){
print $package, " ";
next NLINE;
}
}
}
}
}
else{ #print help if input argument is wrong
}
}
else{ # no argument , print everething
while (my $line = <STDIN>){ #read from stdin
if ( $line =~ /^\[ebuild.*\]\s([\w\/\-]+)-([\d\.]+.*)\s\[(.*)\].*/) {
print $1, " ";
}
}
}
|
This script reads STDIN and expects output from "emerge -uDpv world". It outputs space separated "package-category/package-name" (this stuff can be fed into emerge). It has one optional argument.
If there is no argument the script will print all package names that it get from STDIN. The argument defines what is considered a major version change. It has the formant N1 or N1.N2 or N1.N2.N3 where N1,N2,N3 are numbers. The script will print name of a package if version of installed package is bigger then version of the package in the portage by argument.
Examples:
argument is 0 then the script will print all packages which version have changed by at least one infront of the first dot (say from 2.0.0 to 3.0.0 )
argument is 0.0.0 then the script will print all packages which version have changed by at least one after the second dot (say from 2.0.20 to 2.0.21 ), it will also print package name if change of version happened in the first or second position
argument is 0.0.5 then it will print packaged which version have changed say from 2.0.20 to 2.0.26 but not package with say change from 2.0.20 to 2.0.24.
Hopefully this script will be of some use to somebody. Good luck. |
|
Back to top |
|
|
Boohbah Apprentice
Joined: 17 Oct 2003 Posts: 250 Location: Seattle
|
Posted: Sat May 21, 2005 10:37 am Post subject: |
|
|
Mask package versions in /etc/portage/package.mask.
_________________ Never try to explain computers to a layman. It's easier to explain sex to a virgin.
-- Robert Heinlein
(Note, however, that virgins tend to know a lot about computers.) |
|
Back to top |
|
|
leha n00b
Joined: 15 Apr 2004 Posts: 29
|
Posted: Sun May 22, 2005 7:33 am Post subject: |
|
|
Well, I do not consider masking/unmasking hundreds of packages as a good way to spend afternoon |
|
Back to top |
|
|
kallamej Administrator
Joined: 27 Jun 2003 Posts: 4975 Location: Gothenburg, Sweden
|
Posted: Sun May 22, 2005 7:50 am Post subject: |
|
|
Moved from Gentoo Chat to Unsupported Software. |
|
Back to top |
|
|
rhill Retired Dev
Joined: 22 Oct 2004 Posts: 1629 Location: sk.ca
|
Posted: Sun May 22, 2005 8:15 am Post subject: |
|
|
usually the minor bumps in version number are just as important as the major ones. _________________ by design, by neglect
for a fact or just for effect |
|
Back to top |
|
|
moocha Watchman
Joined: 21 Oct 2003 Posts: 5722
|
Posted: Sun May 22, 2005 10:56 am Post subject: |
|
|
Also don't forget the Code: | ~category/package-version.number.here | atom syntax. It only works for revision numbers, not for minor version numbers, but it's very useful. Seeon more about it. _________________ Military Commissions Act of 2006: http://tinyurl.com/jrcto
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin |
|
Back to top |
|
|
Rainmaker Veteran
Joined: 12 Feb 2004 Posts: 1650 Location: /home/NL/ehv/
|
Posted: Sun May 22, 2005 3:40 pm Post subject: |
|
|
dirtyepic wrote: | usually the minor bumps in version number are just as important as the major ones. |
agreed, most of the time these are security fixes.
Might be a pain to compile 20 megs of code, but i.e. firefox can be quite dangerous if not updated regularly _________________ If you can't dazzle them with brilliance, baffle them with bullshit. |
|
Back to top |
|
|
Gherald Veteran
Joined: 23 Aug 2004 Posts: 1399 Location: CLUAConsole
|
Posted: Sun May 22, 2005 3:48 pm Post subject: |
|
|
you mean e.g. firefox ...
I think the most reasonable solution is to "emerge -u world" instead of -uD, and leave it at that. |
|
Back to top |
|
|
leha n00b
Joined: 15 Apr 2004 Posts: 29
|
Posted: Sun May 22, 2005 4:50 pm Post subject: |
|
|
If security is important for your system than you should probably read some secuirity websites and dont rely on portage. I personally dont care much about bugs/security holes in software ( look, most of the people use windows ). Of course, you have to keep eye on say firefox, IM, etc. but again slashdot posts story about firefox update before it appears in portage .
"emerge -u world" want to update such packages as say bash, emacs, mplayer , etc. etc. They work perfectly well as they are and dont need to be updated every week (most linuxes dont update they software for months).
The above script is made for convinience. For example, I did not update for a while so "emerge -u world -pv" gave me >100 packages to update. Looking through all of them and copying by hand names of packages that "really" need update is not fun. Using the above script I updated packages with change in version number after the first dot and looked through the rest to update "important" ones (for "important" any version change deserves updating). |
|
Back to top |
|
|
|