actions.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from pisi.actionsapi import shelltools
  7. from pisi.actionsapi import autotools
  8. from pisi.actionsapi import pisitools
  9. from pisi.actionsapi import get
  10. import os
  11. def setup():
  12. # Patch compressed PPDs
  13. for patch in sorted(os.listdir("ppd-patches")):
  14. shelltools.system("./patch-ppds ppd-patches/%s" % patch)
  15. for f in ("NEWS", "INSTALL", "README", "AUTHORS", "ChangeLog"):
  16. shelltools.touch(f)
  17. pisitools.dosed("Makefile.am", "^rulesdir = .*$", "rulesdir = /lib/udev/rules.d")
  18. # Migrate device ids from hpcups drv to hpijs drv
  19. #shelltools.system("./copy-deviceids prnt/drv/hpcups.drv.in prnt/drv/hpijs.drv.in > hpijs.drv.in.new")
  20. #shelltools.move("hpijs.drv.in.new", "prnt/drv/hpijs.drv.in")
  21. # Strip duplex constraints from hpcups
  22. pisitools.dosed("prnt/drv/hpcups.drv.in", "(UIConstraints.* \*Duplex)", "//\\1")
  23. # Change python shebang
  24. shelltools.system("find -name '*.py' -print0 | xargs -0 sed -i 's,^#!/usr/bin/env python,#!/usr/bin/python,'")
  25. # These are barely the defaults except:
  26. # --enable-foomatic-drv-install (default=no) (respected by Fedora, enabled by Ubuntu)
  27. autotools.autoreconf("-fi")
  28. autotools.configure("--with-cupsbackenddir=/usr/lib/cups/backend \
  29. --with-drvdir=/usr/share/cups/drv \
  30. --with-hpppddir=/usr/share/cups/model/hplip \
  31. --with-docdir=/usr/share/doc/hplip \
  32. --with-mimedir=/usr/share/cups/mime \
  33. --enable-qt5 \
  34. --enable-udev-acl-rules \
  35. --enable-pp-build \
  36. --enable-fax-build \
  37. --enable-gui-build \
  38. --enable-dbus-build \
  39. --enable-scan-build \
  40. --enable-network-build \
  41. --enable-hpcups-install \
  42. --enable-cups-drv-install \
  43. --enable-foomatic-drv-install \
  44. --disable-qt4 \
  45. --disable-qt3 \
  46. --disable-policykit \
  47. --disable-doc-build \
  48. --disable-imageProcessor-build \
  49. --disable-foomatic-ppd-install \
  50. ")
  51. # Remove hardcoded rpaths
  52. pisitools.dosed("libtool", "^hardcode_libdir_flag_spec=.*", "hardcode_libdir_flag_spec=\"\"")
  53. pisitools.dosed("libtool", "^runpath_var=LD_RUN_PATH", "runpath_var=DIE_RPATH_DIE")
  54. def build():
  55. autotools.make()
  56. def install():
  57. autotools.rawInstall("DESTDIR=%s ppddir=/usr/share/cups/model/hplip" % get.installDIR())
  58. # Create a compatibility symlink for foomatic-rip-hplip
  59. pisitools.dosym("/usr/lib/cups/filter/foomatic-rip", "/usr/lib/cups/filter/foomatic-rip-hplip")
  60. # Install documents
  61. pisitools.dodoc("COPYING")
  62. # Remove the hal preprobe rules as they were causing breakage (bug #479648).
  63. # Remove hal directory as well.
  64. pisitools.removeDir("/usr/share/hal/")
  65. # Remove unpackaged stuff (Fedora)
  66. #pisitools.remove("/usr/share/hplip/fax/pstotiff*")
  67. #pisitools.remove("/usr/share/cups/mime/pstotiff.types")
  68. #pisitools.remove("/usr/share/hplip/pkservice.py")
  69. #pisitools.remove("/usr/bin/hp-pkservice")
  70. # Do not mess with sane, init, foomatic etc.
  71. pisitools.removeDir("/etc/sane.d")
  72. # Create empty plugins directory
  73. pisitools.dodir("/usr/share/hplip/prnt/plugins")
  74. # This notifies user through libnotify when the printer requires a firmware
  75. # Should port it to KNotify if possible, argh.
  76. pisitools.remove("/lib/udev/rules.d/56-hpmud.rules")
  77. # --disable-doc-build used. It doesn't go to the true directory.
  78. pisitools.dohtml("doc/*")