[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dehs live code



Bluefuture wrote:
Hi Gustavo,

(...)
Btw, I would like to suggest point out (or ommit) the packages where
version naming scheme don't match, like in a52dec. It's the easier
scenario: If the upstream part of the version (upstream or debian)
contains "[a-Z]" and the other doesn't, the version naming scheme
can't be compared in a sane way, eg: "snapshot" against "1.0" (-X
intentionally ommitted). Thoughts?

I think that the compare function could be improved more because, as u
can see, actually is very simple (from dehs svn repo):

function is_updated ($up_vers,$debian_vers) {
	if ($up_vers=='') return 0;
		passthru("dpkg --compare-versions '$up_vers' eq '" .
vers_conv($debian_vers) . "'",$great);
	if ($great!=0) return 1;
else return 0; }

Any suggestion to improve it?

Yes, sort of:

function is_updated ($up_vers, $debian_vers) {
  if ($up_vers=='') return 0;
  if (!(($debian_vers =~ /\d+\.?/) && ($up_vers =~ /\d+\.?/))) return 0;
  ...
}

I did some tests and I think that the results of the regex match above are flexible enough to not break anything, see the results:

debian version: 1.0 - upstream version: 1.0 (sane)
debian version: 1.0-1 - upstream version: 1.0-1 (sane)
debian version: 2.0 - upstream version: 1.0 (sane)
debian version: 2.0-1 - upstream version: 1.0-1 (sane)
debian version: 1.0 - upstream version: 2.0 (sane)
debian version: 1.0-1 - upstream version: 2.0-1 (sane)
debian version: 1.0~1 - upstream version: 2.0~1 (sane)
debian version: 1.0:1 - upstream version: 2.0:1 (sane)
debian version: 1.0-1 - upstream version: snapshot2 (sane)

debian version: snapshot - upstream version: foobar (insane)
debian version: 1.0 - upstream version: snapshot (insane)
debian version: snapshot - upstream version: 1.0 (insane)

regards,
Gustavo Franco - <stratus@debian.org>



Reply to: