On 8/1/06, Michael Schwendt <bugs.michael@xxxxxxx> wrote:
On Tue, 1 Aug 2006 19:55:56 +0200, Axel Liljencrantz wrote: > On 8/1/06, Hans de Goede <j.w.r.degoede@xxxxxxx> wrote: > > > > > > > > Look at e.g. > > > > > > http://roo.no-ip.org/fish/darcs/fish.spec > > > > > > can you honestly say that 'nobody could understand the spec'? > > > > I understand it, but I concider myself not the average packagers and > > even for me it hurts my eyes. I know the only conditional stuff in there > > are the X-requires but thats a 3 times nested if. Now as a C-programmer > > I generally try to avoid nested conditional statements more then 2 > > levels deep, for a spec file 3 levels of nesting is just wrong. > > > > So I think your example actually makes a strong point for those > > objecting to one spec for all. > > Then we must simply agree to disagree. Strongly. > > As a C programmer, I try to avoid tripple-nested if-statements, but > duplicating 200 lines of code N times (where N is currently 4, but can > potentially be a large number) simply because 1-2 lines differ between > versions is an order of magnitude worse. Much nicer to the eyes: # Locate correct build time-dependencies for providing X headers %if "%fedora" >= "5" # Modern Fedora version, has modular X.org BuildRequires: xorg-x11-proto-devel libX11-devel libXt-devel %endif %if "%fedora" < "5" %if "%fedora" >= "3" # Semi-old Fedora version, has non-modular X.org BuildRequires: xorg-x11-devel %endif %endif %if "%fedora" < "3" # Ancient Fedora version, has XFree86 BuildRequires: XFree86-devel %endif %if 0%{!?fedora} # This is not a Fedora system, try guessing BuildRequires by # looking at the directory structure %define xinclude /usr%(if [ -d /usr/X11R6/include ]; then echo /X11R6; fi)/inclu de BuildRequires: %{xinclude}/X11/StringDefs.h, %{xinclude}/X11/Xlib.h BuildRequires: %{xinclude}/X11/Intrinsic.h, %{xinclude}/X11/Xatom.h %endif
True. Though a bit wordier, it is easier on the eyes and removes the tripple-nesting argument. I'll probably update the spec file. What one really wants, though, is conditional requires. I belive .deb files support something like: BuildRequires: xorg-x11-devel || XFree86-devel || (xorg-x11-proto-devel && libX11-devel && libXt-devel) That would solve the problem in a very neat way.
-- fedora-extras-list mailing list fedora-extras-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-extras-list
-- Axel -- fedora-extras-list mailing list fedora-extras-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-extras-list