[pacman-dev] [PATCH 3/4] repo-add : remove the need of realpath for REPO_DB_FILE

Xavier shiningxc at gmail.com
Thu Feb 19 08:46:19 EST 2009


On Thu, Feb 19, 2009 at 2:23 PM, Dan McGee <dpmcgee at gmail.com> wrote:
> On Thu, Feb 19, 2009 at 1:51 AM, Xavier <shiningxc at gmail.com> wrote:
>> On Thu, Feb 19, 2009 at 2:24 AM, Dan McGee <dpmcgee at gmail.com> wrote:
>>> On Wed, Feb 18, 2009 at 10:19 AM, Xavier Chantry <shiningxc at gmail.com> wrote:
>>>> REPO_DB_FILE does not need to be an absolute path anymore so no need to
>>>> call realpath.
>>>>
>>>> Signed-off-by: Xavier Chantry <shiningxc at gmail.com>
>>>> ---
>>>>  scripts/repo-add.sh.in |   31 +++++++++++++++----------------
>>>>  1 files changed, 15 insertions(+), 16 deletions(-)
>>>>
>>>>
>>>> -               bsdtar -c${TAR_OPT}f "$REPO_DB_FILE" *
>>>> +       pushd "$gstmpdir" 2>&1 >/dev/null
>>>> +       if [ -n "$(ls)" ]; then
>>>> +               bsdtar -c${TAR_OPT}f "$filename" *
>>>>        else
>>>> -               # we should only end up with an empty db after a remove of the last package in the database
>>>>                error "$(gettext "All packages have been removed from the database. Deleting '%s'.")" "$REPO_DB_FILE"
>>>> -               rm "$REPO_DB_FILE"
>>> Huh? Why'd this get killed, or am I missing something?
>>>
>>
>> I really cannot blame you for it, I knew this message would be
>> confusing, but I was not sure how to change it. Because the result is
>> still the same.
>> In this case, "$filename" was not created, but "$REPO_DB_FILE" exists.
>> So the first line below will move the $repodb to $repodb.old
>> But $filename wont be moved to $repodb. As a result the database has
>> been deleted (at least moved to .old)
>
> Mind writing that in comment form, inline in the code? That would keep
> me from being confused ever again. :)
>

Sure, would this work?

    # the database will be moved to .old below, and there will be no
new one to replace it
    error "$(gettext "All packages have been removed from the
database. Deleting '%s'.")" "$REPO_DB_FILE"

If yes, it is on my working branch :)


More information about the pacman-dev mailing list