From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-user+bounces-85681-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1KvMOF-0004dJ-1F
	for garchives@archives.gentoo.org; Thu, 30 Oct 2008 01:31:59 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id F2136E03B1;
	Thu, 30 Oct 2008 01:31:58 +0000 (UTC)
Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.190])
	by pigeon.gentoo.org (Postfix) with ESMTP id 9DF57E03B1
	for <gentoo-user@lists.gentoo.org>; Thu, 30 Oct 2008 01:31:58 +0000 (UTC)
Received: by fk-out-0910.google.com with SMTP id 18so82100fks.2
        for <gentoo-user@lists.gentoo.org>; Wed, 29 Oct 2008 18:31:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:message-id:date:from:to
         :subject:in-reply-to:mime-version:content-type
         :content-transfer-encoding:content-disposition:references;
        bh=BUcV+hc5oLDIRcBcPWIN0uYzliikM5A9Og3yNLZjnvU=;
        b=GBoNXI2w3iSADyo6EC8MFc2z0/u02lgz7NlPccOhp6RG3jzbY8xSy7oE2cSvu0Z4lS
         iz0+FzF7ulTMFA9lQ5parE/ZO6KVyFtfXhY5wf80EJjQMNQNCHjGqSqrFgskF0rpytCI
         hsy4i/2idzyLN5ap/7d40XKbg1Qo5WPxZA8vk=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=message-id:date:from:to:subject:in-reply-to:mime-version
         :content-type:content-transfer-encoding:content-disposition
         :references;
        b=qJmNkKuG34ALMzUk0kwCsjsnEPFmDSyRbShwPpkgZOUuiyrWllDuDW4RxczYv7gysT
         yoMEGQ6sOrCBN/uEUF/YLvcMl3YRE/tni5Un5MWPdmEP+/XAK6B2/PWj/hOPm53wLI8v
         7t/FRgWFspbpoRYzUdDK9+T5asfK+BujfqK+8=
Received: by 10.103.217.7 with SMTP id u7mr4552552muq.111.1225330316741;
        Wed, 29 Oct 2008 18:31:56 -0700 (PDT)
Received: by 10.103.204.9 with HTTP; Wed, 29 Oct 2008 18:31:56 -0700 (PDT)
Message-ID: <e38d12ff0810291831x4dcd473elbfe96c6f340304b4@mail.gmail.com>
Date: Wed, 29 Oct 2008 21:31:56 -0400
From: "Andrey Vul" <andrey.vul@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] A question about emerge --info
In-Reply-To: <c30988c30810291747k20c7841cveb542d0356ebc91f@mail.gmail.com>
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <58965d8a0810291553x50e4068ehc58834dfdbce285b@mail.gmail.com>
	 <350fc7cf0810291609v335f4909nbcd90ab7d368cb5d@mail.gmail.com>
	 <e38d12ff0810291613t6205b80em1294991c930ce1cf@mail.gmail.com>
	 <350fc7cf0810291623j5fb5608rf311cd0d2a371d2a@mail.gmail.com>
	 <e38d12ff0810291632gde628e5p5edadfc87f2704a8@mail.gmail.com>
	 <e38d12ff0810291641t7bb26b6fo1ea6ecc2aa4ef19c@mail.gmail.com>
	 <e38d12ff0810291651y245cba2k89b9cb2b8ee39dd9@mail.gmail.com>
	 <c30988c30810291747k20c7841cveb542d0356ebc91f@mail.gmail.com>
X-Archives-Salt: ca45b0fd-29ea-4b8e-bf3e-3bf1d6ad7e08
X-Archives-Hash: 188421d415f2f9db30726a2556009e06

On Wed, Oct 29, 2008 at 8:47 PM, Joshua Murphy <poisonbl@gmail.com> wrote:
> On Wed, Oct 29, 2008 at 7:51 PM, Andrey Vul <andrey.vul@gmail.com> wrote:
> <snip>
>>    elif system in ('Linux',):
>>        # Linux based systems
>>        distname,distversion,distid = dist('')
>>        if distname and not terse:
>>            platform = _platform(system,release,machine,processor,
>>                                 'with',
>>                                 distname,distversion,distid)
>>        else:
>>            # If the distribution name is unknown check for libc vs. glibc
>>            libcname,libcversion = libc_ver(sys.executable)
>>            platform = _platform(system,release,machine,processor,
>>                                 'with',
>>                                 libcname+libcversion)
> <snip>
>
> Hrm. I know just enough about python to get myself in trouble here...
> but it looks like a python bug in magicking up the libc name and
> version... but the below is WAY outside my level of practice with
> python (it'll take re-reading and digging elsewhere a good few times
> if I'm ever to make sense of it...
>
> ------------------
> def libc_ver(executable=sys.executable,lib='',version='',
>
>             chunksize=2048):
>
>    """ Tries to determine the libc version that the file executable
>        (which defaults to the Python interpreter) is linked against.
>
>        Returns a tuple of strings (lib,version) which default to the
>        given parameters in case the lookup fails.
>
>        Note that the function has intimate knowledge of how different
>        libc versions add symbols to the executable and thus is probably
>        only useable for executables compiled using gcc.
>
>        The file is read and scanned in chunks of chunksize bytes.
>
>    """
>    f = open(executable,'rb')
>    binary = f.read(chunksize)
>    pos = 0
>    while 1:
>        m = _libc_search.search(binary,pos)
>        if not m:
>            binary = f.read(chunksize)
>            if not binary:
>                break
>            pos = 0
>            continue
>        libcinit,glibc,glibcversion,so,threads,soversion = m.groups()
>        if libcinit and not lib:
>            lib = 'libc'
>        elif glibc:
>            if lib != 'glibc':
>                lib = 'glibc'
>                version = glibcversion
>            elif glibcversion > version:
>                version = glibcversion
>        elif so:
>            if lib != 'glibc':
>                lib = 'libc'
>                if soversion > version:
>                    version = soversion
>                if threads and version[-len(threads):] != threads:
>                    version = version + threads
>        pos = m.end()
>    f.close()
>    return lib,version
> ------------------
>
> It parses the header of an executable and guesses, but... the how is
> too many directions from this that I'm not seeing it with my haphazard
> abuse of grep. I'd presume anything that might care what platform it's
> running on (underneath python itself) would be susceptible, so a word
> thrown in the direction of upstream python would be the main way to
> go... though it looks like emerge didn't used to use that call...
>
> Portage 2.1.4.5 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.6.1-r0,
> 2.6.25-gentoo-r7-mahain i686)
> =================================================================
> System uname: 2.6.25-gentoo-r7-mahain i686 AMD Athlon(tm) MP 2400+
>
> is my output, based on a call in emerge to "uname -mrp" .. not
> platform.platform()
>
> Looks like gentoo-dev aimed to drop that dependency in newer versions after all.
The creator of paludis was right ... portage is a jack of all trades
and a master of none.



-- 
Andrey Vul

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?