OBS error : have choice for distribution-release: sles-release sled-release

I’m trying to recompile Cobbler for SLES11sp1. Compilation won’t start and I get the following error message : have choice for distribution-release: sles-release sled-release. Any idea what it means?

The spec file :


%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
#%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

%define _binaries_in_noarch_packages_terminate_build 0
Summary: Boot server configurator
Name: cobbler
License: GPLv2+
AutoReq: no
Version: 2.1.0
Release: 6
Source0: cobbler-%{version}.tar.gz
Source1: vendor-files.tar.bz2
Patch0:  fix-initscript.dif
Patch1:  suse_config.diff
Patch2:  cobbler_web_config.diff
Patch13: users_patch.diff
Patch14: setup_py.diff
Patch15: import_suse_support.diff
Patch16: suse_tftp_root.diff
Patch17: koan_install_tree_fix_for_suse.diff
Patch18: handle-autoyast-XML-files.diff
Patch19: build_iso_for_suse.diff
Patch20: added-SUSE-breed-to-import-webui.diff
Patch21: upstream_patch_tainted_files.diff
Patch22: 0001-render-the-cheetah-template-before-passing-the-XML-t.patch
Patch23: 0002-calculate-meta-data-in-the-XML-file-without-cheetah-.patch
Patch24: 0001-added-autoyast-.-parameter-to-the-ISO-building-code-.patch
#Patch100: importer.diff

Group: Applications/System
Requires: python >= 2.3
%if 0%{?suse_version} >= 1000
Requires: apache2
Requires: apache2-mod_python
Requires: apache2-mod_wsgi
BuildRequires: distribution-release
#Requires: tftp
Requires: syslinux
#BuildRequires: apache2 apache2-mod_python tftp distribution-release
BuildRequires: apache2 apache2-mod_python tftp
%else
Requires: httpd
Requires: tftp-server
Requires: mod_python
%endif

Requires: createrepo
#%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
#Requires: fence-agents
#%endif
#%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
#Requires: genisoimage
#%else
Requires: mkisofs
#%endif
Requires: libyaml-0-2
Requires: python-cheetah
Requires: python-netaddr
Requires: python-simplejson
#%if 0%{?fedora} >= 8
#BuildRequires: python-setuptools-devel
#%else
BuildRequires: python-setuptools
#%endif
Requires: python-urlgrabber
Requires: python-yaml
%if 0%{?suse_version} < 0
BuildRequires: redhat-rpm-config
%endif
Requires: rsync
#%if 0%{?fedora} >= 6 || 0%{?rhel} >= 5
Requires: yum-utils
#%endif

Requires(post):  /sbin/chkconfig
Requires(preun): /sbin/chkconfig

Requires(preun): /sbin/service

%if 0%{?suse_version}
Requires(post): %fillup_prereq %insserv_prereq
Requires(preun): %fillup_prereq %insserv_prereq
Requires(preun): %fillup_prereq %insserv_prereq
%endif
#%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
#%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version:3]" || echo 0)}
#Requires: python(abi) >= %{pyver}
#%endif

BuildRequires: python-yaml
BuildRequires: python-cheetah
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
#BuildArch: noarch
Url: http://fedorahosted.org/cobbler

%description

Cobbler ...

%prep
%setup -q
%setup -a1
%if 0%{suse_version}
%patch0
%patch1
%patch2
%endif
%patch13
%patch14
%patch15 -p1
%patch16
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
#%patch100
mv vendor-files/cobbler.1.gz docs

%build
%{__python} setup.py build 

%install
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%if 0%{?suse_version} >= 1000
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/SuSEfirewall2.d
mv vendor-files/cobbler_firewall_settings $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/cobbler
PREFIX="--prefix=/usr"
mkdir -p $RPM_BUILD_ROOT/etc/apache2/vhosts.d
mkdir -p $RPM_BUILD_ROOT/srv/www/logs
%endif
%{__python} setup.py install --optimize=1 --root=$RPM_BUILD_ROOT $PREFIX
mkdir -p $RPM_BUILD_ROOT/usr/sbin
ln -sf ../../etc/init.d/cobblerd $RPM_BUILD_ROOT/usr/sbin/rccobblerd
#%if 0%{?suse_version} >= 1000
#mv $RPM_BUILD_ROOT/etc/httpd/conf.d/* $RPM_BUILD_ROOT/etc/apache2/vhosts.d/
#%endif

%post
if  "$1" = "1" ];
then
    # This happens upon initial install. Upgrades will follow the next else
    %if 0%{?suse_version}
        %{fillup_and_insserv cobblerd}
        sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES proxy
        sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES python
        sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES proxy_http
        sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES proxy_connect
        sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES wsgi
    %else
        /sbin/chkconfig --add cobblerd
    %endif

