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

Re: Finding files for d/clean when using sbuild



On 11/9/20 11:50 PM, Baptiste Beauplat wrote:
> Hi Robin,
> 
> On 11/9/20 9:48 PM, Robin Gustafsson wrote:
>> More than once now, I've made the mistake of missing certain files
>> that ought to be added to debian/clean. I typically use sbuild when
>> building packages, so these extra files get thrown out after the build
>> anyways, so they're not obvious to me.
>>
>> What's the recommended way to find such left-over files after an
>> sbuild build?

Here is a more robust way (and more readable):

$external_commands = {
    "starting-build-commands" => [
        'bash -c \'find %SBUILD_PKGBUILD_DIR -print0 |
                  sort -z |
                  while read -d $\'\\\'\'\0\'\\\'\' file; do
                      echo -n "$(stat -c "%n %F %%s" "${file}") "
                      if [ -f "${file}" ]; then
                          sha256sum "${file}" |
                              cut -d " " -f 1
                      else
                              echo
                      fi
                  done > /tmp/file-list.pre-build\''
    ],
    "chroot-cleanup-commands" => [
        'cd %SBUILD_PKGBUILD_DIR && ./debian/rules clean',
        'bash -c \'find %SBUILD_PKGBUILD_DIR -print0 |
                  sort -z |
                  while read -d $\'\\\'\'\0\'\\\'\' file; do
                      echo -n "$(stat -c "%n %F %%s" "${file}") "
                      if [ -f "${file}" ]; then
                          sha256sum "${file}" |
                              cut -d " " -f 1
                      else
                              echo
                      fi
                  done > /tmp/file-list.post-build\'',
        'diff /tmp/file-list.pre-build /tmp/file-list.post-build'
    ]
};

Cc'ing the original bug since it might be helpful to others, please
remove it on reply.

-- 
Baptiste Beauplat - lyknode

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: