Skip to contentSkip to conversation

support/apply-patches: don't bail-out on libtool patch while using <package>-reconfigure

PATCH New Romain Naour 2 participants 3 messages Aug 13, 2016 – Aug 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/apply-patches: don't bail-out on libtool patch while using <package>-reconfigure

Since 19241598147e7555dce40b6dd44b28ef22b67ed9 <package>-reconfigure target is broken.

$ make elementary-reconfigure
Applying buildroot-libtool-v2.4.4.patch using patch:
Error: duplicate filename 'buildroot-libtool-v2.4.4.patch'
Conflicting files are:
  already applied: buildroot/support/libtool/buildroot-libtool-v2.4.4.patch
  to be applied  : buildroot/support/libtool/buildroot-libtool-v2.4.4.patch

When a package use AUTORECONF, the libtool patch can be applied many times as the <package>-reconfigure target is called. This is not a problem since autoreconf will overwrite the previously patched files.

Don't bail-out on libtool patch if already present in .applied_patches_list.

Cc "Yann E. MORIN" <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 support/scripts/apply-patches.sh | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
support/scripts/apply-patches.sh +12 -6
index 7ccb39d..11b218f 100755
@@ -107,13 +107,19 @@ function apply_patch {
     fi
     existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list || true)"
     if [ -n "${existing}" ]; then
-        echo "Error: duplicate filename '${patch}'"
-        echo "Conflicting files are:"
-        echo "  already applied: ${existing}"
-        echo "  to be applied  : ${path}/${patch}"
-        exit 1
+        # When a package use AUTORECONF, the libtool patch can be applied many
+        # times as the <package>-reconfigure target is called. This is not a
+        # problem since autoreconf will overwrite the previously patched files.
+        if [[ ${patch} != buildroot-libtool-v*.patch ]]; then
+            echo "Error: duplicate filename '${patch}'"
+            echo "Conflicting files are:"
+            echo "  already applied: ${existing}"
+            echo "  to be applied  : ${path}/${patch}"
+            exit 1
+        fi
+    else
+        echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
     fi
-    echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
     ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}" -t -N $silent
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix ${patch}!"
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/1 support/apply-patches: don't bail-out on libtool patch while using <package>-reconfigure

Romain, All,

On 2016-08-14 01:06 +0200, Romain Naour spake thusly:

Quoted 30 lines

Since 19241598147e7555dce40b6dd44b28ef22b67ed9 <package>-reconfigure target is broken.

$ make elementary-reconfigure
Applying buildroot-libtool-v2.4.4.patch using patch:
Error: duplicate filename 'buildroot-libtool-v2.4.4.patch'
Conflicting files are:
  already applied: buildroot/support/libtool/buildroot-libtool-v2.4.4.patch
  to be applied  : buildroot/support/libtool/buildroot-libtool-v2.4.4.patch

When a package use AUTORECONF, the libtool patch can be applied many times as the <package>-reconfigure target is called. This is not a problem since autoreconf will overwrite the previously patched files.

Don't bail-out on libtool patch if already present in .applied_patches_list.

Cc "Yann E. MORIN" <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 support/scripts/apply-patches.sh | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
support/scripts/apply-patches.sh +0 -0
index 7ccb39d..11b218f 100755
@@ -107,13 +107,19 @@ function apply_patch {
     fi
     existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list || true)"

support/scripts/apply-patches.sh function apply_patch { · line 113

Quoted 10 lines
support/scripts/apply-patches.sh +4 -5
     if [ -n "${existing}" ]; then
-        echo "Error: duplicate filename '${patch}'"
-        echo "Conflicting files are:"
-        echo "  already applied: ${existing}"
-        echo "  to be applied  : ${path}/${patch}"
-        exit 1
+        # When a package use AUTORECONF, the libtool patch can be applied many
+        # times as the <package>-reconfigure target is called. This is not a
+        # problem since autoreconf will overwrite the previously patched files.
+        if [[ ${patch} != buildroot-libtool-v*.patch ]]; then

I'm not very fond of treating the patch name as a magic value. Rather, I would suggest we add an option to apply-patches.sh to not fail on a duplicate patch.

And at the same time, turn all positional arguments into options, so that it becomes easy to manage.

Regards,
Yann E. MORIN.

Quoted 16 lines
support/scripts/apply-patches.sh +8 -1
+            echo "Error: duplicate filename '${patch}'"
+            echo "Conflicting files are:"
+            echo "  already applied: ${existing}"
+            echo "  to be applied  : ${path}/${patch}"
+            exit 1
+        fi
+    else
+        echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
     fi
-    echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
     ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}" -t -N $silent
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix ${patch}!"
Signature · 1 line
2.5.5
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 support/apply-patches: don't bail-out on libtool patch while using <package>-reconfigure

In reply to Romain Naour

Romain, All,

On 2016-08-14 01:06 +0200, Romain Naour spake thusly:

Quoted 10 lines

Since 19241598147e7555dce40b6dd44b28ef22b67ed9 <package>-reconfigure target is broken.

$ make elementary-reconfigure
Applying buildroot-libtool-v2.4.4.patch using patch:
Error: duplicate filename 'buildroot-libtool-v2.4.4.patch'
Conflicting files are:
  already applied: buildroot/support/libtool/buildroot-libtool-v2.4.4.patch
  to be applied  : buildroot/support/libtool/buildroot-libtool-v2.4.4.patch
Quoted 5 lines

When a package use AUTORECONF, the libtool patch can be applied many times as the <package>-reconfigure target is called. This is not a problem since autoreconf will overwrite the previously patched files.

Don't bail-out on libtool patch if already present in .applied_patches_list.

After discussing on IRC, and according to my review, I've marked this patch as "Changes Requested" in patchwork.

Thanks! :-)

Regards,
Yann E. MORIN.

Quoted 40 lines
Cc "Yann E. MORIN" <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 support/scripts/apply-patches.sh | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
support/scripts/apply-patches.sh +12 -6
index 7ccb39d..11b218f 100755
@@ -107,13 +107,19 @@ function apply_patch {
     fi
     existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list || true)"
     if [ -n "${existing}" ]; then
-        echo "Error: duplicate filename '${patch}'"
-        echo "Conflicting files are:"
-        echo "  already applied: ${existing}"
-        echo "  to be applied  : ${path}/${patch}"
-        exit 1
+        # When a package use AUTORECONF, the libtool patch can be applied many
+        # times as the <package>-reconfigure target is called. This is not a
+        # problem since autoreconf will overwrite the previously patched files.
+        if [[ ${patch} != buildroot-libtool-v*.patch ]]; then
+            echo "Error: duplicate filename '${patch}'"
+            echo "Conflicting files are:"
+            echo "  already applied: ${existing}"
+            echo "  to be applied  : ${path}/${patch}"
+            exit 1
+        fi
+    else
+        echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
     fi
-    echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
     ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}" -t -N $silent
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix ${patch}!"
Signature · 1 line
2.5.5
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'