如何为静态文件创建本机 Debian 软件包?

发布于 2024-12-01 07:48:30 字数 1463 浏览 6 评论 0原文

我需要对软件项目的一些静态资源进行 Debian 化,但对可用信息感到困惑,并且可以在这样做时使用一些指导。以下是我读过的材料:

Debian 新维护者指南似乎是最合适的,尤其是本章,但它是说教式的演讲对我来说没有效果;它读起来更多的是作为重新学习的参考,而不是为无知者提供的指南。我发现的许多信息同样适用于将包包含在我不需要的公共存储库中。为了让一些好心人给我指路,我创建了一个小项目 statrec ,它举例说明了我需要创建的包的类型。它的源代码树看起来像这样:

statrec/
├── LICENSE
├── README.md
├── share
│   ├── gilgamesh.txt
│   └── thoreau.txt
└── VERSION

我需要但无法推断如何:

  • statrec/share安装到/usr/share/statrec/VERSION/
  • 创建或修改从 /usr/share/statrec/current//usr/share/statrec/VERSION/ 的符号链接,然后
  • 卸载以前版本的 statrec。

我了解如何实现其中一些目标,也许使用哪些工具,但对过多的信息感到相当震惊

I have a need to Debianize some static resources for a software project but am confused by the available information and could use some guidance in doing so. Here are the materials I've been reading:

The Debian New Maintainer's Guide seems the most apropos, especially this chapter, but it's didactic presentation is not effective for me; it reads more as a re-learning reference than a guide for the unknowing. Much of the information I've found is likewise geared to getting packages included in a public repository which I do not need. To make it that some kindly folk might show me the way, I've created a small project statrec which exemplifies the type of package I need to create. It's source tree looks like so:

statrec/
├── LICENSE
├── README.md
├── share
│   ├── gilgamesh.txt
│   └── thoreau.txt
└── VERSION

I need to but am unable to deduce how to:

  • install statrec/share to /usr/share/statrec/VERSION/,
  • create or modify a symlink from /usr/share/statrec/current/ to /usr/share/statrec/VERSION/ and then
  • uninstall previous versions of statrec.

I understand how to accomplish some of this, maybe which tools to use but feel rather paralized by the surfeit of information.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

痴骨ら 2024-12-08 07:48:30

我想说最简单的事情是:

  1. 创建一个 makefile,它将安装您希望它们遵循任何 DESTDIR 设置的文件,并且对默认目标不执行任何操作。大致如下:

    all: # 无需构建任何内容
    
    安装:
        cp -r 共享/* $(DESTDIR)/usr/share/statrec/$(VERSION)
    

    DESTDIR 很重要;它不会安装到系统中,而是安装到 dpkg 将打包的临时目录中。所有符号链接必须指向最终目标(不带 $(DESTDIR) 前缀)。

  2. dh_make --native 做它的事情(它将创建另一个 makefile debian/rules 来调用第一个 makefile)。

  3. 查看debian下的文件。特别是 debian/changelog 可能需要编辑(这是 debuild /dpkg-buildpackage 获取版本号的地方,因此必须填写)。

    我相信debuild会自动使用fakeroot,对于dpkg-buildpackage你必须手动指定它。甚至不要考虑以真正的 root 身份运行它。

  4. 使用debuilddpkg-buildpackage -rfakeroot来构建它

不需要关心卸载,因为 dpkg 会处理这个问题。

更新:我建议dh_make --native,因为我知道问题只是为了在少数 debian 系统上安装少量数据文件。如果应该分发,我建议只需在 irc.debian.org#debian IRC 频道上询问,并可能将其留给 Debian 开发人员(只有 Debian 开发人员可以上传到 Debian 存档,他们通常希望自己处理打包) 。

另外,如果它是软件的一部分而不是一组独立的数据文件,则安装应该是使用一个通用 makefile 的软件常规安装的一部分,应该只有一个 Debian 源代码包,并且只是debian/controldebian/*.files 应指定哪些文件进入应用程序包(即“Architecture:any”)以及哪些文件进入数据包(即“架构:全部”和通常带有后缀 -data)。

I would say easiest thing would be to:

  1. Create a makefile, that will install the files as you want them honoring any DESTDIR setting and do nothing for default target. Something along the lines of:

    all: # nothing to build
    
    install:
        cp -r share/* $(DESTDIR)/usr/share/statrec/$(VERSION)
    

    The DESTDIR thing is important; it will not be installing to the system, but instead to a temporary directory that dpkg will than pack up. All symlinks must point to the final destinations (without $(DESTDIR) prefix).

  2. Let dh_make --native do it's business (it will create another makefile debian/rules that will call the first makefile).

  3. Look at the files under debian. Especially debian/changelog may need editing (it's where debuild /dpkg-buildpackage get the version number from, so it must be filled in).

    I believe debuild uses fakeroot automatically, for dpkg-buildpackage you have to specify it manually. Don't even think about running it as real root.

  4. Use debuild or dpkg-buildpackage -rfakeroot to build it

No need to care for uninstalling as dpkg is going to handle that.

Update: I suggest dh_make --native, because I understood the question is for simply installing a handful of data files on a handful of debian systems. If it should be distributed, I suggest simply going to ask on the irc.debian.org#debian IRC channel and probably leaving it up to Debian Developer (only Debian Developers may upload to Debian archive and they usually want to handle the packaging themselves).

Also if it's part of software rather than stand-alone bunch of data files, the installation should be part of the general installation of the software using one common makefile, there should be just one Debian source package and just the debian/control and debian/*.files should specify which files go to the application package (which is "Architecture: any") and which files go to the data package (which is "Architecure: all" and usually gets suffix -data).

祁梦 2024-12-08 07:48:30

您应该阅读 debian-handbook

我发现为我自己的项目创建一个 .install 文件并跳过 Makefile 部分很有帮助

You should read section 15.2.2 in the debian-handbook.

I found it helpfull to just create a .install file and skip that Makefile part, for my own project

心安伴我暖 2024-12-08 07:48:30

我发现 saurik(以 cydia/jailbreak 闻名)的“托管 Cydia 存储库”指南对于创建您自己的 .deb 文件很有用。在这里查看:http://www.saurik.com/id/7

I found saurik's (of cydia/jailbreak fame) "Hosting a Cydia Repository" guide useful for creating your own .deb files. Have a look at it here: http://www.saurik.com/id/7

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文