Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Build binary/source package from DEBIAN

User discussion about Debian Development, Debian Project News and Announcements. Not for support questions.
Post Reply
Message
Author
axben
Posts: 4
Joined: 2020-10-16 13:06

Build binary/source package from DEBIAN

#1 Post by axben »

Having only a binary package at hand, how would I construct a new (updated) package from the base one?

What I did:

md pac-2.0
cd pac-2.0

ar x ../<package>.deb (-> control.tar.gz, data.tar.gz, and debian-binary)
tar -xf data.tar.gz (-> files in ./bin, ./share)

md debian
cd debian
tar -xf ../control.tar.gz (some control files)

cd ..
dh_make --addmissing

rm <no_longer_used_extracted_files_from_deb_package>
ls (->seeing ./debian, ./bin, and ./share)

dpkg-buildpackage --build=binary

The usual files are created but pac_2.0-*.deb does not contain the files from data.tar.gz.

As I'm pretty new to this, this might be the complete wrong way of doing this; however, I don't want to ressort to using dpkg-deb --raw-extract/--build...

User avatar
metreo
Posts: 20
Joined: 2020-10-08 19:15

Re: Build binary/source package from DEBIAN

#2 Post by metreo »

Shouldn't this be done in a chroot environment?

axben
Posts: 4
Joined: 2020-10-16 13:06

Re: Build binary/source package from DEBIAN

#3 Post by axben »

Tried that. Makes no difference with fakeroot dpkg-buildpackage --build=binary.

I also tried to move said directories (namely ./bin and ./share) to ./debian/pac2.0/usr but the files get deleted from there.

I'm completely lost.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Build binary/source package from DEBIAN

#4 Post by Head_on_a_Stick »

I think you'll need to add either debian/rules or debian/pac.install — see https://www.debian.org/doc/manuals/debm ... html#rules & dh_install(1) for more on this.

But why not just use 'apt source'?
deadbang

axben
Posts: 4
Joined: 2020-10-16 13:06

Re: Build binary/source package from DEBIAN

#5 Post by axben »

I tried dh_install and it correctly copied ./bin and ./share to the corresponding directories below ./debian/<package>. From what I've read this is WAD.

However, on running dpkg-packagebuild --binary the copied files get deleted and the resulting <package>.deb does not contain them.

I'm even loster ;-)

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Build binary/source package from DEBIAN

#6 Post by Head_on_a_Stick »

Did you create an install file in the debian directory? Without that file dh_install(1) won't do anything.
deadbang

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Build binary/source package from DEBIAN

#7 Post by stevepusser »

dpkg-buildpackage builds packages from source. You don't have the source at all when you unpack a deb archive, or even the files that tell that command what to do.

Dpkg already has the tools for unpacking a deb, changing a text file, and repacking them into a deb. If that's all you need, why not use them?

If you want to make more changes than that, such as add files to the deb that were not there to begin with, then you'd have to go back to building the package from the original source. But Debian likes you to either make those changes to the source with a patch, or install them from the /debian folder during the build.
Last edited by stevepusser on 2020-10-19 04:42, edited 1 time in total.
MX Linux packager and developer

axben
Posts: 4
Joined: 2020-10-16 13:06

Re: Build binary/source package from DEBIAN

#8 Post by axben »

@stevepusser
I've had to learn this by now ;-)
However, as I said before, we only have what we got...

@Head_on_a_Stick
Your hint regarding the install file saved me the day (as I said, I'm new to this...)
I finally got it to work with the following setup:

Code: Select all

pac-2.0
 - debian
   - pac.install
     | ../usr/...   ./tmp/usr/... |
 - usr (additions)
   - bin
   - share
@all: THANKS!

Post Reply