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

Re: Tips for debugging/testing debian/control Depends/Breaks etc changes?



On Wed, 24 Mar 2021, Otto Kek?l?inen wrote:

Hello!

I've noticed I've spent quite a lot of time debugging various
situations where the debian/control definitions for
depends/breaks/replaces/conflicts/provides are not optimal.

The waste of time is two-fold:

1) apt is not verbose enough
2) the cycle to rebuild/tests is too slow

For the problem 2, I hate to rebuild all of the packages (and
binaries) just because there was a change in debian/control and go
through the hassle of updating a test repo etc.

I wonder if there is some other "lighter" way to just edit the
debian/control and produce new binary packages with them updated
without having to actually build new binary packages (and no, editing
the .deb files manually and repackaging them with 'ar' is not an
option that would make life easier).


You'll need to modify it as it is rather tied to my disk layout but I
use the script below to do this. (Not sure if you think this is the same
as repackaging with ar or not)


Basically I create an empty file in patches/sid/<package>.patch

Then run the script ./patch_deb.sh sid

This will create sid/patch/<package> and sid/patch/<package>.orig and
rebuild the package as package_<version>+tjw.deb

Then, to make changes, just edit the files in <package> and rerun it and
it will recreate the patch and rebuild the package.

All of the .orig and patch stuff can obviously be eliminated. I do it
like this because I keep the patches in git and I want the script to be
able to restart from where I got to on a clean checkout.

Regards,

Tim.

#!/bin/bash

DIST=$1

set -xe

for i in patches/${DIST}/*.patch; do

  [[ -f $i ]] || continue

  pkg=${i##*/}
  pkg=${pkg%.patch}

  if [[ ! -d ${DIST}/patch/$pkg ]]; then

    mkdir -p ${DIST}/patch/$pkg/DEBIAN
    mkdir -p ${DIST}/patch/$pkg.orig/DEBIAN

    dpkg -x ${DIST}/packages/pool/${pkg}_*.deb ${DIST}/patch/$pkg
    dpkg -e ${DIST}/packages/pool/${pkg}_*.deb ${DIST}/patch/$pkg/DEBIAN

    dpkg -x ${DIST}/packages/pool/${pkg}_*.deb ${DIST}/patch/$pkg.orig
    dpkg -e ${DIST}/packages/pool/${pkg}_*.deb ${DIST}/patch/$pkg.orig/DEBIAN

    (
      cd ${DIST}/patch/$pkg
      patch -p1 <../../../$i
      sed -i '/^Version:/ { /+tjw$/! s/$/+tjw/ }' DEBIAN/control
    )

  fi

  ( cd ${DIST}/patch/ && diff -urN $pkg.orig $pkg > ../../$i || true )

  dpkg -b ${DIST}/patch/$pkg
  ver=$( sed -n 's/^Version: *//p' ${DIST}/patch/$pkg/DEBIAN/control )
  arch=$( sed -n 's/^Architecture: *//p' ${DIST}/patch/$pkg/DEBIAN/control )
  mv ${DIST}/patch/$pkg.deb ${DIST}/packages/pool/${pkg}_${ver}_${arch}.deb

done

exit 0


Reply to: