help-gnuzilla
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makeicecat fails for a miscalculation of the version of rename


From: chippy
Subject: Re: makeicecat fails for a miscalculation of the version of rename
Date: Sun, 22 Jan 2023 15:30:44 +0100

This works on Debian but unfortunately not on a live instance of Arch
(with perl-rename installed with pacman) where --nofullpath is an
unrecognized option.

Arch maintains Icecat, interesting, this is their patch for the version
check, as you mentioned, they add an extra step in case of the pederst
variant.

Anyway, from https://aur.archlinux.org/icecat.git 
...
  patch -p1 << 'EOF'
--- a/makeicecat        2021-10-12 17:14:08.000000000 +0200
+++ b/makeicecat        2021-10-12 17:16:43.831787739 +0200
@@ -143,16 +143,23 @@
     do which ${rename_cmd} &> /dev/null && RENAME_CMD=${rename_cmd}
     done
     readonly RENAME_CMD
-    if ! ( [[ "$( ${RENAME_CMD} --version )" =~ 'File::Rename version
'([0-9]+)\.([0-9]+) ]] &&
+    if ! ( [[ "$( ${RENAME_CMD} --version )" =~ ([0-9]+)\.([0-9]+) ]]
&&
                (( ${BASH_REMATCH[1]} >= MIN_RENAME_VER_MAJ )) &&
                (( ${BASH_REMATCH[2]} >= MIN_RENAME_VER_MIN )) )
     then
         required_ver=${MIN_RENAME_VER_MAJ}.${MIN_RENAME_VER_MIN}
         echo -e "\nERROR: This script requires the Perl rename program
(version >= ${required_ver})
  e.g.: 'rename' from the Guix 'rename' package
-       'perl-rename' from the Parabola 'perl-file-rename' package
+       'perl-rename' from the Archlinux package or 'perl-file-rename'
in the Parabola project
        'prename' from the Trisquel 'rename' package"
         return 1
+    else
+        if [[ "$( ${RENAME_CMD} --version )" =~ 'File::Rename' ]]
+        then
+            RENAME_FLAVOUR=RMBARKER
+        else
+            RENAME_FLAVOUR=PEDERST
+        fi
     fi
 
     # verify that Wget is available


Then the apply_batch_branding function uses with the "if -f" that
prevents folders and binaries from being renamed, pretty similar to --
nofullpath:

+    if [ "${RENAME_FLAVOUR}" = "PEDERST" ]
+    then
+        find . | tac | grep run-mozilla | ${RENAME_CMD}
's/mozilla/icecat/ if -f;'
+    else
+        find . | tac | grep run-mozilla | ${RENAME_CMD} --nofullpath -
E 's/mozilla/icecat/;'
+    fi


Maybe this can help with the problem with Arch, although it adds extra
specificity, i guess...
 
Thanks,
Chippy

On Fri, 2023-01-20 at 06:50 -0500, bill-auger wrote:
> i suspected that check to be brittle - the software itself is
> confusing - those minimum versions are no longer accurate
> 
> the original reason for that version check, was that there are
> multiple variants of the perl rename program - makeicecat requires
> the "Robin Barker" variant of the Perl rename program (version >=
> 1.10) - that is the variant in most distros; but the "pederst"
> variant in arch-based distros, is incompatible - IIRC,m at the time,
> its version was less than 1.10 - the project was/is very
> stagnant/abandoned; so it was a fair compromise at the time - now,
> the incompatible variant is at v1.11; but it still does not have the
> feature required by makeicecat.
> 
> so to avoid the original problem why that check was added, at the
> very least, MIN_RENAME_VER_MIN needs to move ahead _a_few_ arbitrary
> minor versions (13 would be fine for now) - o/c that is again only
> passing the brittle buck forward a notch
> 
> the essential missing feature is the --nofullpath option; so i found
> a more robust check, which crudely but accurately tests for that
> feature, regardless of the misleading version numbers - this
> implementation should never need to change
> 
> i would want to verify that the test command is repeatable across
> distros -  the "pederst" variant fails this test
> 
> # guix:
> $ rename --nofullpath 's|||' no-such-file &> /dev/null && echo "this
> rename supports the --nofullpath option"
> 
> # arch derivatives:
> $ perl-rename --nofullpath 's|||' no-such-file &> /dev/null && echo
> "this rename supports the --nofullpath option"
> 
> # debian derivatives:
> $ prename --nofullpath 's|||' no-such-file &> /dev/null && echo "this
> rename supports the --nofullpath option"
> 
> 
> 
> diff --git a/makeicecat b/makeicecat
> index 543e2ad..2d95f82 100755
> --- a/makeicecat
> +++ b/makeicecat
> @@ -48,8 +48,6 @@ readonly PREFS_IN_FILE=browser/locales/en-
> US/browser/preferences/preferences.ftl
>  readonly PREFS_OUT_FILE=/browser/browser/preferences/preferences.ftl
>  
>  # build environment, working directory, and outputs
> -readonly MIN_RENAME_VER_MAJ=1
> -readonly MIN_RENAME_VER_MIN=10
>  readonly DATADIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd
> )"/data
>  readonly ICECATVERSION=${FFVERSION}-gnu${GNUVERSION}
>  readonly OUTPUT_SOURCEBALL=icecat-${ICECATVERSION}.tar.bz2
> @@ -143,12 +141,10 @@ validate_env()
>      do which ${rename_cmd} &> /dev/null && RENAME_CMD=${rename_cmd}
>      done
>      readonly RENAME_CMD
> -    if ! ( [[ "$( ${RENAME_CMD} --version )" =~ 'File::Rename
> version '([0-9]+)\.([0-9]+) ]] &&
> -               (( ${BASH_REMATCH[1]} >= MIN_RENAME_VER_MAJ )) &&
> -               (( ${BASH_REMATCH[2]} >= MIN_RENAME_VER_MIN )) )
> +    if ! ${RENAME_CMD} --nofullpath 's|||' no-such-file &> /dev/null
>      then
> -        required_ver=${MIN_RENAME_VER_MAJ}.${MIN_RENAME_VER_MIN}
> -        echo -e "\nERROR: This script requires the Perl rename
> program (version >= ${required_ver})
> +        echo -e "\nERROR: This script requires the \"Robin Barker\"
> variant of the Perl rename program (version >= 1.10).
> +That is the variant in most distros. The \"pederst\" variant in
> arch-based distros, is incompatible.
>   e.g.: 'rename' from the Guix 'rename' package
>         'perl-rename' from the Parabola 'perl-file-rename' package
>         'prename' from the Trisquel 'rename' package"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]