[PATCH] repo-add: do not recreate the database if nothing was changed
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> --- When `repo-add` is used to add a package that already exists in the database, it will recompress the database unconditionally, even if `--new` is passed. Avoid doing that. scripts/repo-add.sh.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 221abdc0..78195de1 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -44,6 +44,8 @@ USE_COLOR='y' PREVENT_DOWNGRADE=0 INCLUDE_SIGS=0 +ENTRIES_CHANGED=0 + # Import libmakepkg source "$LIBRARY"/util/compress.sh source "$LIBRARY"/util/message.sh @@ -343,6 +345,8 @@ db_write_entry() { rm -f ${oldfile} ${oldfile}.sig fi + (( ++ENTRIES_CHANGED )) + return 0 } # end db_write_entry @@ -365,6 +369,9 @@ db_remove_entry() { pkgentry=$(find_pkgentry "$pkgname") done + if [[ $notfound == 0 ]]; then + (( ++ENTRIES_CHANGED )) + fi return $notfound } # end db_remove_entry @@ -684,13 +691,13 @@ for arg in "${args[@]:1}"; do done # if the whole operation was a success, re-zip and rotate databases -if (( !fail )); then +if (( !fail )) && (( ENTRIES_CHANGED > 0 )); then msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE" create_db rotate_db else msg "$(gettext "No packages modified, nothing to do.")" - exit 1 + exit $(( fail != 0 )) fi exit 0 -- 2.38.0
On 2022-10-14 at 08:19 +0400, Ivan Shapovalov wrote:
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> ---
When `repo-add` is used to add a package that already exists in the database, it will recompress the database unconditionally, even if `--new` is passed. Avoid doing that.
ping?
scripts/repo-add.sh.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 221abdc0..78195de1 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -44,6 +44,8 @@ USE_COLOR='y' PREVENT_DOWNGRADE=0 INCLUDE_SIGS=0 +ENTRIES_CHANGED=0 + # Import libmakepkg source "$LIBRARY"/util/compress.sh source "$LIBRARY"/util/message.sh @@ -343,6 +345,8 @@ db_write_entry() { rm -f ${oldfile} ${oldfile}.sig fi + (( ++ENTRIES_CHANGED )) + return 0 } # end db_write_entry @@ -365,6 +369,9 @@ db_remove_entry() { pkgentry=$(find_pkgentry "$pkgname") done + if [[ $notfound == 0 ]]; then + (( ++ENTRIES_CHANGED )) + fi return $notfound } # end db_remove_entry @@ -684,13 +691,13 @@ for arg in "${args[@]:1}"; do done # if the whole operation was a success, re-zip and rotate databases -if (( !fail )); then +if (( !fail )) && (( ENTRIES_CHANGED > 0 )); then msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE" create_db rotate_db else msg "$(gettext "No packages modified, nothing to do.")" - exit 1 + exit $(( fail != 0 )) fi exit 0
On Tue, Feb 07, 2023 at 08:03:31PM +0400, Ivan Shapovalov wrote:
On 2022-10-14 at 08:19 +0400, Ivan Shapovalov wrote:
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> ---
When `repo-add` is used to add a package that already exists in the database, it will recompress the database unconditionally, even if `--new` is passed. Avoid doing that.
ping?
The pacman development was moved to gitlab in December. Please submit the patch as a merge request to the gitlab repo. https://gitlab.archlinux.org/pacman/pacman -- Morten Linderud PGP: 9C02FF419FECBE16
On 8/2/23 18:42, Morten Linderud wrote:
On Tue, Feb 07, 2023 at 08:03:31PM +0400, Ivan Shapovalov wrote:
On 2022-10-14 at 08:19 +0400, Ivan Shapovalov wrote:
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> ---
When `repo-add` is used to add a package that already exists in the database, it will recompress the database unconditionally, even if `--new` is passed. Avoid doing that.
ping?
The pacman development was moved to gitlab in December. Please submit the patch as a merge request to the gitlab repo.
This patch is already tracked at: https://gitlab.archlinux.org/pacman/pacman/-/issues/1 Adding a merge request will not achieve much. Allan
On Wed, Feb 08, 2023 at 07:31:36PM +1000, Allan McRae wrote:
On 8/2/23 18:42, Morten Linderud wrote:
On Tue, Feb 07, 2023 at 08:03:31PM +0400, Ivan Shapovalov wrote:
On 2022-10-14 at 08:19 +0400, Ivan Shapovalov wrote:
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> ---
When `repo-add` is used to add a package that already exists in the database, it will recompress the database unconditionally, even if `--new` is passed. Avoid doing that.
ping?
The pacman development was moved to gitlab in December. Please submit the patch as a merge request to the gitlab repo.
This patch is already tracked at: https://gitlab.archlinux.org/pacman/pacman/-/issues/1
Adding a merge request will not achieve much.
It's better to have the original author submit the patch as a merge-request and go through normal code review? I don't understand why you would insist on doing it any other way when the author is interested. -- Morten Linderud PGP: 9C02FF419FECBE16
On 8/2/23 23:16, Morten Linderud wrote:
On Wed, Feb 08, 2023 at 07:31:36PM +1000, Allan McRae wrote:
On 8/2/23 18:42, Morten Linderud wrote:
On Tue, Feb 07, 2023 at 08:03:31PM +0400, Ivan Shapovalov wrote:
On 2022-10-14 at 08:19 +0400, Ivan Shapovalov wrote:
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> ---
When `repo-add` is used to add a package that already exists in the database, it will recompress the database unconditionally, even if `--new` is passed. Avoid doing that.
ping?
The pacman development was moved to gitlab in December. Please submit the patch as a merge request to the gitlab repo.
This patch is already tracked at: https://gitlab.archlinux.org/pacman/pacman/-/issues/1
Adding a merge request will not achieve much.
It's better to have the original author submit the patch as a merge-request and go through normal code review? I don't understand why you would insist on doing it any other way when the author is interested.
It is a tiny 10 line patch (including new blank lines). If changes need made, it will be easier for me to do them when I review/apply it. It will be quicker for me, and less work for the author. Allan
On 2023-02-08 at 09:42 +0100, Morten Linderud wrote:
On Tue, Feb 07, 2023 at 08:03:31PM +0400, Ivan Shapovalov wrote:
On 2022-10-14 at 08:19 +0400, Ivan Shapovalov wrote:
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> ---
When `repo-add` is used to add a package that already exists in the database, it will recompress the database unconditionally, even if `--new` is passed. Avoid doing that.
ping?
The pacman development was moved to gitlab in December. Please submit the patch as a merge request to the gitlab repo.
I see. I'll do that -- thanks. -- Ivan Shapovalov / intelfx /
participants (3)
-
Allan McRae
-
Ivan Shapovalov
-
Morten Linderud