如何创建一个简单的debian软件包(仅压缩/提取源文件或任何带有debian软件包的文件) [英] How to create a simply debian package (just compress/extract sources or any files with debian packaging)

查看:756
本文介绍了如何创建一个简单的debian软件包(仅压缩/提取源文件或任何带有debian软件包的文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个Realxtend项目的新.deb包( https://github.com/realXtend/naali ).这是一个庞大的项目,具有很多依赖项,并且有一个自动bash脚本(/tools/Linux/build-deps.bash),用于下载,编译和安装所有dep和可执行文件.因此,我尝试了许多教程,但经常遇到一些错误,并且由于教程已过时(主要是带有新的"rules"文件)而被卡住了……而且还因为我不是一名开发人员.

因此,一开始,我只需要创建一个与简单存档完全相同的.deb文件即可,即不解释任何构建过程,"makefile"或其他类型的东西.我只想压缩/解压缩.deb文件,其中包含已配置有所有依赖项的所有项目,例如带有任何文件夹的.zip文件,解压缩存档旁边的所有内容.

我有2个文件夹/naali和/naali-deps,其中包含在Ubuntu Precise x64上运行build-deps.bash配置的各种文件(exe,src,lib等). 我运行dh_make, 清理并填充/debian文件(变更日志,控件,版权), 创建一个gpg密钥并运行sudo debuild -us -uc -k0xCODE(我听说'sudo'这很糟糕,但我不知道...)

我明白了:

 dpkg-buildpackage -rfakeroot -D -us -uc
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: source package realxtend
dpkg-buildpackage: source version 0-1
dpkg-buildpackage: source changed by sylvain Bicherel <sylvain.bicherel@gmail.com>
 dpkg-source --before-build realxtend-0
dpkg-buildpackage: host architecture amd64
 fakeroot debian/rules clean
dh clean 
   dh_testdir
   dh_auto_clean
   dh_clean
 dpkg-source -b realxtend-0
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building realxtend using existing ./realxtend_0.orig.tar.gz
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/Extras/CDTestFramework/License.txt.bak
dpkg-source: warning: ignoring deletion of directory naali-deps/build/bullet-2.81-rev2613/autom4te.cache
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/traces.1
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/output.1
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/requests
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/traces.0
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/output.0
dpkg-source: info: building realxtend in realxtend_0-1.debian.tar.gz
dpkg-source: info: building realxtend in realxtend_0-1.dsc
 debian/rules build
dh build 
   dh_testdir
   dh_auto_configure
   dh_auto_build
   dh_auto_test
 fakeroot debian/rules binary
dh binary 
   dh_testroot
   dh_prep
   dh_installdirs
   dh_auto_install
   dh_install
   dh_installdocs
   dh_installchangelogs
   dh_installexamples
   dh_installman
   dh_installcatalogs
   dh_installcron
   dh_installdebconf
   dh_installemacsen
   dh_installifupdown
   dh_installinfo
   dh_installinit
   dh_installmenu
   dh_installmime
   dh_installmodules
   dh_installlogcheck
   dh_installlogrotate
   dh_installpam
   dh_installppp
   dh_installudev
   dh_installwm
   dh_installxfonts
   dh_installgsettings
   dh_bugfiles
   dh_ucf
   dh_lintian
   dh_gconf
   dh_icons
   dh_perl
   dh_usrlocal
   dh_link
   dh_compress
   dh_fixperms
   dh_strip
   dh_makeshlibs
   dh_shlibdeps
   dh_installdeb
   dh_gencontrol
dpkg-gencontrol: warning: Depends field of package realxtend: unknown substitution variable ${shlibs:Depends}
   dh_md5sums
   dh_builddeb
dpkg-deb : construction du paquet « realxtend » dans « ../realxtend_0-1_amd64.deb ».
 dpkg-genchanges  >../realxtend_0-1_amd64.changes
dpkg-genchanges: including full source code in upload
 dpkg-source --after-build realxtend-0
dpkg-buildpackage: full upload (original source is included)
Now running lintian...
warning: the authors of lintian do not recommend running it with root privileges!
W: realxtend source: configure-generated-file-in-source naali-deps/build/celt-0.11.1/config.status
W: realxtend source: configure-generated-file-in-source naali-deps/build/celt-0.11.1/config.log
W: realxtend: new-package-should-close-itp-bug
W: realxtend: empty-binary-package
Finished running lintian.

...所以我需要以下方面的帮助:

1)除了'Debian New Maintenanceer'和irc/maillist(如#debian-dev ...)以外,您是否了解更新且完整的教程(针对新手)-->请参阅Phpdna链接以及我理解我的具体资源包装错误并使用dpkg-source cmd: http://debian-handbook .info/browse/wheezy/sect.source-package-structure.html

2)如何对我的项目进行去Debian化"? ->使用dh_make然后使用dpkg-buildpackage -rfakeroot,这是(a)好的方法

3)我的错误在哪里? ->空二进制文件lintian警告是正常的,然后是错误的cmd:需要dpkg-source,而不是dpkg-deb

