Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nested ifeq in debian/rules (makefile)

1,195 views
Skip to first unread message

Richard Ulrich

unread,
Mar 2, 2011, 4:50:01 PM3/2/11
to
Hi,

I'm new to debian mentors. A while ago I read a blog article about how
to use only one branch for debian and ubuntu packages with different
dependencies.
http://raphaelhertzog.com/2010/09/27/different-dependencies-between-debian-and-ubuntu-but-common-source-package/
I tried to implement it, but I'm struggling.

Essentially, I'm not familiar with makefile syntax, and searching
makefile tutorials and asking in IRC chats helped, but couldn't fully
solve the problems I faced.
So, I hope the experts here can help find a good solution.

Here is what I have so far:
http://flightpred.svn.sourceforge.net/viewvc/flightpred/trunk/debian/rules?revision=297

But it basically boils down to the following behavior, which I don't
understand:


$ cat makefile
all:
@echo $(shell [ -e /etc/dpkg/origins/default ]; printf $$?)
@echo $(shell [ -e /etc/dpkg/origins/dabadabadu ]; printf $$?)
@echo $(shell [ ! -e /etc/dpkg/origins/default ]; printf $$?)
@echo $(shell [ ! -e /etc/dpkg/origins/dabadabadu ]; printf $$?)

ifeq ( $(shell [ -e /etc/dpkg/origins/default ]; printf $$?), 0)
ifeq ( $(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)
@echo "ubuntu maverick"
else
@echo "debian squeeze"
endif
else
@echo "debian lenny"
endif

$ make

0
1
1

0
debian lenny

--
To UNSUBSCRIBE, email to debian-ment...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/1299100390.5190.10.camel@quadulrich

Jakub Wilk

unread,
Mar 2, 2011, 6:00:02 PM3/2/11
to
* Richard Ulrich <ri...@paraeasy.ch>, 2011-03-02, 22:13:

>ifeq ( $(shell [ -e /etc/dpkg/origins/default ]; printf $$?), 0)
> ifeq ( $(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)

Remove spaces between "(" and "$".

--
Jakub Wilk


--
To UNSUBSCRIBE, email to debian-ment...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/2011030222...@jwilk.net

Richard Ulrich

unread,
Mar 2, 2011, 6:30:02 PM3/2/11
to
Hi Jakub,

I played around with the spaces a lot. The result was always the same.

ifeq ($(shell[-e /etc/dpkg/origins/default];printf $$?),0)
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)

Rgds
Richard


--
To UNSUBSCRIBE, email to debian-ment...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/1299108560.5190.37.camel@quadulrich

Jakub Wilk

unread,
Mar 2, 2011, 6:40:02 PM3/2/11
to
* Richard Ulrich <ri...@paraeasy.ch>, 2011-03-03, 00:29:

>ifeq ($(shell[-e /etc/dpkg/origins/default];printf $$?),0)

How could this possibly work?

$ [-e /etc/dpkg/origins/default];printf $?
bash: [-e: command not found
127

I didn't tell you to remove space from every place you can think
of, but only two particular ones...

--
Jakub Wilk


--
To UNSUBSCRIBE, email to debian-ment...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/2011030223...@jwilk.net

Joachim Wiedorn

unread,
Mar 2, 2011, 8:10:02 PM3/2/11
to
Richard Ulrich <ri...@paraeasy.ch> wrote on 2011-03-02 22:13:

> ifeq ( $(shell [ -e /etc/dpkg/origins/default ]; printf $$?), 0)
> ifeq ( $(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)
> @echo "ubuntu maverick"
> else
> @echo "debian squeeze"
> endif
> else
> @echo "debian lenny"
> endif


I had the same problem some weeks ago. The solution is:

ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes),yes)
...
endif
ifeq ($(shell dpkg-vendor --is Debian && echo yes),yes)
...
endif

---
Have a nice day.

Joachim (Germany)


--
To UNSUBSCRIBE, email to debian-ment...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/20110303020...@jupiter.home

Richard Ulrich

unread,
Mar 3, 2011, 4:40:01 AM3/3/11
to
Hi Joachim,

dpk-vendor checks the contents of /etc/dpkg/origins/default.
Both are missing on lenny.
Trying to call (the missing) dpk-vendor on lenny results in an error.
That's the reason I'm checking for file existence.

Rgds
Richard

signature.asc
0 new messages