On 22/5/19 2:04 pm, Eli Schwartz wrote:
> On 5/8/19 4:06 AM, [email protected] wrote:
>> From: ekardnam <[email protected]>
>>
>> Reference bug in the bug tracker is at #FS17752
>>
>> Signed-off-by: Luca Bertozzi <[email protected]>
>> ---
>>  scripts/repo-add.sh.in | 22 ++++++++++++++++++----
>>  1 file changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
>> index 57413df5..e2eb06e3 100644
>> --- a/scripts/repo-add.sh.in
>> +++ b/scripts/repo-add.sh.in
>> @@ -42,6 +42,7 @@ REPO_DB_SUFFIX=
>>  LOCKFILE=
>>  CLEAN_LOCK=0
>>  USE_COLOR='y'
>> +PREVENT_DOWNGRADE=0
>>  
>>  # Import libmakepkg
>>  source "$LIBRARY"/util/message.sh
>> @@ -63,6 +64,8 @@ Multiple packages to add can be specified on the command 
>> line.\n")"
>>              printf -- "$(gettext "Options:\n")"
>>              printf -- "$(gettext "  -n, --new         only add packages 
>> that are not already in the database\n")"
>>              printf -- "$(gettext "  -R, --remove      remove old package 
>> file from disk after updating database\n")"
>> +            printf -- "$(gettext "  -p, --prevent-downgrade  do not add 
>> package to database if a newer version is already present\n")"
>> +            printf -- "$(gettext "  --no-timestamp    do not add a 
>> timestamp to the repository")"
> 
> What is this option about timestamps doing?
> 

I'm assuming this is for work on another bug.  I'll handle removing that
line as the rest looks fine.

A

>>      elif [[ $cmd == "repo-remove" ]] ; then
>>              printf -- "$(gettext "Usage: repo-remove [options] <path-to-db> 
>> <packagename> ...\n")"
>>              printf -- "\n"
>> @@ -248,9 +251,17 @@ db_write_entry() {
>>                      return 0
>>              fi
>>      else
>> -            if (( RMEXISTING )); then
>> -                    pkgentry=$(find_pkgentry "$pkgname")
>> -                    if [[ -n $pkgentry ]]; then
>> +            pkgentry=$(find_pkgentry "$pkgname")
>> +            if [[ -n $pkgentry ]]; then
>> +
>> +                    local version=$(sed -n '/^%VERSION%$/ {n;p;q}' 
>> "$pkgentry/desc")
>> +                    if (( $(vercmp "$version" "$pkgver") > 0 )); then
>> +                            warning "$(gettext "A newer version for '%s' is 
>> already present in database")" "$pkgname"
>> +                            if (( PREVENT_DOWNGRADE )); then
>> +                                    return 0
>> +                            fi
>> +                    fi
>> +                    if (( RMEXISTING )); then
>>                              local oldfilename="$(sed -n '/^%FILENAME%$/ 
>> {n;p;q;}' "$pkgentry/desc")"
>>                              local oldfile="$(dirname "$1")/$oldfilename"
>>                      fi
>> @@ -464,7 +475,7 @@ remove() {
>>              error "$(gettext "Package matching '%s' not found.")" "$pkgname"
>>              return 1
>>      fi
>> -    
>> +
>>      return 0
>>  }
>>  
>> @@ -618,6 +629,9 @@ while (( $# )); do
>>              -v|--verify)
>>                      VERIFY=1
>>                      ;;
>> +            -p|--prevent-downgrade)
>> +                    PREVENT_DOWNGRADE=1
>> +                    ;;
>>              *)
>>                      args+=("$1")
>>                      ;;
>>
> 
> 

Reply via email to