grep doesn't like ./ in pathnames

Have a question about our Software Developer Kit? Ask them here.
User avatar
nexus
Beta Tester
Beta Tester
Posts: 347
Joined: Mon Dec 20, 2010 2:11 pm
Location: Germany

Re: grep doesn't like ./ in pathnames

Post by nexus »

Raziel wrote:There you go
VERSION = $(shell grep SCUMMVM_VERSION "${srcdir}/base/internal_version.h" | cut -d\" -f2)
doesn´t work.

You can try the line
grep SCUMMVM_VERSION "./base/internal_version.h"
in abc-shell.

The {srcdir} part will always be translated into "." at least for me, which won´t work then.

You can find internal_version.h here
ok, I'm not at my Amiga, so I'm not sure if this shell command exists (but I think so):
You may try to first translate the "." or ${srcdir} to its real path, i.e.

srcdir=`realpath "${srcdir}"`
VERSION = $(shell grep SCUMMVM_VERSION "${srcdir}/base/internal_version.h" | cut -d\" -f2)

cheers,
nexus
User avatar
Raziel
Posts: 1170
Joined: Sat Jun 18, 2011 4:00 pm
Location: a dying planet

Re: grep doesn't like ./ in pathnames

Post by Raziel »

@nexus

With your line added i get
Makefile.common:158: *** Recursive variable `srcdir' references itself (eventually). Stop.
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
User avatar
nexus
Beta Tester
Beta Tester
Posts: 347
Joined: Mon Dec 20, 2010 2:11 pm
Location: Germany

Re: grep doesn't like ./ in pathnames

Post by nexus »

Raziel wrote:@nexus

With your line added i get
Makefile.common:158: *** Recursive variable `srcdir' references itself (eventually). Stop.
interesting. then maybe u should use a different variable name:

pathsrcdir=`realpath "${srcdir}"`
VERSION = $(shell grep SCUMMVM_VERSION "${pathsrcdir}/base/internal_version.h" | cut -d\" -f2)
User avatar
Raziel
Posts: 1170
Joined: Sat Jun 18, 2011 4:00 pm
Location: a dying planet

Re: grep doesn't like ./ in pathnames

Post by Raziel »

If i put the pathsrc = line
Makefile.common:210: *** target pattern contains no `%'. Stop.
The line where it breaks is
$(VERFILE): $(pathsrcdir)/base/internal_version.h
as you can see i already changed the srcdir to pathsrcdir, but it doesn't matter, it breaks whatever i use.

So, still no game
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: grep doesn't like ./ in pathnames

Post by broadblues »

/RAM Disk>grep SCUMMVM_VERSION "./base/internal_version.h" | cut -d\" -f2
1.5.0git
/RAM Disk>

The issue is not with grep it's working fine.

Hence the issue must be happening higher up the food chain.

/RAM Disk>export FOO=$(grep SCUMMVM_VERSION "./base/internal_version.h" | cut -d\" -f2)
/RAM Disk>echo $FOO
1.5.0git

That also works.

#!/bin/sh

VERSION=$(grep SCUMMVM_VERSION "./base/internal_version.h" | cut -d\" -f2)
echo $VERSION

saved as test.sh

/RAM Disk>test.sh
1.5.0git
/RAM Disk>

So far all simple examples work for me

Just to check again

I have


/RAM Disk>which grep
Programing:SDK/local/C/grep
/RAM Disk>ls -l Programing:SDK/local/C/grep
-rwxrwxrwx 1 root wheel 370066 2009-08-15 23:55 Programing:SDK/local/C/grep
/RAM Disk>grep --version
GNU grep 2.5.4

Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

/RAM Disk>which sh
Programing:SDK/C/sh
/RAM Disk>ls -l Programing:SDK/C/sh
-rwxr-xr-x 1 root wheel 384520 2011-11-08 16:08 Programing:SDK/C/sh
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: grep doesn't like ./ in pathnames

Post by broadblues »

BTW you never did say what the error was you just said "grep can't handle ....."

Can you run the original failing configure and post the output here?
User avatar
Raziel
Posts: 1170
Joined: Sat Jun 18, 2011 4:00 pm
Location: a dying planet

Re: grep doesn't like ./ in pathnames

Post by Raziel »

broadblues wrote:BTW you never did say what the error was you just said "grep can't handle ....."

Can you run the original failing configure and post the output here?
True...sorry about that

i get
Makefile.common:190: *** target pattern contains no `%'. Stop.
when i run configure and afterwards try to build with make (make throws the erro)r.

Using the command like in makefile.common "by hand" in the dir structure and with the programs the program is (ScummVM) i really do get a non functioning command in which i can´t extract the version number.
Can´t remember if there is an error message or if it simply prints nothing (empty string)
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
User avatar
Raziel
Posts: 1170
Joined: Sat Jun 18, 2011 4:00 pm
Location: a dying planet

Re: grep doesn't like ./ in pathnames

Post by Raziel »

@broadblues

There seems to be something wrong in my installation?

Ram Disk:> grep "hid" ./T/usb.log | cut -d\| -f2

I get
SDK:Local/C/grep: ./T/usb.log: No such file or directory
in both cases (being in AmigaShell or in abc-shell) but the file is obviously there.

grep --version
GNU grep 2.5.4

Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

which sh
Development:Coding/SDK/C/sh

version sh
abc-shell 53.2 (02.02.2009)

Help? :-/
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
User avatar
Slayer
Beta Tester
Beta Tester
Posts: 851
Joined: Tue Dec 21, 2010 4:19 am
Location: New Zealand

Re: grep doesn't like ./ in pathnames

Post by Slayer »

I know I abandoned this thread a while back but are you sure abc shell is acting correctly if you don't type sh first to drop into the actual shell?

Earlier in this thread someone pointed out that the | operator didn't work outside /Ram Disk/ eg Ram Disk:

I know that's the second part of your commandline but worth mentioning, I'm thinking you might have just typed Ram Disk:> instead of /Ram Disk

Some people insist it doesn't matter but for the sake of type sh first ;)
~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
User avatar
Raziel
Posts: 1170
Joined: Sat Jun 18, 2011 4:00 pm
Location: a dying planet

Re: grep doesn't like ./ in pathnames

Post by Raziel »

Slayer wrote:I know I abandoned this thread a while back but are you sure abc shell is acting correctly if you don't type sh first to drop into the actual shell?

Earlier in this thread someone pointed out that the | operator didn't work outside /Ram Disk/ eg Ram Disk:

I know that's the second part of your commandline but worth mentioning, I'm thinking you might have just typed Ram Disk:> instead of /Ram Disk

Some people insist it doesn't matter but for the sake of type sh first ;)
I tried both shells...AmigaShell and typing sh in AmigaShell (abc-shell)

Both with the same outcome, see my last post
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Post Reply