smart does not recognize package channels

Bug #626567 reported by Tobias Gerschner on 2010-08-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Smart Package Manager
Undecided
Unassigned

Bug Description

I have recently updated to updated rpm 5.2.1 and python 2.7, after rebuilding smart ( both 1.3.1 + 1.4 trunk ) it does not appear to recognize any software channel.

When running smart update it neither recognizes any packages present in the repository.
When running smart search <insert locally installed package here> it does not return any matches. rpm 5.2.x as such works fine.

As Unity is already using rpm5 with smart just fine my first guess would be that the python update to 2.7 is to blame, but of course this is just a wild guess.

Starting to dig now ... .

Attached is a file with a few commands to show the behaviour stated above.

description: updated
Anders F Björklund (afb) wrote :

Have you installed /etc/rpm/platform, so that rpm.archscore works ?

Anders F Björklund (afb) wrote :

See also Bug #244771 and Bug #587448 for related discussion...

After talking to Matt D (mdawkins from UL ) I added the archscore patch and played around a bit. Does not look promising so far.

From what I read so far , smart and rpm5 do have different approaches to determine the archscore, is there any information what the 'right way' is?

root@Yoper ~ # for s in i686 i686-linux-gnu i686-linux i686-yoper-linux-gnu ; do echo $s |tee /etc/rpm/platform ; python -c 'import rpm; print rpm.archscore("i686")'; rm -f /var/lib/smart/channels/* /var/lib/smart/cache ; smart update 2>&1 |grep ^Channels ; smart search rsync ;done

i686
0
Channels have no new packages.
Loading cache...
Updating cache... ############################################################# [100%]

i686-linux-gnu
0
Channels have no new packages.
Loading cache...
Updating cache... ############################################################# [100%]

i686-linux
0
Channels have no new packages.
Loading cache...
Updating cache... ############################################################# [100%]

i686-yoper-linux-gnu
0
Channels have no new packages.
Loading cache...
Updating cache... ############################################################# [100%]

root@Yoper ~ # rpm --eval '%_target'
i686-linux

root@Yoper ~ # smart channel --show
[yoper]
type = apt-rpm
baseurl = http://ftp.yoper.com/pub/yoper/pkg
components = rocketfuel

[rpm-sys]
type = rpm-sys
name = RPM Database

Anders F Björklund (afb) wrote :

Smart only calls rpm.archscore. The patch (assuming Bug #587448 here) only tries to cope with broken/missing archScore. You still need to set up /etc/rpm/platform for platformScore to work...

For a one-arch platform, it's:

rpm --eval='%{_target_platform}' > /etc/rpm/platform

Here is one basic "extended" suggestion:

rpm --eval='%{_target_cpu}-%{_target_vendor}-%{_target_os}%{?_gnu}' > /etc/rpm/platform
rpm --eval='noarch-%{_target_vendor}-%{_target_os}%{?_gnu}' >> /etc/rpm/platform
rpm --eval='%{_target_cpu}-.*-%{_target_os}.*' >> /etc/rpm/platform
rpm --eval='noarch-.*-%{_target_os}.*' >> /etc/rpm/platform

You'll need to add ix86 compats, if needed.

Anders F Björklund (afb) wrote :

Or make that %{_vendor} instead of %{_target_vendor}, if you are using that...
It's typically something like "redhat", where target vendor is something like "pc":

x86_64-redhat-linux
x86_64-pc-linux-gnu

That is why the second set of lines set up a regex to ignore both vendor and gnu...
It should also ignore any os version, if present. For instance on Darwin/FreeBSD.

Anders F Björklund (afb) wrote :

Just verified that Unity Linux uses cpuinfo (/usr/lib/rpm/cpuinfo.yaml) instead of platform (/etc/rpm/platform). So the config above doesn't apply there. See --with-cpuinfo in rpm-5.2.

Anders F Björklund (afb) wrote :

Documenting that --with-cpuinfo implicitly needs --with-syck too, before it will work.

After some time on #rpm @ IRC we were able to identify this as an rpm5 configuration issue on my end , which affected the archscore calculation within rpm , which in return prevented smart from matching the architecture of any packages in the repository indizes fetched by smart. So this bug is at least invalid and would be more appropriate to RTFM , oh wait there wasn't any. Thx to Jeff and Anders for helping me in resolving the problem, though.

For those running into similar problem, the valid configuration for us was

--with-libelf \
--with-build-extlibdep \
--with-build-maxextlibdep \
--enable-build-versionscript \
--enable-build-warnings \
--with-perl \
--with-python=2.7 \
--with-pcre=internal \
--with-usecrypto=beecrypt \
--with-beecrypt=external \
--with-db=internal --with-db-tools-integrated \
--with-bzip2=external \
--with-file=external \
--with-keyutils=external \
--with-lua=external \
--with-popt=external \
--with-xz=external \
--with-zlib=external

cat > $RPM_BUILD_ROOT/etc/rpm/platform <<"EOF"
i686-pc-linuxgnu
.*
EOF

where line should be the equivalent of
rpm --eval '%{_target_cpu}-%{_target_vendor}-%{_target_os}%{?_gnu}'

It was my understanding that this should have been sufficient to achieve an archscore match, however
python -c 'import rpm; print rpm.archscore("i686")' still reported '0' as in no match,

adding '.*' gave me an archscore of 2, ( for 2 matching lines ) . So rpm-python is a little buggy ?

Anders F Björklund (afb) wrote :

Yeah, rpm-python in 5.0.3/5.1.9/5.2.1 is buggy in that it doesn't add %{?_gnu} to the CVOG platform.

So the check there is done with: rpm.platformscore(rpm.expandMacro(arch + "-%{_vendor}-%{_os}"))

That is Bug #587448, but doesn't apply on i386-redhat-linux or i386-apple-darwin where %_gnu is %nil

The missing rpm.archscore *should* have been caught by the rpmbase test, but maybe needs explicit ?

FAIL: test_sorting_arch_used_when_same_version (tests.rpmbase.RPMPackageTest)

Refactoring of archscore also adds a lookup cache, to avoid going to rpm module for each comparison...

But the recommended setup of /etc/rpm/platform is to make it cope with any vendor and any gnu/version.

Changed in smart:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments