Advertisement
Guest User

system-config-printer.spec

a guest
Jun 7th, 2010
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.63 KB | None | 0 0
  1. %define use_gitsnap 0
  2. %{?_no_gitsnap: %{expand: %%global use_gitsnap 0}}
  3. %if %{use_gitsnap}
  4. %define gitsnap 200809231700
  5. %endif
  6.  
  7. # needs porting of Mandriva specific features from hal-cups-utils to s-c-p-udev
  8. %define obsolete_hal_cups_utils 1
  9.  
  10. Name: system-config-printer
  11. Summary: A printer administration tool
  12. Version: 1.2.0
  13. Release: %mkrel 12
  14. Url: http://cyberelk.net/tim/software/system-config-printer/
  15. License: LGPLv2+
  16. Group: System/Configuration/Printing
  17. BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
  18. Source0: http://cyberelk.net/tim/data/system-config-printer/1.2/%{name}-%{version}%{?gitsnap:-%gitsnap}.tar.xz
  19. Source1: system-config-printer.pam
  20. Source2: system-config-printer.console
  21. Source3: po-mdv.tar.bz2
  22. Source4: mdv_printer_custom.py
  23. Source5: hp-makeuri-mdv.c
  24. Source6: mdv_backend
  25. # Let printers have an ACL allowing rw for user lp, as our CUPS runs backends as lp:sys (bug 49407)
  26. Source7: 69-printers_lp_user_fix.rules
  27. Patch0: system-config-printer-1.1.12-mdv_custom-applet.patch
  28. Patch1: system-config-printer-1.1.12-mdv_custom-embedded_window.patch
  29. Patch2: system-config-printer-1.1.91-mdv_custom-system-config-printer.patch
  30. Patch3: system-config-printer-1.1.17-start-applet.patch
  31. Patch4: system-config-printer-1.2.0-udev-configure-printer-mdv.patch
  32. Patch6: system-config-printer-git.patch
  33. # Ubuntu patches
  34. # use hpcups instead of hpijs for HP printers, like in
  35. # previous versions. hpijs is obsolete and hpcup is mature now
  36. Patch101: 50_give-priority-to-hpcups.patch
  37. # when comparing usb uris, deal with the difference between the obsolete
  38. # usblp and the new libusb back-end
  39. Patch102: 67_match-usb-uris-of-usblp-and-libusb.patch
  40. # Fedora patches
  41. Patch200: system-config-printer-lowercase-mfg-mdl.patch
  42. #Patch204: system-config-printer-cupsconnection-dealloc.patch
  43.  
  44. BuildRequires: libcups2-devel
  45. BuildRequires: libpython2.5-devel
  46. BuildRequires: desktop-file-utils >= 0.2.92
  47. BuildRequires: gettext-devel
  48. BuildRequires: intltool
  49. BuildRequires: xmlto
  50. BuildRequires: docbook-dtd412-xml
  51. BuildRequires: docbook-style-xsl
  52. %if %obsolete_hal_cups_utils
  53. BuildRequires: libudev0-devel
  54. BuildRequires: libusb1.0-devel
  55. BuildRequires: libhpip0-devel
  56. BuildRequires: libdbus-1-devel
  57. BuildRequires: libdbus-glib-1_2-devel
  58. %endif
  59. Obsoletes: desktop-printing
  60. Obsoletes: printerdrake
  61. Provides: printerdrake
  62. Requires: pygtk2.0 >= 2.4.0
  63. Requires: pygtk2.0-libglade
  64. Requires: python-gobject
  65. Requires: libxml2-python
  66. Requires: desktop-file-utils >= 0.2.92
  67. Requires: dbus-x11
  68. Requires: system-config-printer-libs = %{version}
  69. %if %obsolete_hal_cups_utils
  70. Requires: system-config-printer-udev = %{version}
  71. %else
  72. Requires: hal-cups-utils
  73. Obsoletes: system-config-printer-udev
  74. %endif
  75. Requires: gnome-icon-theme
  76. Requires: gnome-python
  77. Requires: virtual-notification-daemon
  78. Requires: python-cups
  79. Requires: python-rhpl
  80. Requires: python-dbus
  81. Requires: python-notify
  82. %if %obsolete_hal_cups_utils
  83. Requires: hplip-model-data
  84. # nmap is required to scan the network, just like
  85. # printerdrake used to do.
  86. Requires: nmap
  87. Requires: python-smbc
  88. %endif
  89. Conflicts: kdeutils4-printer-applet
  90. Suggests: samba-client
  91.  
  92. %description
  93. system-config-printer is a graphical user interface that allows
  94. the user to configure a CUPS print server.
  95.  
  96. %files
  97. %defattr(-,root,root)
  98. %doc ChangeLog README
  99. %{_bindir}/%{name}
  100. %{_sbindir}/%{name}
  101. %{_bindir}/hp-makeuri-mdv
  102. %{_bindir}/%{name}-applet
  103. %dir %{_datadir}/%{name}
  104. %{_datadir}/%{name}/*.py*
  105. %{_datadir}/%{name}/troubleshoot
  106. %{_datadir}/%{name}/ui/*.glade
  107. %{_datadir}/%{name}/icons
  108. %{_datadir}/applications/system-config-printer.desktop
  109. %{_datadir}/applications/manage-print-jobs.desktop
  110. %{_sysconfdir}/xdg/autostart/print-applet.desktop
  111. %config(noreplace) %{_sysconfdir}/pam.d/%{name}
  112. %config(noreplace) %{_sysconfdir}/security/console.apps/%{name}
  113. %{_mandir}/man1/*
  114.  
  115. #---------------------------------------------------------------------
  116. %if %obsolete_hal_cups_utils
  117. %package udev
  118. Summary: Rules for udev for automatic configuration of USB printers
  119. Group: System/Configuration/Hardware
  120. Requires: system-config-printer-libs = %{version}-%{release}
  121. Obsoletes: hal-cups-utils <= 0.6.20
  122. Conflicts: cups < 1.4.2-6
  123.  
  124. %description udev
  125. The udev rules and helper programs for automatically configuring USB
  126. printers.
  127.  
  128. %post
  129. # disable old printer detection system
  130. if [ -f /etc/sysconfig/printing ]; then
  131. if grep -q ^AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED= /etc/sysconfig/printing; then
  132. sed -i 's/AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED=.*/AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED=no/g' /etc/sysconfig/printing
  133. else
  134. echo AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED=no >> /etc/sysconfig/printing
  135. fi
  136. if grep -q ^ENABLE_QUEUES_ON_PRINTER_CONNECTED= /etc/sysconfig/printing; then
  137. sed -i 's/ENABLE_QUEUES_ON_PRINTER_CONNECTED=.*/ENABLE_QUEUES_ON_PRINTER_CONNECTED=no/g' /etc/sysconfig/printing
  138. else
  139. echo ENABLE_QUEUES_ON_PRINTER_CONNECTED=no >> /etc/sysconfig/printing
  140. fi
  141. else
  142. echo AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED=no >> /etc/sysconfig/printing
  143. echo ENABLE_QUEUES_ON_PRINTER_CONNECTED=no >> /etc/sysconfig/printing
  144. fi
  145.  
  146. %postun
  147. # enable old printer detection system
  148. if [ -f /etc/sysconfig/printing ]; then
  149. if grep -q ^AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED= /etc/sysconfig/printing; then
  150. sed -i 's/AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED=.*/AUTO_SETUP_QUEUES_ON_PRINTER_CONNECTED=yes/g' /etc/sysconfig/printing
  151. fi
  152. if grep -q ^ENABLE_QUEUES_ON_PRINTER_CONNECTED= /etc/sysconfig/printing; then
  153. sed -i 's/ENABLE_QUEUES_ON_PRINTER_CONNECTED=.*/ENABLE_QUEUES_ON_PRINTER_CONNECTED=yes/g' /etc/sysconfig/printing
  154. fi
  155. fi
  156.  
  157. %files udev
  158. %defattr(-,root,root,-)
  159. /lib/udev/*
  160. %dir %{_localstatedir}/run/udev-configure-printer
  161. %verify(not md5 size mtime) %config(noreplace,missingok) %attr(0644,root,root) %{_localstatedir}/run/udev-configure-printer/usb-uris
  162. %{_sysconfdir}/udev/rules.d/*
  163. %endif #obsolete_hal_cups_utils
  164.  
  165. #---------------------------------------------------------------------
  166.  
  167. %package libs
  168. Summary: Common code for the graphical and non-graphical pieces
  169. Group: System/Libraries
  170. Requires: python
  171. Requires: foomatic
  172.  
  173. %description libs
  174. The common code used by both the graphical and non-graphical parts of
  175. the configuration tool.
  176.  
  177. %files libs -f system-config-printer.lang
  178. %defattr(-,root,root,-)
  179. %config(noreplace) %{_sysconfdir}/dbus-1/system.d/newprinternotification.conf
  180. %config(noreplace) %{_sysconfdir}/dbus-1/system.d/printerdriversinstaller.conf
  181. %dir %{python_sitelib}/cupshelpers
  182. %{python_sitelib}/cupshelpers/__init__.py*
  183. %{python_sitelib}/cupshelpers/cupshelpers.py*
  184. %{python_sitelib}/cupshelpers/openprinting.py*
  185. %{python_sitelib}/cupshelpers/ppds.py*
  186. %{_libdir}/cups/backend/mdv_backend
  187. %{py_platsitedir}/mdv_printer_custom.py*
  188. %{python_sitelib}/*.egg-info
  189.  
  190. #--------------------------------------------------------------------
  191.  
  192. %prep
  193. %setup -q
  194. %patch0 -p1 -b .mdv_custom-applet
  195. %patch1 -p1 -b .mdv_custom-embedded-window
  196. %patch2 -p1 -b .mdv_custom-system-config-printer
  197. %patch3 -p0 -b .start_applet
  198. %patch4 -p1 -b .udev-configue-printer-mdv
  199. %patch6 -p1 -b .git
  200. %patch101 -p1 -b .hpcupsprio
  201. %patch102 -p1 -b .libusb
  202. # Convert InstallPrinterDriver requests to lower-case.
  203. %patch200 -p1 -b .lowercase-mfg-mdl
  204.  
  205.  
  206. # update mdv custom translation
  207. tar xvjf %{SOURCE3}
  208. pushd po
  209. for i in *.po; do
  210. if [ ! -f ../po-mdv/$i ]; then
  211. continue
  212. fi
  213. msgcat $i ../po-mdv/$i > ../po-mdv/$i-new
  214. rm -f $i
  215. mv ../po-mdv/$i-new $i
  216. done
  217. popd
  218.  
  219. %build
  220. aclocal
  221. %if %{use_gitsnap}
  222. ./bootstrap
  223. %endif
  224. %configure2_5x \
  225. %if %obsolete_hal_cups_utils
  226. --with-udev-rules
  227. %endif
  228.  
  229. make
  230. %if %obsolete_hal_cups_utils
  231. # (salem) this hack avoids requiring hplip
  232. gcc %{SOURCE5} -o hp-makeuri-mdv -lhpmud
  233. %endif
  234.  
  235. %install
  236. rm -rf %buildroot
  237. %makeinstall_std
  238.  
  239. %if %obsolete_hal_cups_utils
  240. mkdir -p %{buildroot}%{_mozillaextpath}
  241. mkdir -p %{buildroot}%{py_platsitedir}
  242. mkdir -p %{buildroot}%{_bindir}
  243. cp -f hp-makeuri-mdv %{buildroot}%{_bindir}
  244. # Make sure pyc files are generated, otherwise we can get
  245. # difficult to debug problems
  246. pushd %{buildroot}%{_datadir}/%{name}
  247. python -m compileall .
  248. popd
  249. mkdir -p %{buildroot}%{py_platsitedir}
  250. cp -fv %{SOURCE4} %{buildroot}%{py_platsitedir}
  251. pushd %{buildroot}%{py_platsitedir}
  252. python -m compileall .
  253. popd
  254.  
  255. %{__mkdir_p} %buildroot%{_localstatedir}/run/udev-configure-printer
  256. touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
  257. %{__mkdir_p} %{buildroot}%{_libdir}/cups/backend
  258. cp -f %{SOURCE6} %{buildroot}%{_libdir}/cups/backend
  259.  
  260. # Install udev rules for letting backends access the printer devices. Once
  261. # CUPS runs backends as group 'lp', instead of 'sys, we may remove this.
  262. mkdir -p %{buildroot}%{_sysconfdir}/udev/rules.d
  263. install -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/udev/rules.d/
  264.  
  265.  
  266. %endif
  267.  
  268. mkdir -p %buildroot%{_bindir}
  269. mkdir -p %buildroot%{_sbindir}
  270. mkdir -p %buildroot%{_sysconfdir}/pam.d
  271. mkdir -p %buildroot%{_sysconfdir}/security/console.apps
  272. install -p -m0644 %{SOURCE1} %buildroot%{_sysconfdir}/pam.d/%{name}
  273. install -p -m0644 %{SOURCE2} %buildroot%{_sysconfdir}/security/console.apps/%{name}
  274. mv %buildroot%{_bindir}/%{name} %buildroot%{_sbindir}/%{name}
  275. ln -s consolehelper %buildroot%{_bindir}/%{name}
  276.  
  277.  
  278. %find_lang system-config-printer
  279.  
  280. %clean
  281. %{__rm} -rf "%{buildroot}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement