简体   繁体   English

Debian 包是否有标准/推荐的目录结构?

[英]Is there a standard/recommended directory structure for Debian packages?

My next project will be a Debian daemon written in Python and I want to package it as a Debian native package. My next project will be a Debian daemon written in Python and I want to package it as a Debian native package. The project is versioned using Git and the code is hosted in GitHub.该项目使用 Git 进行版本控制,代码托管在 GitHub 中。

How can I organize directories and branches in the repository?如何组织存储库中的目录和分支? Is there a standard/common/recommended way?有标准/常用/推荐的方式吗?

The project is basically composed by some python scripts and systemd unit files.该项目基本上由一些 python 脚本和 systemd 单元文件组成。 By looking around I came up with this directory structure but I don't know if it is reasonable:通过环顾四周,我想出了这个目录结构,但我不知道它是否合理:

my-app/
├── debian/
│   ├── control
│   ├── copyright
│   ├── changelog
│   ├── rules
│   └── ...
├── my_module/
│   ├── __init__.py
│   ├── my_script.py
│   └── ...
├── systemd/
│   ├── my-service.service
│   └── ...
├── README.md
├── LICENSE
└── ...

it seems you are asking about the directory structure (which files should be where), not the repository structure (which would be about branches).看来您是在询问目录结构(哪些文件应该在哪里),而不是存储库结构(关于分支)。

the structure is as follows:结构如下:

  • the upstream project (eg the content of a source release tarball)上游项目(例如源发布 tarball 的内容)
  • PLUS a debian/ folder in the root of this directory在此目录的根目录中加上一个debian/文件夹

that's it.而已。 this structure was designed to allow packaging of arbitrary projects - with the only constraint that there is no debian/ folder.这种结构旨在允许打包任意项目 - 唯一的限制是没有debian/文件夹。

now, this structure is very tightly coupled to the concept of having upstream-development separate from Debian-packaging.现在,这种结构与上游开发与 Debian 打包分离的概念非常紧密地结合在一起。 (something which might not apply to your use case, as you seem to be both upstream developer and the one creating the Debian package). (这可能不适用于您的用例,因为您似乎既是上游开发人员又是创建 Debian 包的人)。

in order to make life easier for an eventual adaption into Debian proper (eg adaption of the package into a real Debian release), you should make sure that the /debian directory is not included in the release tarballs.为了使最终适应 Debian 的生活更轻松(例如,将 package 调整为真正的 Debian 版本),确保不包括/debian tarsballdebianZ 版本的版本)。

You should also exclude repository configuration files from your release tarballs ( .gitignore files, CI-configuration,...)您还应该从发布 tarball 中排除存储库配置文件( .gitignore文件、CI 配置...)

if using git, you might add a .gitattributes file that contains (among other things):如果使用 git,您可以添加一个.gitattributes文件,其中包含(除其他外):

/debian/    export-ignore
.git*       export-ignore

There's also a more elaborate online guide on how to be a nice upstream for Debian: https://wiki.debian.org/UpstreamGuide还有一个更详细的在线指南,介绍如何成为 Debian 的良好上游: https://wiki.debian.org/UpstreamGuide

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有标准的方法来创建用于分发 Python 程序的 Debian 软件包? - Is there a standard way to create Debian packages for distributing Python programs? 对于不同的Linux发行版(Debian,Redhat,Slackware等),python标准库和dist-packages的路径是否不同? - Are the paths to the python standard library and to the dist-packages different for different linux distributions(Debian, Redhat, Slackware, …)? 需要适用于python软件包的正确目录结构以及有关良好API设计的准则 - Need proper directory structure for python packages and guidelines on good API design 为什么 pip 在当前目录中安装包而不是标准的站点包位置? - Why is pip installing packages in the current directory instead of the standard site-packages location? 在标准项目目录结构中调用脚本(bin子目录的Python路径) - Calling script in standard project directory structure (Python path for bin subdirectory) Pip推荐结构 - Pip recommended structure 应用debian软件包而不是pip软件包 - applying debian packages instead of pip packages python桌面开发的推荐结构 - recommended structure for python desktop development 是否有推荐的方法来构建基金代码 - Is there a recommended way to structure the Fund codes Dockerfile - debian Jessie 404:找不到包 - Dockerfile - debian Jessie 404: packages not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM