[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The simpliest way to automatically rebuild few Debian packages ?



Hi,

On 2020-04-21 16:44:57 +0300, Reco wrote:
> On Tue, Apr 21, 2020 at 03:23:37PM +0200, Thomas Martin wrote:
> > My goal is simple : I'm applying few modifications on some Debian
> > packages and would like those packages to be rebuilt with my changes
> > when a new package version is available.
> 
> apt install apt-build
> 
> Requires some scripting to run without a human intervention, it's
> relatively simple.

Can it handle the rebuild for multiple architectures?
And can one provide a log message associated with each patch?

FYI, I currently use a script (one for each source package)
based on common functions (attached).

A typical script consists of:

------------------------------------------------------------
#!/usr/bin/env zsh

set -e

. $0:h/mkdebs-functions

apt-get source -t unstable <package_name>

cd <package_name>-*

[patch code]

dch -l +local "<log message>"

md_build "$@"
------------------------------------------------------------

Note that mkdebs-functions does the cd to a temporary directory.

If I wish to add another patch before the rebuild, I can insert:

[patch code 2]
dch -a "<log message 2>"

If I wish to add another patch after a rebuild (so that I need
to increase the local version):

[patch code 2]
dch -l +local "<log message 2>"

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
# mkdebs support
#
# Note: the shell must be zsh so that "trap" behaves as wanted
# (POSIX does not provide enough specification).
#
# The md_build function optionally takes architectures in arguments.

debdir=$HOME/software/deb
tmpdir=$(mktemp -d /tmp/mkdebs-XXXXXXXX)

cleanup_and_exit()
{
  local exitstat=$?
  echo "Clean-up..."
  rm -rf -- $tmpdir
  exit $exitstat
}

trap cleanup_and_exit EXIT SIGHUP SIGINT SIGQUIT SIGTERM

cd $tmpdir

md_build()
{
  local i
  # Use debuild in order to have a sanitized environment for the build.
  # There must be no spaces between the "-a" option and its value; see
  #   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898706
  for i in '' $@
  do
    printf > /dev/tty "\e]2;Build of %s${i:+ for $i}\x07" \
      "$(head -n 1 debian/changelog | sed 's/(\([^)]*\)).*/\1/')"
    debuild -i -us -uc -b ${=i:+-a$i}
  done
  cd ..
  mkdir -p "$debdir"
  mv -v *.deb "$debdir"
}

# local variables:
# mode: sh
# eval: (sh-set-shell "zsh")
# end:
#
# $Id: mkdebs-functions 125239 2020-02-10 13:26:05Z vinc17/cventin $

Reply to: