Author Topic: rpmbuild -bb kernel-pclos.spec fails  (Read 2257 times)

Offline apavloma

  • New Friend
  • *
  • Posts: 6
rpmbuild -bb kernel-pclos.spec fails
« on: November 30, 2011, 12:22:19 AM »
Hi,

I recently tried to rebuild kernel-2.6.38.8-pclos3.bfs and encountered the following error:

+ /usr/share/spec-helper/translate_menu
+ '[' -n '' ']'
+ /usr/share/spec-helper/fix_pamd
+ '[' -n '' ']'
+ /usr/share/spec-helper/remove_info_dir
+ '[' -n '' ']'
+ /usr/share/spec-helper/fix_eol
+ DONT_STRIP=
+ /usr/share/spec-helper/check_elf_files
Processing files: kernel-2.6.38.8-pclos3-1-1pclos2011.i586
Finding  Provides: /usr/lib/rpm/mandriva/filter.sh ' ' ' ' '/root/rpmbuild/BUILDROOT/kernel-2.6.38.8-pclos3-1-1pclos2011.i386' /usr/lib/rpm/mandriva/find-provides
error: line 1044: Illegal char '[' in:

error: Failed to find Provides:
Provides: kernel = 2.6.38.8-pclos3 alsa = 1.0.20 should-restart = system dkms-ndiswrapper dkms-lzma dkms-squashfs-lzma kmod(3c359) kmod(3c501) kmod(3c503) kmod(3c505) kmod(3c507) kmod(3c509) kmod(3c515) = 0.99t kmod(3c574_cs) kmod(3c589_cs) kmod(3c59x) kmod(3w-9xxx) = 2.26.02.014 kmod(3w-sas) = 3.26.02.000 kmod(3w-xxxx) = 1.26.02.003 kmod(6pack) kmod(8021q) = 1.8 kmod(8139cp) = 1.3 kmod(8139too) = 0.9.28 kmod(8255) kmod(82596) kmod(8390) kmod(8390p) kmod(9p) kmod(9pnet) kmod(9pnet_rdma) kmod(9pnet_virtio) kmod(a100u2w) kmod(a3d)
Requires(interp): /bin/sh /bin/sh /bin/sh
Requires(rpmlib): rpmlib(VersionedDependencies) <= 3.0.3-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Requires(post): /bin/sh
Requires(preun): /bin/sh
Requires(postun): /bin/sh
Conflicts: dkms-crystalhd < 0-0.20100702.2 dkms-psb < 4.41.1-2 dkms-sn9c20x < 20100330-2 dkms-rt3090 < 2.1.0.0-2 dkms-r8192se < 0015.0127.2010-2 dkms-virtualbox < 3.2.12-2 dkms-vboxadditions < 3.2.12-2 arch(x86_64)


RPM build errors:
    line 1044: Illegal char '[' in:

    Failed to find Provides:
(wd now: ~/rpmbuild/SPECS)

I then tried to rebuild a custom kernel that I had created in the past and found it generated the same error ie.

line 1044: Illegal char '[' in:

I was unsure if my build environment was broken so I downloaded pclinuxos-kde-2011.09.iso, installed it onto a fresh
computer and performed the following steps:

- added the unstable repository and used synaptic to install rpm-build (otherwise no rpmbuild command)
- downloaded kernel-2.6.38.8-pclos3-1-1pclos2011.nosrc.rpm
- rpm -Uvh kernel-2.6.38.8-pclos3-1-1pclos2011.nosrc.rpm
- cd /root/rpmbuild/SPECS
- rpmbuild -bb kernel-pclos.spec

and received the same error that occurred on my original computer.

I suspect it has something to do with the change from rpm 4.4.6 to 4.8.1 and perhaps spec-helper.

Kinda stuck at the moment, can anyone assist me?

Offline kjpetrie

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3992
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #1 on: November 30, 2011, 04:54:32 AM »
Are you trying to build new kernel-related packages or just compile a custom kernel?

For the latter, you need the kernel-source "binary" rpm.
-----------
KJP
-----------------------------------------------------------
PClos64 RC1 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG (with custom kernel) and Asus eeePC 2G surf

Offline apavloma

  • New Friend
  • *
  • Posts: 6
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #2 on: November 30, 2011, 05:37:02 AM »
Right now I'm just trying to build the stock 2.6.38.8 kernel that comes with PCLOS
but I'm stuck because rpmbuild fails to complete.

Once rpmbuild finishes building the stock 2.6.38.8 kernel I'll apply my patches that will give me
a custom kernel with the following modifications:

- support for some older CPUs (either the VIA Nehemiah / VIA Samuel 2, cant remember which)
- support for 28 UARTS
- allow a normal process access to the UART custom divisor (need to use 12800 baud)

Offline kjpetrie

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3992
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #3 on: November 30, 2011, 11:14:02 AM »
Then you don't need the SRPM and a build environment. What you need is to go into Synaptic and install the kernel-source package. Then you navigate to /usr/src/linux-2.6.38.8/, su to root, apply your patches, make menuconfig, make, make modules_install, make install, check your links in /boot and remake them if necessary, and reboot.
-----------
KJP
-----------------------------------------------------------
PClos64 RC1 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG (with custom kernel) and Asus eeePC 2G surf

Offline apavloma

  • New Friend
  • *
  • Posts: 6
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #4 on: November 30, 2011, 12:04:46 PM »
Thanks for your reply but I do want to build an RPM so I can install this custom kernel on multiple machines.

My question is why does "rpmbuild -bb kernel-pclos.spec" for
kernel-2.6.38.8-pclos3-1-1pclos2011.nosrc.rpm fail with the error

line 1044: Illegal char '[' in:

even on a freshly built pclinuxos-kde-2011.09.iso system?

Or should I be asking this question in a different part of the forum? If so, please let me know where.

Thanks for your help in advance.
« Last Edit: November 30, 2011, 01:36:53 PM by apavloma »

Offline apavloma

  • New Friend
  • *
  • Posts: 6
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #5 on: December 01, 2011, 03:43:25 AM »
I was able to successfully build the 2.6.38.8 RPMs on an older machine that has not yet had its RPMs updated. This machine has:

rpm-4.4.6-18pclos2007
rpm-pclinuxos-setup-build-1.30-3pclos2010

I can now build my custom kernel but I also did some investigation on the up to date machine. From the error message:

Illegal char '[' in:

I intercepted what was sent to /usr/lib/rpm/mandriva/find-provides and found the following input
contained a '[':

kmod(a100u2w)
kmod(a3d)
kmod(aacraid) = 1.1-5[26400]-ms
kmod(abituguru)
kmod(abituguru3)

I don't think this issue is solved but I have a workaround that will let me move forwards.

Offline AS

  • Hero Member
  • *****
  • Posts: 4111
  • Have a nice ... night!
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #6 on: December 01, 2011, 09:06:55 AM »
rpm-4.4.6-18pclos2007


 ???

rpm -qa | grep rpm:
Quote
rpm-4.8.1-4pclos2011

search the forum for aptupgrade;)

Offline apavloma

  • New Friend
  • *
  • Posts: 6
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #7 on: December 01, 2011, 02:05:31 PM »
I think my previous post was a little unclear, let me try to explain again:

rpm -q rpm -> rpm-4.4.6-18pclos2007 ( SUCCESSFULLY BUILDS kernel-2.6.38.8 )
rpm -q rpm -> rpm-4.8.1-4pclos2011 ( FAILS TO BUILD kernel-2.6.38.8, error '[' )

I can successfully build kernel-2.6.38.8 on an old out of date PCLOS system that has rpm-4.4.6-18pclos2007. Command used is "rpmbuild -bb kernel-pclos.spec".

I cannot successfully build kernel-2.6.38.8 on an up to date PCLOS system that has rpm-4.8.1-4pclos2011.  Command used is "rpmbuild -bb kernel-pclos.spec".

