Guest User

Untitled

a guest
Nov 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. # Contrail VNC Debian Packaging Changes
  2.  
  3. Initial changes to the Contrail VNC packaging for Debian to modernize it and make it a bit more manageable.
  4.  
  5. ## Changes description
  6.  
  7. Most of the changes outside of *debian/rules* and *debian/control* are fairly small - the packaging logic is contained in those two files.
  8.  
  9. ### debian/rules and debian/control changes
  10.  
  11. *debian/rules* is a *Makefile* that all debian packaging executes, one step at the time, to clean, build, install [^1] and create source & binary packages. *debian/control* is the description of the package — what has to be installed in order to build & package it, what binary packages to create and their metadata (extra dependencies, relation with other packages etc.)
  12.  
  13. [^1]: Installation is done to a temporary directory under *debian/*
  14.  
  15. #### debian/control changes
  16.  
  17. In the current workflow, before we even get to package building, a separate *Makefile* `packages.make` is used to substitute various templated variables with correct text - we add per-release build and install-time dependencies:
  18.  
  19. * *BUILDDEP_SERIES* is replaced with a combination of dependencies, based on the target system, but it can be removed for master - the two main sticking points is installing `dh-systemd` only on *xenial* (which is fine but not required - the package exists on both *trusty* and *xenial* and debhelper will handle a situation when trusty has no systemd installed/running) and installing a bunch of dependencies only on trusty+ — that's probably required to support precise, but a) we are probably not going to be building 5.0+ for precise and b) going forward, this is not the right way to do that anyway - if that requirement shows up again, we should backport required packages from 18.04 to 16.04 and 14.04 as needed.
  20. * SUPERVISORDEP_SERIES is used to add an install-time dependency on supervisor for many packages — this can be better supported by usage of a variable `${dist:Depends}` that can be then populated in *debian/rules*.
  21. * NODEMGRDEP_SERIES adds xenial-only dependencies for nodemgr packages on python-dbus — that can be handled the same way we handle supervisor dependency, through *debian/rules* code.
  22.  
  23. I've added a number of packages to the Build-Depends list, so that they can be properly installed before the build, without depending on pre-installed packages.[^2] I'm also bumping debhelper dependency, and adding dh-exec package - that will come up handy later, when we get to the *.install* and *.dirs* files.
  24.  
  25. #### debian/rules changes
  26.  
  27. In *debian/rules* I'm fixing the `INSTALL_ROOT` variable to ensure that files are always installed in the correct location, not depending on $PWD as well as add code to support `${dist:Depends}` and `${dbus:Depends}`[^3]:
  28.  
  29. ```Makefile
  30. VER := $(shell awk -F"=" '$$1 == "DISTRIB_CODENAME" {print $$NF}' /etc/lsb-release)
  31. ifeq ($(findstring xenial,$(VER)),xenial)
  32. SUBSTVARS += -Vdbus:Depends="dbus, python-pydbus (>= 0.7.0)"
  33. DH_WITH=python2,systemd
  34. else
  35. SUBSTVARS = -Vdist:Depends="supervisor"
  36. DH_WITH=python2
  37. endif
  38. ```
  39.  
  40. as well as adding code to support parallel building, based on debhelper variable (*DEB_BUILD_OPTIONS*):
  41.  
  42. ```makefile
  43. ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  44. JOBS = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  45. else
  46. JOBS =
  47. endif
  48. ```
  49.  
  50. I've also added a target to generate source tarball (which is a semi-hard requirement of the build process and is called **get-orig-source** by convention):
  51.  
  52. ```makefile
  53. get-orig-source:
  54. (cd ${SB_TOP}/third_party/ && python fetch_packages.py)
  55. tar zcf contrail_${DEB_UPSTREAM_VERSION}.orig.tar.gz \
  56. controller vrouter third_party tools/build tools/generateds \
  57. openstack/nova_contrail_vif openstack/nova_extensions \
  58. tools/sandesh SConstruct
  59. ```
  60.  
  61. Then, there are couple of changes to other targets:
  62.  
  63. In `override_dh_auto_clean` we make sure that all files created by the SCons, to make debuild happy [^3]
  64.  
  65. [^2]: contrail-build scripts install a number of java libraries, are they required for anything but VCenter builds? Java itself is needed for testing.
  66.  
  67. [^3]: Debian considers it an error if any file found in the source package is modified during the build process.
  68.  
  69. ### debian/\*.install and debian/\*.dirs
  70.  
  71. All those files have been made executable, and debhelper exetures a command from *shebang* to process them, creating a per-release variants on the fly:
  72. - All comments are stripped out
  73. - Each line with [ubuntu-${release}] is present only when package is being built for the ${release}.
  74.  
  75. ### debian/source/options
  76.  
  77. A number of settings telling debian packaging utilities how to generate and validate source package.
  78.  
  79. Debian has a strict policy of not modifying files that come from the source package during build - *debian/source/options* lets you tweak this policy by telling debian tools to ignore some of the files/folders. We use that to ignore *.git/* and *.repo/* as well as a bunch of folders that come from our "sandbox" but are not part of the Contrail VNC source package.
  80.  
  81. ### debian/dh-exec/
  82.  
  83. Scripts that are used to generate per-release \*.install and \*.dirs files:
  84. - *dh-exec-filter-arch-ex* — Filter lines by matching current Ubuntu release with tags
  85. - *dh-exec-filter-comments* — Remove all lines starting with *#*
Add Comment
Please, Sign In to add comment