public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH cygport 3/3] Don't allow SRC_URI or PATCH_URI to depend on ARCH
  2018-02-13 13:13 [PATCH cygport 0/3] Don't allow source packages to differ by arch Jon Turney
  2018-02-13 13:13 ` [PATCH cygport 2/3] Add src_patch_apply_hook Jon Turney
  2018-02-13 13:13 ` [PATCH cygport 1/3] Document src_unpack_hook and src_patch_hook Jon Turney
@ 2018-02-13 13:13 ` Jon Turney
  2020-03-24  3:06 ` [PATCH cygport 0/3] Don't allow source packages to differ by arch Yaakov Selkowitz
  3 siblings, 0 replies; 5+ messages in thread
From: Jon Turney @ 2018-02-13 13:13 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

The values which SRC_URI and PATCH_URI evaluate to should not change
depending on ARCH, as this will make the source package arch-dependent
---
 bin/cygport.in | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/bin/cygport.in b/bin/cygport.in
index c3370e1..2b603d4 100755
--- a/bin/cygport.in
+++ b/bin/cygport.in
@@ -411,6 +411,32 @@ then
 	error "${cygportfile} not found.";
 fi
 
+### perform some validation on the .cygport
+
+# SRC_URI and PATCH_URI should not change depending on ARCH, as this will make
+# the source package arch-dependent
+declare -i n
+declare -a VALUE
+ARCHES=("i686" "x86_64" "noarch")
+for VAR in "SRC_URI" "PATCH_URI"
+do
+    n=0
+    while (( n < ${#ARCHES[*]} ))
+    do
+        read -r < <(declare ARCH=${ARCHES[$n]}; declare ARCH_${ARCH}=1; source ${top}/${cygportfile}; eval echo "\$${VAR}")
+        VALUE[$n]=${REPLY}
+        if (( n > 0 ))
+        then
+            if [ "x${VALUE[0]}" != "x${VALUE[$n]}" ]
+            then
+                error "${VAR} appears to depend on ARCH"
+            fi
+        fi
+        n+=1;
+    done
+done
+unset n VALUE ARCHES VAR
+
 ### load .cygport
 source ${top}/${cygportfile} || error "could not read ${cygportfile}"
 ###
-- 
2.16.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH cygport 1/3] Document src_unpack_hook and src_patch_hook
  2018-02-13 13:13 [PATCH cygport 0/3] Don't allow source packages to differ by arch Jon Turney
  2018-02-13 13:13 ` [PATCH cygport 2/3] Add src_patch_apply_hook Jon Turney
@ 2018-02-13 13:13 ` Jon Turney
  2018-02-13 13:13 ` [PATCH cygport 3/3] Don't allow SRC_URI or PATCH_URI to depend on ARCH Jon Turney
  2020-03-24  3:06 ` [PATCH cygport 0/3] Don't allow source packages to differ by arch Yaakov Selkowitz
  3 siblings, 0 replies; 5+ messages in thread
From: Jon Turney @ 2018-02-13 13:13 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

Mention that these are unstable API and may be change in future.
---
 lib/src_prep.cygpart | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/lib/src_prep.cygpart b/lib/src_prep.cygpart
index 1e9247a..2277ba4 100644
--- a/lib/src_prep.cygpart
+++ b/lib/src_prep.cygpart
@@ -1,3 +1,4 @@
+
 ################################################################################
 #
 # src_prep.cygpart - cygport source unpacking and preparation functions
@@ -373,9 +374,15 @@ __src_prep() {
 		rm -f ${DISTCLEANFILES}
 	fi
 
-	# src_unpack_hook() is an optional function which can be defined
-	# to alter the original source tree and avoid large patches
-	# or long DIFF_EXCLUDES, or to apply patches in tarballs
+
+#****v* Preparation/src_unpack_hook
+#  DESCRIPTION
+#  src_unpack_hook() is an optional function which can be defined
+#  to alter the original source tree, to avoid large patches
+#  or long DIFF_EXCLUDES.
+#  (This API is not yet stable and is subject to change)
+#****
+
 	if __check_function src_unpack_hook
 	then
 		__check_unstable src_unpack_hook;
@@ -410,8 +417,14 @@ __src_prep() {
 		esac
 	done
 
-	# similar to src_unpack_hook(), but is called after SRC_PATCH patches
-	# useful for changing permissions, etc., on patched files
+#****v* Preparation/src_patch_hook
+#  DESCRIPTION
+#  src_patch_hook() an optional function which can be defined, which
+#  is called after patches have been applied, for changing
+#  permissions, etc., on patched files.
+#  (This API is not yet stable and is subject to change)
+#****
+
 	if __check_function src_patch_hook
 	then
 		__check_unstable src_patch_hook;
-- 
2.16.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH cygport 0/3] Don't allow source packages to differ by arch
@ 2018-02-13 13:13 Jon Turney
  2018-02-13 13:13 ` [PATCH cygport 2/3] Add src_patch_apply_hook Jon Turney
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jon Turney @ 2018-02-13 13:13 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

This is where I got to, after the discussion at [1].

[1] https://cygwin.com/ml/cygwin-apps/2017-05/msg00050.html

Jon Turney (3):
  Document src_unpack_hook and src_patch_hook
  Add src_patch_apply_hook
  Don't allow SRC_URI or PATCH_URI to depend on ARCH

 bin/cygport.in          | 26 ++++++++++++++++++++++++++
 lib/check_funcs.cygpart |  1 +
 lib/src_prep.cygpart    | 41 ++++++++++++++++++++++++++++++++++++-----
 3 files changed, 63 insertions(+), 5 deletions(-)

-- 
2.16.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH cygport 2/3] Add src_patch_apply_hook
  2018-02-13 13:13 [PATCH cygport 0/3] Don't allow source packages to differ by arch Jon Turney
@ 2018-02-13 13:13 ` Jon Turney
  2018-02-13 13:13 ` [PATCH cygport 1/3] Document src_unpack_hook and src_patch_hook Jon Turney
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jon Turney @ 2018-02-13 13:13 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

---
 lib/check_funcs.cygpart |  1 +
 lib/src_prep.cygpart    | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/lib/check_funcs.cygpart b/lib/check_funcs.cygpart
index 961f263..224a7b1 100644
--- a/lib/check_funcs.cygpart
+++ b/lib/check_funcs.cygpart
@@ -687,6 +687,7 @@ __check_unstable() {
 	else
 		warning "The ${1} API is not yet stable and is subject to change"
 		warning "You must define ${unstable_var} in order to use it"
+		return  0
 	fi
 }
 
diff --git a/lib/src_prep.cygpart b/lib/src_prep.cygpart
index 2277ba4..db4a5cf 100644
--- a/lib/src_prep.cygpart
+++ b/lib/src_prep.cygpart
@@ -210,6 +210,24 @@ cygpatch() {
 			continue;
 		fi
 
+#****v* Preparation/src_patch_apply_hook
+#  DESCRIPTION
+#  src_patch_apply_hook() is an optional function which can be defined
+#  to control patch application, for architecture dependent patches, etc.
+#  It receives a patch filename as an argument, and a non-zero result
+#  causes the patch to be skipped.
+#  (This API is not yet stable and is subject to change)
+#****
+
+		if __check_function src_patch_apply_hook
+		then
+			if ! __check_unstable src_patch_apply_hook ${patchfile_name}
+			then
+				warning "patch ${patchfile_name} skipped by src_patch_apply_hook";
+				continue;
+			fi
+		fi
+
 		patchlevel=0;
 
 		case ${patchfile_name} in
-- 
2.16.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH cygport 0/3] Don't allow source packages to differ by arch
  2018-02-13 13:13 [PATCH cygport 0/3] Don't allow source packages to differ by arch Jon Turney
                   ` (2 preceding siblings ...)
  2018-02-13 13:13 ` [PATCH cygport 3/3] Don't allow SRC_URI or PATCH_URI to depend on ARCH Jon Turney
@ 2020-03-24  3:06 ` Yaakov Selkowitz
  3 siblings, 0 replies; 5+ messages in thread
From: Yaakov Selkowitz @ 2020-03-24  3:06 UTC (permalink / raw)
  To: cygwin-apps

On Tue, 2018-02-13 at 13:12 +0000, Jon Turney wrote:
> This is where I got to, after the discussion at [1].
> 
> [1] https://cygwin.com/ml/cygwin-apps/2017-05/msg00050.html
> 
> Jon Turney (3):
>   Document src_unpack_hook and src_patch_hook
>   Add src_patch_apply_hook
>   Don't allow SRC_URI or PATCH_URI to depend on ARCH
> 
>  bin/cygport.in          | 26 ++++++++++++++++++++++++++
>  lib/check_funcs.cygpart |  1 +
>  lib/src_prep.cygpart    | 41 ++++++++++++++++++++++++++++++++++++-----
>  3 files changed, 63 insertions(+), 5 deletions(-)

Pushed to master, please test.

--
Yaakov



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-24  3:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 13:13 [PATCH cygport 0/3] Don't allow source packages to differ by arch Jon Turney
2018-02-13 13:13 ` [PATCH cygport 2/3] Add src_patch_apply_hook Jon Turney
2018-02-13 13:13 ` [PATCH cygport 1/3] Document src_unpack_hook and src_patch_hook Jon Turney
2018-02-13 13:13 ` [PATCH cygport 3/3] Don't allow SRC_URI or PATCH_URI to depend on ARCH Jon Turney
2020-03-24  3:06 ` [PATCH cygport 0/3] Don't allow source packages to differ by arch Yaakov Selkowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).