Set biblatex aux file name

I am using biblatex with refsection=chapter. That results in aux files named according to this pattern, assuming a source file called book.tex for a book of n chapters:

book1-blx.aux
book2-blx.aux
...
bookn-blx.aux


Is there a hook to change that name? I need to associate the aux file to its corresponding chapter (these files are used in other processes) For example:

book_chaplabel-blx.aux


I think I can add a hook inside the include command so I can grab the chapter file name, but I don't know where to hook it up to the generated aux file name.

EDITING for clarity:

It may be that trying to substitute the chaptername in for the integer isn't the right way to solve the problem. The main thing is that I need a way to associate the aux file with the chapter it came from. I must post-process the bbl files and aux files for each chapter. The post-processed files are used in a different workflow (epub/docbook generation).

-
Just in case you would rather get around this whole problem, if you use biber as the backend instead of bibtex, it requires only one run and this multiple file issue doesn't exist. –  PLK Sep 5 '12 at 18:34

The numeric part of the auxiliary filename corresponds to the reference section counter (the same value returned by \therefsection). The filename suffix (-blx) corresponds to \blxauxsuffix. This can be redefined with \renewcommand in the preamble. The filename prefix is hardcoded as \jobname.

You could patch biblatex internals to add chapter filenames, but these need to be defined in the preamble. So hooking into \include is too late. One workaround is to specify an ordered list of chapter filenames in the preamble.

Here's an example that replaces the reference section number with chapter filenames. The chapter filenames are passed to a new command \blxauxprefix as a comma-separated list.

\documentclass{report}
\usepackage[backend=bibtex,refsection=chapter]{biblatex}

\makeatletter

\def\blxauxprefix#1{%
\defcounter{listcount}{0}%
\def\do##1{\stepcounter{listcount}\csgdef{blxauxprefix:\the\c@listcount}{-##1}}%
\docsvlist{#1}}

\patchcmd{\blx@refsection@bibtex}
{\jobname\the\c@refsection\blxauxsuffix}
{\jobname\csuse{blxauxprefix:\the\c@refsection}\blxauxsuffix}{}{}

\patchcmd{\blx@bblfile@bibtex}
{\jobname\the\c@refsection\blxauxsuffix}
{\jobname\csuse{blxauxprefix:\the\c@refsection}\blxauxsuffix}{}{}

\apptocmd{\include}
{\ifcsstring{blxauxprefix:\the\c@refsection}{#1}{}
{\blx@warning{%
'aux' file prefix does not match \MessageBreak
'\@backslashchar include' filename #1}}}{}{}

\makeatother

\blxauxprefix{chap1,chap2}

\begin{filecontents}{chap1.tex}
\chapter{First chapter}
\cite{ctan}
\end{filecontents}

\begin{filecontents}{chap2.tex}
\chapter{Second chapter}
\cite{companion,knuth:ct}
\end{filecontents}

\ifnumgreater{\therefsection}{0}
{References for Chapter \ref{refsection:\therefsection}}
{References before chapters}}}

\begin{document}
\cite{markey}
\include{chap1}
\include{chap2}