I have tried building kernel-2.6.38.8 on THREE PCLOS systems which are up to date and have rpm-4.8.1-4pclos2011. Two have been through the aptupgrade process, one was a fresh install from pclinuxos-kde-2011.09.iso specifically built to test this issue. All three up to date systems failed.

I tried building kernel-2.6.38.8 on ONE old out of date PCLOS system which has rpm-4.4.6-18pclos2007. This ONE old system was successful.

I'm kinda certain that if I aptupgrade my out of date WORKING system I will end up with an up to date system that will NOT be able to build kernel-2.6.38.8.
« Last Edit: December 01, 2011, 02:24:11 PM by apavloma »

Offline AS

  • Hero Member
  • *****
  • Posts: 4111
  • Have a nice ... night!
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #8 on: March 05, 2012, 02:54:37 PM »
The issue has been tracked down. The solution is actually under evaluation, expect this fixed very soon!  ;)

AS

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8590
  • Aurum nostrum non est aurum vulgi.
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #9 on: March 05, 2012, 03:02:24 PM »
Thumbs up, AS! YAY!
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline pinoc

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2845
    • other projects...
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #10 on: March 06, 2012, 01:46:19 AM »
The issue has been tracked down. The solution is actually under evaluation, expect this fixed very soon!  ;)

AS

awesome news AS! Curious to hear what caused this flaw.  ;)

Offline AS

  • Hero Member
  • *****
  • Posts: 4111
  • Have a nice ... night!
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #11 on: March 06, 2012, 04:25:24 AM »
The issue has been tracked down. The solution is actually under evaluation, expect this fixed very soon!  ;)

AS

awesome news AS! Curious to hear what caused this flaw.  ;)

I'm not sure about the 'cause', because there has been several changes at the same time when we switched from rpm-4.4.6 to rpm-4.8.1.

Anyway, the issue is that some special chars aren't valid chars to be used from rpmbuild, notably '['   and ']'.

Another hint was provided from apavloma:
I intercepted what was sent to /usr/lib/rpm/mandriva/find-provides and found the following input
contained a '[':

kmod(a100u2w)
kmod(a3d)
kmod(aacraid) = 1.1-5[26400]-ms
kmod(abituguru)
kmod(abituguru3)

Then I went a bit further: /usr/lib/rpm/mandriva/find-provides call a bunch of similar scripts, one of them is:
/usr/lib/rpm/mandriva/kmod.prov, which is the script that generate the version as in "= 1.1-5[26400]-ms",
From a practical point of view, the square brackets are invalid characters, and cannot be supplied as input for rpmbuild.

Now the question is (still unaswered) who is wrong in this extended chain ?
a) who wrote the driver aacraid specifying a version string containing square brackets ?
b) the script kmod.prov should filters those square brackets ?
c) the script find-provides should filters those square brackets ?
d) those scripts "find-provides" should be not used at all, and instead should be used "rpmdeps --provides" ?

Right now I have applied an easy workaround: to filter out the square brackets, applied to kmod.prov, but I'm nearly sure  that this is not enough to satisfy RPM dependency mechanism.

Quote
#!/bin/sh

provideslist=`sed "s/['\"]/\\\&/g"`
modulelist=$(echo "$provideslist" | egrep '^.*(/lib/modules/|/var/lib/dkms/).*\.ko(\.gz)?$')
echo $modulelist | xargs -r /sbin/modinfo | \
        perl -lne '