elif  "$1" -ge "2" ];
then
    # backup config
    if  -e /var/lib/cobbler/distros ]; then
        cp /var/lib/cobbler/distros*  /var/lib/cobbler/backup 2>/dev/null
        cp /var/lib/cobbler/profiles* /var/lib/cobbler/backup 2>/dev/null
        cp /var/lib/cobbler/systems*  /var/lib/cobbler/backup 2>/dev/null
        cp /var/lib/cobbler/repos*    /var/lib/cobbler/backup 2>/dev/null
        cp /var/lib/cobbler/networks* /var/lib/cobbler/backup 2>/dev/null
    fi
    if  -e /var/lib/cobbler/config ]; then
        cp -a /var/lib/cobbler/config    /var/lib/cobbler/backup 2>/dev/null
    fi
    # upgrade older installs
    # move power and pxe-templates from /etc/cobbler, backup new templates to *.rpmnew
    for n in power pxe; do
      rm -f /etc/cobbler/$n*.rpmnew
      find /etc/cobbler -maxdepth 1 -name "$n*" -type f | while read f; do
        newf=/etc/cobbler/$n/`basename $f`
         -e $newf ] &&  mv $newf $newf.rpmnew
        mv $f $newf
      done
    done
    # upgrade older installs
    # copy kickstarts from /etc/cobbler to /var/lib/cobbler/kickstarts
    rm -f /etc/cobbler/*.ks.rpmnew
    find /etc/cobbler -maxdepth 1 -name "*.ks" -type f | while read f; do
      newf=/var/lib/cobbler/kickstarts/`basename $f`
       -e $newf ] &&  mv $newf $newf.rpmnew
      cp $f $newf
    done
    # reserialize and restart
    # FIXIT: ?????
    #/usr/bin/cobbler reserialize
    /sbin/service cobblerd condrestart
fi

%if 0%{?suse_version}

%preun
%stop_on_removal cobblerd

%postun
%restart_on_update cobblerd

%else

%preun
if  $1 = 0 ]; then
    /sbin/service cobblerd stop >/dev/null 2>&1 || :
    chkconfig --del cobblerd || :
fi

%postun
if  "$1" -ge "1" ]; then
    /sbin/service cobblerd condrestart >/dev/null 2>&1 || :
    /sbin/service apache2 condrestart >/dev/null 2>&1 || :
fi

%endif

%clean
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT

%files

%if 0%{suse_version} > 1120
%defattr(755,root,root)
%dir /%{_sysconfdir}/sysconfig/SuSEfirewall2.d
%endif
%if 0%{suse_version}
%defattr(755,root,root)
%dir /%{_sysconfdir}/sysconfig/SuSEfirewall2.d/cobbler
%defattr(755,wwwrun,www)
%else
%defattr(755,apache,apache)
%endif
%dir /srv/www/cobbler/svc/
/srv/www/cobbler/svc/*
%{_sbindir}/rccobblerd

%defattr(755,root,root)
%dir /usr/share/cobbler
%dir /usr/share/cobbler/installer_templates
%defattr(744,root,root)
%defattr(744,root,root)
#%defattr(755,apache,apache)               (MOVED to cobbler-web)
#%dir /usr/share/cobbler/webui_templates   (MOVED to cobbler-web)
#%defattr(444,apache,apache)               (MOVED to cobbler-web)
#/usr/share/cobbler/webui_templates/*.tmpl (MOVED to cobbler-web)

%defattr(755,root,root)
%dir /var/log/cobbler
%dir /var/log/cobbler/tasks
%dir /var/log/cobbler/kicklog
%if 0%{suse_version}
%defattr(755,wwwrun,www)
%else
%defattr(755,apache,apache)
%endif
%dir /srv/www/cobbler/
%dir /srv/www/cobbler/localmirror
%dir /srv/www/cobbler/repo_mirror
%dir /srv/www/cobbler/ks_mirror
%dir /srv/www/cobbler/ks_mirror/config
%dir /srv/www/cobbler/links
#%dir /var/www/cobbler/webui (MOVED to cobbler-web)
%dir /srv/www/cobbler/aux
%if 0%{suse_version}
%defattr(444,wwwrun,www)
%else
%defattr(444,apache,apache)
%endif
#/var/www/cobbler/webui/*    (MOVED TO cobbler-web)
/srv/www/cobbler/aux/anamon
/srv/www/cobbler/aux/anamon.init

%defattr(755,root,root)
%{_bindir}/cobbler
%{_bindir}/cobbler-ext-nodes
%{_bindir}/cobblerd

%defattr(-,root,root)
%dir /etc/cobbler
%dir /etc/cobbler/pxe
%dir /etc/cobbler/reporting
%dir /etc/cobbler/power
%config(noreplace) /var/lib/cobbler/kickstarts/*.ks
%config(noreplace) /var/lib/cobbler/kickstarts/*.xml
%config(noreplace) /var/lib/cobbler/kickstarts/*.seed
%config(noreplace) /etc/cobbler/*.template
%config(noreplace) /etc/cobbler/pxe/*.template
%config(noreplace) /etc/cobbler/reporting/*.template
%config(noreplace) /etc/cobbler/power/*.template
%config(noreplace) /etc/cobbler/rsync.exclude
#%config(noreplace) /etc/logrotate.d/cobblerd_rotate
%config(noreplace) /etc/cobbler/modules.conf
%config(noreplace) /etc/cobbler/users.conf
%config(noreplace) /etc/cobbler/cheetah_macros

# new in 2.1.0
%config(noreplace)   /etc/cobbler/auth.conf
%config(noreplace)   /etc/cobbler/cobbler.conf
%config(noreplace)   /etc/cobbler/cobbler_bash
%config(noreplace)   /etc/cobbler/cobbler_web.conf
%config(noreplace)   /etc/cobbler/cobblerd
%config(noreplace)   /etc/cobbler/cobblerd_rotate
%config(noreplace)   /etc/cobbler/completions
%dir                 /etc/cobbler/ldap
%config(noreplace)   /etc/cobbler/ldap/ldap_authconfig.template
%config(noreplace)   /etc/cobbler/version

%{_sbindir}/tftpd.py


%dir %{python_sitelib}/cobbler
%dir %{python_sitelib}/cobbler/modules
%{python_sitelib}/cobbler/*.py*
#%{python_sitelib}/cobbler/server/*.py*
%{python_sitelib}/cobbler/modules/*.py*
%if 0%{?fedora} >= 9 || 0%{?rhel} >= 5
%exclude %{python_sitelib}/cobbler/sub_process.py*
%endif
%{_mandir}/man1/cobbler.1.gz
/etc/init.d/cobblerd
#%if 0%{?suse_version} >= 1000
%config(noreplace) /etc/apache2/conf.d/cobbler.conf
#%config(noreplace) /etc/apache2/conf.d/cobbler_wsgi.conf
#%else
#%config(noreplace) /etc/httpd/conf.d/cobbler.conf
#%endif
%dir /var/log/cobbler/syslog
%dir /var/log/cobbler/anamon

%defattr(755,root,root)
%dir /var/lib/cobbler
%dir /var/lib/cobbler/config/
%dir /var/lib/cobbler/config/distros.d/
%dir /var/lib/cobbler/config/profiles.d/
%dir /var/lib/cobbler/config/systems.d/
%dir /var/lib/cobbler/config/repos.d/
%dir /var/lib/cobbler/config/images.d/
%dir /var/lib/cobbler/kickstarts/
%dir /var/lib/cobbler/triggers
%dir /var/lib/cobbler/triggers/change
%dir /var/lib/cobbler/triggers/add
%dir /var/lib/cobbler/triggers/add/distro
%dir /var/lib/cobbler/triggers/add/distro/pre
%dir /var/lib/cobbler/triggers/add/distro/post
%dir /var/lib/cobbler/triggers/add/profile
%dir /var/lib/cobbler/triggers/add/profile/pre
%dir /var/lib/cobbler/triggers/add/profile/post
%dir /var/lib/cobbler/triggers/add/system
%dir /var/lib/cobbler/triggers/add/system/pre
%dir /var/lib/cobbler/triggers/add/system/post
%dir /var/lib/cobbler/triggers/add/repo
%dir /var/lib/cobbler/triggers/add/repo/pre
%dir /var/lib/cobbler/triggers/add/repo/post
%dir /var/lib/cobbler/triggers/delete
%dir /var/lib/cobbler/triggers/delete/distro
%dir /var/lib/cobbler/triggers/delete/distro/pre
%dir /var/lib/cobbler/triggers/delete/distro/post
%dir /var/lib/cobbler/triggers/delete/profile
%dir /var/lib/cobbler/triggers/delete/profile/pre
%dir /var/lib/cobbler/triggers/delete/profile/post
%dir /var/lib/cobbler/triggers/delete/system
%dir /var/lib/cobbler/triggers/delete/system/pre
%dir /var/lib/cobbler/triggers/delete/system/post
%dir /var/lib/cobbler/triggers/delete/repo
%dir /var/lib/cobbler/triggers/delete/repo/pre
%dir /var/lib/cobbler/triggers/delete/repo/post
%dir /var/lib/cobbler/triggers/sync
%dir /var/lib/cobbler/triggers/sync/pre
%dir /var/lib/cobbler/triggers/sync/post
%dir /var/lib/cobbler/triggers/install
%dir /var/lib/cobbler/triggers/install/pre
%dir /var/lib/cobbler/triggers/install/post
%dir /var/lib/cobbler/snippets/

%defattr(664,root,root)
%config(noreplace) /etc/cobbler/settings
%config(noreplace) /var/lib/cobbler/snippets/*
%dir %attr(764,root,root)/var/lib/cobbler/loaders
%defattr(660,root,root)
%config(noreplace) /etc/cobbler/users.digest

%defattr(664,root,root)

%defattr(-,root,root)
%{python_sitelib}/cobbler-%{version}-py%{py_ver}.egg-info
%doc AUTHORS CHANGELOG README COPYING

%package -n koan

Summary: Helper tool that performs cobbler orders on remote machines
Group: Applications/System
Requires: python >= 1.5
Requires: python-virtinst
BuildRequires: python-devel
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version:3]")}
Requires: python(abi) >= %{pyver}
%endif
%if 0%{?fedora} >= 8
BuildRequires: python-setuptools-devel
%endif
%if 0%{?rhel} >= 4
BuildRequires: python-setuptools
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
#BuildArch: noarch
Url: http://fedorahosted.org/cobbler/


%description -n koan

Koan ...

%files -n koan
%defattr(-,root,root)
# FIXME: need to generate in setup.py
#%if 0%{?fedora} > 8
#%{python_sitelib}/koan*.egg-info
#%endif
%{_bindir}/koan
%{_bindir}/cobbler-register
%dir %{python_sitelib}/koan
%{python_sitelib}/koan/*.py*
%if 0%{?fedora} >= 9 || 0%{?rhel} >= 5
%exclude %{python_sitelib}/koan/sub_process.py*
%exclude %{python_sitelib}/koan/opt_parse.py*
%exclude %{python_sitelib}/koan/text_wrap.py*
%endif
%{_mandir}/man1/koan.1.gz
%{_mandir}/man1/cobbler-register.1.gz
%dir /var/log/koan
%doc AUTHORS COPYING CHANGELOG README


%package -n cobbler-web

Summary: Web interface for Cobbler
Group: Applications/System
Requires: cobbler
Requires: python-django
BuildRequires: python-devel
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version:3]")}
Requires: python(abi) >= %{pyver}
%endif
%if 0%{?fedora} >= 8
BuildRequires: python-setuptools-devel
%else
BuildRequires: python-setuptools
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
#BuildArch: noarch
Url: http://fedorahosted.org/cobbler/

%description -n cobbler-web

Web interface for Cobbler ...

%files -n cobbler-web
%if 0%{suse_version}
%defattr(-,wwwrun,www)
%else
%defattr(-,apache,apache)
%endif
%dir /usr/share/cobbler/web
/usr/share/cobbler/web/*
%if 0%{?suse_version} >= 1030
%config(noreplace) /etc/apache2/vhosts.d/cobbler_web.conf
%else
%config(noreplace) /etc/httpd/conf.d/cobbler_web.conf
%endif
%dir /var/lib/cobbler/webui_sessions
%dir /srv/www/cobbler_webui_content
%dir /srv/www/logs
/srv/www/cobbler_webui_content/*
%doc AUTHORS COPYING CHANGELOG README

%changelog

Hi
Have a look here;
http://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto

And check/update your %if 0%{?suse_version} for SLE and openSUSE. There
is one in there at 0?


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.4 (x86_64) Kernel 2.6.37.6-0.7-desktop
up 5 days 4:10, 3 users, load average: 0.19, 0.22, 0.18
GPU GeForce 8600 GTS Silent - Driver Version: 280.13

Hi,

Thanks for the reply but I still don’t get it : the package compile fine for Opensuse 11.4 but not Sles11. I tried to replace ?suse_version with ?sles_version but then I get other errors and it won’t compile for either Opensuse and Sles.

Hi
If you look at this;


BuildRequires: distribution-release

Then look at the project config;
https://build.opensuse.org/project/prjconf?project=openSUSE%3A11.4


Ignore: aaa_base:aaa_skel,suse-release,logrotate,ash,mingetty,distribution-release,udev

So add to your project config;


Ignore: distribution-release

Or drop as a build requires since it’s ignored.

I finally found an acceptable solution : replace

BuildRequires: distribution-release

with

BuildRequires: sles-release

The package is required because an install script checks for the presence of the file /etc/SuSE-release to determine the right path to copy files. This file is packaged in the sles-release rpm.