[pacman-dev] makechrootpkg and $PKGDEST

Aaron Griffin aaronmgriffin at gmail.com
Fri Sep 4 22:36:59 EDT 2009


On Fri, Sep 4, 2009 at 8:27 PM, Allan McRae<allan at archlinux.org> wrote:
> bardo wrote:
>>
>> Is it my impression or there are some problems with $SRCDEST and
>> $PKGDEST? I didn't define any of these variables in both my
>> makepkg.conf, the guest one and the chroot one. In makechrootpkg,
>> lines 155-157, I see:
>>
>> ---------
>> source $uniondir/etc/makepkg.conf
>>
>> [ -d "$uniondir/pkgdest" ] || mkdir "$uniondir/pkgdest"
>> if ! grep "PKGDEST=/pkgdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1;
>> then
>>    echo "Setting PKGDEST in makepkg.conf"
>>    echo "PKGDEST=/pkgdest" >> "$uniondir/etc/makepkg.conf"
>> fi
>>
>> [ -d "$uniondir/srcdest" ] || mkdir "$uniondir/srcdest"
>> if ! grep "SRCDEST=/srcdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1;
>> then
>>    echo "Setting SRCDEST in makepkg.conf"
>>    echo "SRCDEST=/srcdest" >> "$uniondir/etc/makepkg.conf"
>> fi
>> ---------
>>
>> So here the chroot's makepkg.conf gets sourced, and it shouldn't
>> inherit any of these variables, but they get forced (in the chroot) to
>> /pkgdest and /srcdest. Problem is, later (lines 240-248) the files
>> don't get moved to $WORKDIR as before, but they go to $PKGDEST, which
>> *should* be empty (because it's the guest system's pkgdest, which got
>> sourced before adding the variables there):
>>
>> ---------
>>        if [ -e $pkgfile ]; then
>>            if [ -n "$PKGDEST" ]; then
>>                echo "Moving completed ${_pkgname} package file to
>> ${PKGDEST}"
>>                mv $pkgfile "${PKGDEST}"
>>            else
>>                echo "Moving completed ${_pkgname} package file to
>> ${WORKDIR}"
>>                mv $pkgfile "${WORKDIR}"
>>            fi
>>        fi
>> ---------
>>
>> I don't understand because they go the /{src,pkg}dest, but it looks
>> like they shouldn't. Even more, there's no directory check on the
>> guest system, so guess what... if the dirs don't exist, the source and
>> dest files get renamed to /srcdest and /pkgdest respectively...
>>
>> This looks like a bug to me, but given how many times I am wrong
>> (especially at 2 a.m.) I'd prefer to wait for some feedback before
>> opening one.
>>
>
> This is indeed a bug.  makechroot package no longer copies the users
> /etc/makepkg.conf due to this commit:
> http://projects.archlinux.org/?p=devtools.git;a=commit;h=4bc819a2
>
> That means that makechrootpkg is run for the second time and
> $uniondir/etc/makepkg.conf is sourced, these variables will be set to
> /srcdir and /pkgdir because we are now sourcing the makepkg.conf from the
> previous run.  Thus breakage occurs...
>
> A workaround is to do this (in sudo patch format):
>
>       if [ -e $pkgfile ]; then
> -            if [ -n "$PKGDEST" ]; then
> -                echo "Moving completed ${_pkgname} package file to
> ${PKGDEST}"
> -                mv $pkgfile "${PKGDEST}"
> -            else
>               echo "Moving completed ${_pkgname} package file to ${WORKDIR}"
>               mv $pkgfile "${WORKDIR}"
> -            fi
>       fi
>
> but now we have no PKGDEST/SRCDEST support in makechrootpkg...
>
> Please file a bug report.

It's worth noting that I never liked the handling of PKGDEST and
SRCDEST in makechrootpkg. If anyone wants to totally revamp that
handling, I'd love you forever


More information about the pacman-dev mailing list