dh_splitpackage - split monolithic installation directory into sub-packages
dh_splitpackage works by interpreting the file debian/splitpackage , which must be a JSON file, describing the split operation to perform. The actual operation is performed in stages:
First the debian/splitpackage file is read to check what packages should be considered and what patterns should be associated with each package. The file is also checked for syntax errors and structure.
Then each file found under debian/tmp/ is classified to determine which package it belongs to. If a file matches patterns of more than one package an appropriate error is reported, with details of the problem. If a file does not match any pattern it is automatically associated to the primary package, if designated.
Finally the split operation is performed. dh_splitpackage walks over the list of files and directories and, for each file or directory, copies it (with the full prefix), to the appropriate package. Directories are not copied recursively, if you want to copy the contents simply specify appropriate pattern that would match all the descendants of that directory.