{"id":13746328,"url":"https://github.com/xolox/python-deb-pkg-tools","last_synced_at":"2025-07-14T02:32:52.938Z","repository":{"id":137547091,"uuid":"11672491","full_name":"xolox/python-deb-pkg-tools","owner":"xolox","description":"Debian packaging tools","archived":false,"fork":false,"pushed_at":"2021-03-09T13:48:43.000Z","size":1167,"stargazers_count":44,"open_issues_count":7,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-18T20:45:33.377Z","etag":null,"topics":["apt","deb","debian","dpkg","packaging","python"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/deb-pkg-tools","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xolox.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2013-07-25T22:28:57.000Z","updated_at":"2025-06-03T13:49:49.000Z","dependencies_parsed_at":"2024-01-15T00:47:11.110Z","dependency_job_id":"f7671e94-a7a2-415d-8606-c8d73cd663e5","html_url":"https://github.com/xolox/python-deb-pkg-tools","commit_stats":null,"previous_names":[],"tags_count":147,"template":false,"template_full_name":null,"purl":"pkg:github/xolox/python-deb-pkg-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fpython-deb-pkg-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fpython-deb-pkg-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fpython-deb-pkg-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fpython-deb-pkg-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xolox","download_url":"https://codeload.github.com/xolox/python-deb-pkg-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fpython-deb-pkg-tools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265233753,"owners_count":23731825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apt","deb","debian","dpkg","packaging","python"],"created_at":"2024-08-03T06:00:51.828Z","updated_at":"2025-07-14T02:32:52.864Z","avatar_url":"https://github.com/xolox.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"deb-pkg-tools: Debian packaging tools\n=====================================\n\n.. image:: https://travis-ci.org/xolox/python-deb-pkg-tools.svg?branch=master\n   :target: https://travis-ci.org/xolox/python-deb-pkg-tools\n\n.. image:: https://coveralls.io/repos/xolox/python-deb-pkg-tools/badge.png?branch=master\n   :target: https://coveralls.io/r/xolox/python-deb-pkg-tools?branch=master\n\nThe Python package `deb-pkg-tools` is a collection of functions to build and\ninspect `Debian binary packages`_ and repositories of binary packages. Its\nprimary use case is to automate builds.\n\nSome of the functionality is exposed in the command line interface (documented below)\nbecause it's very convenient to use in shell scripts, while other functionality\nis meant to be used as a Python API. The package is currently tested on cPython\n2.7, 3.5+ and PyPy (2.7).\n\nPlease note that `deb-pkg-tools` is quite opinionated about how Debian binary\npackages should be built and it enforces some of these opinions on its users.\nMost of this can be avoided with optional function arguments and/or environment\nvariables. If you find something that doesn't work to your liking and you can't\nwork around it, feel free to ask for an additional configuration option; I try\nto keep an open mind about the possible use cases of my projects.\n\n.. contents::\n\nStatus\n------\n\nOn the one hand the `deb-pkg-tools` package is based on my experiences with\nDebian packages and repositories over the past couple of years, on the other\nhand `deb-pkg-tools` itself is quite young. Then again most functionality is\ncovered by automated tests; at the time of writing coverage is around 90% (some\nof the error handling is quite tricky to test if we also want to test the\nnon-error case, which is of course the main focus :-)\n\nInstallation\n------------\n\nThe `deb-pkg-tools` package is available on PyPI_ which means installation\nshould be as simple as:\n\n.. code-block:: console\n\n   $ pip install deb-pkg-tools\n\nThere's actually a multitude of ways to install Python packages (e.g. the `per\nuser site-packages directory`_, `virtual environments`_ or just installing\nsystem wide) and I have no intention of getting into that discussion here, so\nif this intimidates you then read up on your options before returning to these\ninstructions ;-).\n\nWhen `deb-pkg-tools` is being used to scan thousands of ``*.deb`` archives a\nsignificant speedup may be achieved using memcached:\n\n.. code-block:: console\n\n   $ pip install \"deb-pkg-tools[memcached]\"\n\nUnder the hood `deb-pkg-tools` uses several programs provided by Debian, the\ndetails are available in the dependencies_ section. To install these programs:\n\n.. code-block:: console\n\n  $ sudo apt-get install dpkg-dev fakeroot lintian\n\nUsage\n-----\n\nThere are two ways to use the `deb-pkg-tools` package: As a command line\nprogram and as a Python API. For details about the Python API please refer to\nthe API documentation available on `Read the Docs`_. The command line interface\nis described below.\n\n.. A DRY solution to avoid duplication of the `deb-pkg-tools --help' text:\n..\n.. [[[cog\n.. from humanfriendly.usage import inject_usage\n.. inject_usage('deb_pkg_tools.cli')\n.. ]]]\n\n**Usage:** `deb-pkg-tools [OPTIONS] ...`\n\nWrapper for the deb-pkg-tools Python project that implements various tools to\ninspect, build and manipulate Debian binary package archives and related\nentities like trivial repositories.\n\n**Supported options:**\n\n.. csv-table::\n   :header: Option, Description\n   :widths: 30, 70\n\n\n   \"``-i``, ``--inspect=FILE``\",\"Inspect the metadata in the Debian binary package archive given by ``FILE``\n   (similar to \"\"dpkg ``--info``\"\").\"\n   \"``-c``, ``--collect=DIR``\",\"Copy the package archive(s) given as positional arguments (and all package\n   archives required by the given package archives) into the directory given\n   by ``DIR``.\"\n   \"``-C``, ``--check=FILE``\",\"Perform static analysis on a package archive and its dependencies in order\n   to recognize common errors as soon as possible.\"\n   \"``-p``, ``--patch=FILE``\",\"Patch fields into the existing control file given by ``FILE``. To be used\n   together with the ``-s``, ``--set`` option.\"\n   \"``-s``, ``--set=LINE``\",\"A line to patch into the control file (syntax: \"\"Name: Value\"\"). To be used\n   together with the ``-p``, ``--patch`` option.\"\n   \"``-b``, ``--build=DIR``\",\"Build a Debian binary package with \"\"dpkg-deb ``--build``\"\" (and lots of\n   intermediate Python magic, refer to the API documentation of the project\n   for full details) based on the binary package template in the directory\n   given by ``DIR``. The resulting archive is located in the system wide\n   temporary directory (usually /tmp).\"\n   \"``-u``, ``--update-repo=DIR``\",\"Create or update the trivial Debian binary package repository in the\n   directory given by ``DIR``.\"\n   \"``-a``, ``--activate-repo=DIR``\",\"Enable \"\"apt-get\"\" to install packages from the trivial repository (requires\n   root/sudo privilege) in the directory given by ``DIR``. Alternatively you can\n   use the ``-w``, ``--with-repo`` option.\"\n   \"``-d``, ``--deactivate-repo=DIR``\",\"Cleans up after ``--activate-repo`` (requires root/sudo privilege).\n   Alternatively you can use the ``-w``, ``--with-repo`` option.\"\n   \"``-w``, ``--with-repo=DIR``\",\"Create or update a trivial package repository, activate the repository, run\n   the positional arguments as an external command (usually \"\"apt-get install\"\")\n   and finally deactivate the repository.\"\n   \"``--gc``, ``--garbage-collect``\",\"Force removal of stale entries from the persistent (on disk) package\n   metadata cache. Garbage collection is performed automatically by the\n   deb-pkg-tools command line interface when the last garbage collection\n   cycle was more than 24 hours ago, so you only need to do it manually\n   when you want to control when it happens (for example by a daily\n   cron job scheduled during idle hours :-).\"\n   \"``-y``, ``--yes``\",Assume the answer to interactive questions is yes.\n   \"``-v``, ``--verbose``\",Make more noise! (useful during debugging)\n   \"``-h``, ``--help``\",Show this message and exit.\n\n.. [[[end]]]\n\nOne thing to note is that the operation of ``deb-pkg-tools --update-repo`` can\nbe influenced by a configuration file. For details about this, please refer to\nthe documentation on `deb_pkg_tools.repo.select_gpg_key()`_.\n\n.. _dependencies:\n\nDependencies\n------------\n\nThe following external programs are required by `deb-pkg-tools` (depending on\nwhich functionality you want to use of course):\n\n=====================  =============\nProgram                Package\n=====================  =============\n``apt-ftparchive``     ``apt-utils``\n``apt-get``            ``apt``\n``cp``                 ``coreutils``\n``dpkg-deb``           ``dpkg``\n``dpkg-architecture``  ``dpkg-dev``\n``du``                 ``coreutils``\n``fakeroot``           ``fakeroot``\n``gpg``                ``gnupg``\n``gzip``               ``gzip``\n``lintian``            ``lintian``\n=====================  =============\n\nThe majority of these programs/packages will already be installed on most\nDebian based systems so you should only need the following to get started:\n\n.. code-block:: console\n\n    $ sudo apt-get install dpkg-dev fakeroot lintian\n\nPlatform compatibility\n----------------------\n\nSeveral things can be tweaked via environment variables if they don't work for\nyour system or platform. For example on Mac OS X the ``cp`` command doesn't\nhave an ``-l`` parameter and the ``root`` user and group may not exist, but\ndespite these things it can still be useful to test package builds on Mac OS\nX. The following environment variables can be used to adjust such factors:\n\n.. csv-table::\n   :header-rows: 1\n\n   Environment variable,Default value\n   `$DPT_ALLOW_FAKEROOT_OR_SUDO`_,true\n   `$DPT_CHOWN_FILES`_,true\n   `$DPT_FORCE_ENTROPY`_,false\n   `$DPT_HARD_LINKS`_,true\n   `$DPT_PARSE_STRICT`_,true\n   `$DPT_RESET_SETGID`_,true\n   `$DPT_ROOT_GROUP`_,root\n   `$DPT_ROOT_USER`_,root\n   `$DPT_SUDO`_,true\n\nEnvironment variables for boolean options support the strings ``yes``,\n``true``, ``1``, ``no``, ``false`` and ``0`` (case is ignored).\n\nDisabling sudo usage\n~~~~~~~~~~~~~~~~~~~~\n\nTo disable any use of ``sudo`` you can use the following:\n\n.. code-block:: bash\n\n   export DPT_ALLOW_FAKEROOT_OR_SUDO=false\n   export DPT_CHOWN_FILES=false\n   export DPT_RESET_SETGID=false\n   export DPT_SUDO=false\n\nContact\n-------\n\nThe latest version of `deb-pkg-tools` is available on PyPI_ and GitHub_. The\ndocumentation is hosted on `Read the Docs`_. For bug reports please create an\nissue on GitHub_. If you have questions, suggestions, etc. feel free to send me\nan e-mail at `peter@peterodding.com`_.\n\nLicense\n-------\n\nThis software is licensed under the `MIT license`_.\n\n© 2020 Peter Odding.\n\n.. External references:\n.. _deb_pkg_tools.repo.select_gpg_key(): https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.repo.select_gpg_key\n.. _Debian binary packages: https://www.debian.org/doc/debian-policy/ch-binary.html\n.. _$DPT_ALLOW_FAKEROOT_OR_SUDO: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.package.ALLOW_FAKEROOT_OR_SUDO\n.. _$DPT_CHOWN_FILES: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.package.ALLOW_CHOWN\n.. _$DPT_FORCE_ENTROPY: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.gpg.FORCE_ENTROPY\n.. _$DPT_HARD_LINKS: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.package.ALLOW_HARD_LINKS\n.. _$DPT_PARSE_STRICT: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.package.PARSE_STRICT\n.. _$DPT_RESET_SETGID: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.package.ALLOW_RESET_SETGID\n.. _$DPT_ROOT_GROUP: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.package.ROOT_GROUP\n.. _$DPT_ROOT_USER: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.package.ROOT_USER\n.. _$DPT_SUDO: https://deb-pkg-tools.readthedocs.io/en/latest/#deb_pkg_tools.repo.ALLOW_SUDO\n.. _GitHub: https://github.com/xolox/python-deb-pkg-tools\n.. _MIT license: http://en.wikipedia.org/wiki/MIT_License\n.. _per user site-packages directory: https://www.python.org/dev/peps/pep-0370/\n.. _peter@peterodding.com: peter@peterodding.com\n.. _PyPI: https://pypi.python.org/pypi/deb-pkg-tools\n.. _Read the Docs: https://deb-pkg-tools.readthedocs.io\n.. _virtual environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolox%2Fpython-deb-pkg-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxolox%2Fpython-deb-pkg-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolox%2Fpython-deb-pkg-tools/lists"}