grep doesn't like ./ in pathnames

Have a question about our Software Developer Kit? Ask them here.

Re: grep doesn't like ./ in pathnames

Postby nexus » Tue Mar 13, 2012 12:36 pm

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
nexus
Beta Tester
Beta Tester
 
Posts: 347
Joined: Mon Dec 20, 2010 3:11 pm
Location: Germany

Re: grep doesn't like ./ in pathnames

Postby Raziel » Wed Mar 14, 2012 6:04 pm

@nexus

With your line added i get
Makefile.common:158: *** Recursive variable `srcdir' references itself (eventually). Stop.
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
User avatar
Raziel
 
Posts: 925
Joined: Sat Jun 18, 2011 5:00 pm
Location: a story that hasn't been written yet

Re: grep doesn't like ./ in pathnames

Postby nexus » Wed Mar 14, 2012 6:30 pm

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
nexus
Beta Tester
Beta Tester
 
Posts: 347
Joined: Mon Dec 20, 2010 3:11 pm
Location: Germany

Re: grep doesn't like ./ in pathnames

Postby Raziel » Wed Mar 14, 2012 7:14 pm

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
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
User avatar
Raziel
 
Posts: 925
Joined: Sat Jun 18, 2011 5:00 pm
Location: a story that hasn't been written yet

Re: grep doesn't like ./ in pathnames

Postby broadblues » Thu Mar 15, 2012 11:26 pm

/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: 591
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: grep doesn't like ./ in pathnames

Postby broadblues » Thu Mar 15, 2012 11:29 pm

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
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 591
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: grep doesn't like ./ in pathnames

Postby Raziel » Fri Mar 16, 2012 7:42 pm

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)
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
User avatar
Raziel
 
Posts: 925
Joined: Sat Jun 18, 2011 5:00 pm
Location: a story that hasn't been written yet

Re: grep doesn't like ./ in pathnames

Postby Raziel » Mon Mar 19, 2012 4:35 pm

@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? :-/
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
User avatar
Raziel
 
Posts: 925
Joined: Sat Jun 18, 2011 5:00 pm
Location: a story that hasn't been written yet

Re: grep doesn't like ./ in pathnames

Postby Slayer » Wed Mar 21, 2012 6:55 am

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
Slayer
Beta Tester
Beta Tester
 
Posts: 851
Joined: Tue Dec 21, 2010 5:19 am
Location: New Zealand

Re: grep doesn't like ./ in pathnames

Postby Raziel » Wed Mar 21, 2012 2:37 pm

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
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
User avatar
Raziel
 
Posts: 925
Joined: Sat Jun 18, 2011 5:00 pm
Location: a story that hasn't been written yet

PreviousNext

Return to SDK Support

Who is online

Users browsing this forum: No registered users and 1 guest