4)我应该如何处理$ {shlibs:Depends}? ->自动的lib-deps-links东西,我现在不介意

5)为什么我有一个空二进制包? ->实际上,就我而言,所有已构建的数据都保留在.orig.tar.gz中

非常感谢您能启发我了解.deb软件包魔术.

所以我找到了我需要的最后一个cmd,仅dpkg-source -x projet-version.dsc.我不明白.deb文件的内容只会发生变化,并且我坚持使用debuilddpkg-deb -... cmds来构建而不是用于提取源(以及任何文件).

解决方案:

  1. sudo apt-get install debhelper build-essential dh-make
  2. 使用另一个文件夹创建文件夹/p​​roject,其中包含所有名为/project-version的项目
  3. /project-version中的
  4. dh_make --createorig +/debian中的rm -rf *ex *EX README* +正确填写/debian/{rules; copyright; changelog}
  5. /library版本中的
  6. dpkg-buildpackage -rfakeroot-us -uc-k0x[GPG-KEY]
  7. 始终保持在一起{project_version.orig.tar.gz(所有数据项目); project_version.debian.tar.gz(modifs); project_version_all/any.deb(修改); project_version_arch.changes(元); project_version.dsc(元)}
  8. 运行dpkg-source -x projet-version.dsc提取项目

现在,去添加一些自动脚本,一旦成功,我将标记为已解决.

解决方案

首先,您需要创建一个构建文件夹和一个文件存档:tar czvf data.tar.gz files

然后,在build文件夹中,您必须创建一个包含一些所需信息的控制文件:

 Package: xxxxxx
 Version: 0.0.1
 Section: user/hidden 
 Priority: optional
 Architecture: armel
 Installed-Size: `du -ks usr|cut -f 1`
 Maintainer: xxx@xxx.xx>

然后,您可以独立添加preinst,postint,prerm和postrm Shell脚本来控制.deb文件的安装前和安装后以及删除前和安装后的行为,然后可以使用tar创建控制存档:tar czvf control.tar.gz control preinst postinst prerm postrm

然后,您需要一个debian-binary文件:echo 2.0 > debian-binary.在构建文件夹中,现在应该具有以下文件:debian-binary control.tar.gzdata.tar.gz.

最后,您需要ar包来创建.deb文件:ar -r xxx.deb debian-binary control.tar.gz data.tar.gz

来源: https://unix.stackexchange .com/questions/30303/how-to-to-create-a-deb-file-manually/30330#30330

