Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Let's assume:

  • I have a mirror of the source repository locally.
  • I only want to build for the architecture I'm running, which is i386 in my case.
  • I'm not interested in customisation. In fact, I want the resulting binary packages to be as close to official ones as possible. From there on, I'll take care of how they are organised. I think I'll use reprepro.
  • I want it to be as easy as possible.
share|improve this question
1  
For modern RPM-based distributions, the answer is: run mock in a loop, and then deal with the fringe cases by hand. (This is how CentOS is built from RHEL source, for example.) I have no idea about the Debian/dpkg equivalent, though, which is why this is a comment rather than an answer. –  mattdm Mar 7 '11 at 21:33

2 Answers 2

Debian already does this internally, to build the binary packages that they offer for download, and most of the tools is in the distribution. (Everything except some glue scripts, I think.)

Tools that may interest you include:

  • debian-builder: rebuild packages from source code
  • buildd, buildd: automatically build some packages
  • pbuilder: personal package builder (in a chroot, mainly intended for Debian developers)
  • More generally, look at packages tagged devel::debian or works-with::software:source (aptitude search '?tag(devel::debian) | ?tag(works-with::software:source)').
share|improve this answer

Maybe something like this?

#!/bin/bash

# This gets a list of all available packages
for i in $(dpkg -l \* | awk '/^[a-z]/ {print $2}')
do
  # This downloads and unpacks the source.
  # Any src packages already properly unpacked in the cwd won't be downloaded a second time.
  apt-get source $i
  apt-get build-dep -y $i
done

# This finds all buildable directories
for i in $(find . -name debian -type d | sed s/debian.*//g)
do
  cd $i
  debian/rules binary
  cd -
done

I know you said that you have the packages already, but I'm not sure what format they are in. If you already have all the packages properly unpacked in your cwd then apt will skip that package and move onto the next one. You can also pass -s to apt-get to test the commands.

Almost all packages should build in one shot like this, if you're using the same release that you're trying to build.

You will need lots of storage, and lots of time.

share|improve this answer
    
What u mean by apt will skip that package...? –  Tshepang Mar 8 '11 at 18:56
    
What does dpkg -l \* | awk '/^[a-z]/ {print $2}' do exactly? –  Tshepang Mar 8 '11 at 18:58
1  
@tshepang when I say "apt will skip" I mean that apt will skip downloading any source package that is already properly downloaded and unpacked. The dpkg | awk command gets a unique list of all packages available in your /etc/sources.list. –  bahamat Mar 8 '11 at 21:54
    
You wanna add these clarifications to the answer itself? –  Tshepang Mar 8 '11 at 21:57
    
@tshepang updated. –  bahamat Mar 9 '11 at 5:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.