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

Dan McGee dpmcgee at gmail.com
Thu Feb 19 08:23:36 EST 2009


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. :)

>>>        fi
>>> -
>>>        popd 2>&1 >/dev/null
>>> +
>>> +       [ -f "$REPO_DB_FILE" ] && mv -f "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
>>> +       [ -f "$gstmpdir/$filename" ] && mv "$gstmpdir/$filename" "$REPO_DB_FILE"
>>>  else
>>>        msg "$(gettext "No packages modified, nothing to do.")"
>>>  fi
>>> --
>>> 1.6.1.3

The rest seems sane, make that fix and I'll pull it in.


More information about the pacman-dev mailing list