$name = $1 if m!^filename:\s*(?:.*/)?([^/]+)\.k?o!;
$ver = $1 if /^version:\s*[a-zA-Z]{0,6}\-?(\d+[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*-?[a-zA-Z]{0,6}\d?).*/;
 if (/^vermagic:/) {
   print "kmod\($name\)" . ($ver ? " = $ver" : "") if $name;
   undef $name; undef $ver;
}
' | tr "\[\]" ".."
# the above 'tr' is a workaround by AS to avoid find-provides failure while building kernels
dkmslist=$(echo "$provideslist" | egrep '(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf$')
[ -n "$dkmslist" ] && for d in $dkmslist; do
    VERSION=`sed -rne 's/^PACKAGE_VERSION="?([^"]+)"?$/\1/;T;p' $d`
    [ -z "$VERSION" ] && continue
    PACKAGE_NAME=`sed -rne 's/^PACKAGE_NAME="?([^"]+)"?$/\1/;T;p' $d`
    MODULES=`sed -rne 's/^DEST_MODULE_NAME\[[0-9]+\]="?([^"]+)"?$/\1/;T;p' $d`
    [ -z "$MODULES" ] && MODULES=`sed -rne 's/^BUILT_MODULE_NAME\[[0-9]+\]="?([^"]+)"?$/\1/;T;p' $d`
    # default on PACKAGE_NAME if no BUILT_MODULE_NAME is specified
    [ -z "$MODULES" ] && MODULES=$PACKAGE_NAME
    echo "$MODULES" | sed -re "s/\\\$PACKAGE_NAME/$PACKAGE_NAME/" | while read m; do
        echo "kmod($m) = $VERSION"
    done
done

There is also to say that the perl expression, colored blue-navy, may be should filter out those characters, my knowledge of perl is not so advanced to properly evaluate that "insane" expression.   ;)

AS
« Last Edit: March 06, 2012, 11:55:23 AM by AS »

Offline kjpetrie

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3992
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #12 on: March 06, 2012, 05:07:46 AM »
The answer to your final question is to add the line "$ver=~tr/][/../;" below the navy blue one.

I presume the makefile will have to be patched to expect the translated version.

I wonder why rpm decided to impose this limitation and what their official workaround is, as it can't be just a pclos problem.

Or is aacraid provided by a patch we shouldn't use anymore?
« Last Edit: March 06, 2012, 05:15:35 AM by kjpetrie »
-----------
KJP
-----------------------------------------------------------
PClos64 RC1 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG (with custom kernel) and Asus eeePC 2G surf

Offline AS

  • Hero Member
  • *****
  • Posts: 4111
  • Have a nice ... night!
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #13 on: March 06, 2012, 06:10:21 AM »
The answer to your final question is to add the line "$ver=~tr/][/../;" below the navy blue one.
Thank you, that's surely more efficient!  :)

Quote
I presume the makefile will have to be patched to expect the translated version.
No, the error happen at build rpm stage, exactly when searching for "Provides" references, at that time compilation has been already completed successfully. As far as I understood find-provides is called directly from rpmbuild, passing thru the evaluations of the rpm macros ... most likely the involved package is rpm-pclinuxos-setup-1.134-3pclos2011 .. and that is specific to PCLinuxOS.

Quote
I wonder why rpm decided to impose this limitation and what their official workaround is, as it can't be just a pclos problem.
As I wrote above, some distro doesn't use the scripts find-provides anymore ... as they are using "rpmdeps --provides", I found on the net comment like "find-provides has not been used from ages ..." (of course ages is relative when speaking of bleeding edge distros ...  :D )

Quote
Or is aacraid provided by a patch we shouldn't use anymore?

actually is 'as provided from vanilla kernel', in fact I could replicate the same issue both using 2.6.38.8-pclos3 and using a vanilla 3.2.x.
Certainly patching the aacraid source could be a possible alternate solution ...

Offline kjpetrie

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3992
Re: rpmbuild -bb kernel-pclos.spec fails
« Reply #14 on: March 07, 2012, 06:09:39 AM »
In that case, I'd try dumping the bit in brackets altogether. It's presumably a build number, and I'd expect major and minor version to be enough, especially given that pclos controls what is provided anyway. Replace the line I gave with "$ver=~s/\[.+$//;" to cut the opening bracket and all that follows.

In fact, no current packages in the repo provide "kmod(a" at all. Very few provide "kmod(", so it doesn't look as if this is much used anyway.
-----------
KJP
-----------------------------------------------------------
PClos64 RC1 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG (with custom kernel) and Asus eeePC 2G surf