How to create a simply debian package (just compress/extract sources or any files with debian packaging)

StackOverflow https://stackoverflow.com/questions/19029008

質問

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top