I need to create a new .deb package of Realxtend project (https://github.com/realXtend/naali). It's a huge project with a lot of dependencies and a automatic bash script (/tools/Linux/build-deps.bash) to download, compile and install all deps and executables. So I try many tutorials but I often some errors and i'm stuck because tutorials are outdated (with new 'rules' file mainly) ...and also because i'm not a dev initialy.

So, for beginning, I just need create a .deb file exactly like an simple archive ie not interpret any building process, 'makefile', or others kind of things. I would like just compress/uncompress a .deb file contains all project already configured with all dependencies like a .zip file with any folder, uncompress all content just next the archive.

I have 2 folders /naali and /naali-deps with various files (exe, src, lib,...) configured with running build-deps.bash on Ubuntu Precise x64. I run dh_make, clean and fill /debian files (changelog, control, copyright), create a gpg key and run sudo debuild -us -uc -k0xCODE (i heard 'sudo' it's "bad" but i don't know without...)

I get this :

 dpkg-buildpackage -rfakeroot -D -us -uc
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: source package realxtend
dpkg-buildpackage: source version 0-1
dpkg-buildpackage: source changed by sylvain Bicherel <sylvain.bicherel@gmail.com>
 dpkg-source --before-build realxtend-0
dpkg-buildpackage: host architecture amd64
 fakeroot debian/rules clean
dh clean 
   dh_testdir
   dh_auto_clean
   dh_clean
 dpkg-source -b realxtend-0
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building realxtend using existing ./realxtend_0.orig.tar.gz
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/Extras/CDTestFramework/License.txt.bak
dpkg-source: warning: ignoring deletion of directory naali-deps/build/bullet-2.81-rev2613/autom4te.cache
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/traces.1
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/output.1
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/requests
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/traces.0
dpkg-source: warning: ignoring deletion of file naali-deps/build/bullet-2.81-rev2613/autom4te.cache/output.0
dpkg-source: info: building realxtend in realxtend_0-1.debian.tar.gz
dpkg-source: info: building realxtend in realxtend_0-1.dsc
 debian/rules build
dh build 
   dh_testdir
   dh_auto_configure
   dh_auto_build
   dh_auto_test
 fakeroot debian/rules binary
dh binary 
   dh_testroot
   dh_prep
   dh_installdirs
   dh_auto_install
   dh_install
   dh_installdocs
   dh_installchangelogs
   dh_installexamples
   dh_installman
   dh_installcatalogs
   dh_installcron
   dh_installdebconf
   dh_installemacsen
   dh_installifupdown
   dh_installinfo
   dh_installinit
   dh_installmenu
   dh_installmime
   dh_installmodules
   dh_installlogcheck
   dh_installlogrotate
   dh_installpam
   dh_installppp
   dh_installudev
   dh_installwm
   dh_installxfonts
   dh_installgsettings
   dh_bugfiles
   dh_ucf
   dh_lintian
   dh_gconf
   dh_icons
   dh_perl
   dh_usrlocal
   dh_link
   dh_compress
   dh_fixperms
   dh_strip
   dh_makeshlibs
   dh_shlibdeps
   dh_installdeb
   dh_gencontrol
dpkg-gencontrol: warning: Depends field of package realxtend: unknown substitution variable ${shlibs:Depends}
   dh_md5sums
   dh_builddeb
dpkg-deb : construction du paquet « realxtend » dans « ../realxtend_0-1_amd64.deb ».
 dpkg-genchanges  >../realxtend_0-1_amd64.changes
dpkg-genchanges: including full source code in upload
 dpkg-source --after-build realxtend-0
dpkg-buildpackage: full upload (original source is included)
Now running lintian...
warning: the authors of lintian do not recommend running it with root privileges!
W: realxtend source: configure-generated-file-in-source naali-deps/build/celt-0.11.1/config.status
W: realxtend source: configure-generated-file-in-source naali-deps/build/celt-0.11.1/config.log
W: realxtend: new-package-should-close-itp-bug
W: realxtend: empty-binary-package
Finished running lintian.

...so i need help on :

1) Do you know a updated and complete tutorial (for newbie) other than 'Debian New Maintainer' and irc/maillist like #debian-dev... -> see Phpdna link and for specific sources packaging where i understand my error and use dpkg-source cmd : http://debian-handbook.info/browse/wheezy/sect.source-package-structure.html

2) How do make a 'debianization' of my project ? -> with dh_make then dpkg-buildpackage -rfakeroot, it's the (a) good way

3) Where are my errors ? -> empty-binaries-files lintian warning is normal, then wrong cmd : need dpkg-source, not dpkg-deb

4) What should I do with ${shlibs:Depends} ? -> an automatic lib-deps-links thing, i don't mind on that now

5) Why I have a empty-binary-package ? -> in fact, all data already build stay in .orig.tar.gz in my case

Thanks a lot if you can enlighten me on .deb package magic.

EDIT : So i found the final cmd i need, just dpkg-source -x projet-version.dsc. I didn't understand .deb file contents only changes and i stucked with debuild and dpkg-deb -... cmds for building not for extract sources (and any files).

Solution :

  1. sudo apt-get install debhelper build-essential dh-make
  2. create folder /project with another folder into contains all project named /project-version
  3. dh_make --createorig in /project-version + rm -rf *ex *EX README* in /debian + fill correctly /debian/{rules;copyright;changelog}
  4. dpkg-buildpackage -rfakeroot with -us -uc or -k0x[GPG-KEY] in /project-version
  5. Keep always together {project_version.orig.tar.gz (all data projects); project_version.debian.tar.gz (modifs); project_version_all/any.deb (modifs); project_version_arch.changes (meta); project_version.dsc (meta)}
  6. Run dpkg-source -x projet-version.dsc to extract project

So now, go to add some automatic scripts with it and as soon as it will succes, i will mark resolved.

解决方案

First off you need to create a build folder and an archive of your files: tar czvf data.tar.gz files

Then in the build folder you must create a control file with some wanted informations:

 Package: xxxxxx
 Version: 0.0.1
 Section: user/hidden 
 Priority: optional
 Architecture: armel
 Installed-Size: `du -ks usr|cut -f 1`
 Maintainer: xxx@xxx.xx>

Then you can add independently preinst, postint, prerm and postrm shell scripts to control pre and post install and pre and post remove behaviour of the .deb file and then you can create the control archive with tar: tar czvf control.tar.gz control preinst postinst prerm postrm

Then you need a debian-binary file: echo 2.0 > debian-binary. In your build folder you should have now these files: debian-binary control.tar.gz and data.tar.gz.

Finally you need ar package to create the .deb file: ar -r xxx.deb debian-binary control.tar.gz data.tar.gz

Source: https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually/30330#30330

这篇关于如何创建一个简单的debian软件包(仅压缩/提取源文件或任何带有debian软件包的文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