public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [cygport - the Cygwin packaging tool] branch master, updated. 0.36.8
@ 2024-02-11 16:53 Jon Turney
  0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2024-02-11 16:53 UTC (permalink / raw)
  To: cygwin-apps-cvs




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygport.git;h=04ff26fa2bc3c5834c0d046723dc7cb0be096676

commit 04ff26fa2bc3c5834c0d046723dc7cb0be096676
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Feb 11 16:46:00 2024 +0000

    Bump version to 0.36.8

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygport.git;h=7d6d4b2e6d5735d740df02d5ca36927fbb6e1726

commit 7d6d4b2e6d5735d740df02d5ca36927fbb6e1726
Author: Christian Franke <christian.franke@t-online.de>
Date:   Mon Aug 28 16:24:36 2023 +0200

    Add initial support for SOURCE_DATE_EPOCH
    
    If specified, set the header timestamps of executables and
    patch files to SOURCE_DATE_EPOCH.
    Suppress the header timestamp of .gz files.
    Instruct tar to avoid more recent modification times and
    to sort all entries by name.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygport.git;h=9e82685e32f6717675e9f6bf55dd1336e3fc3831

commit 9e82685e32f6717675e9f6bf55dd1336e3fc3831
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Feb 11 14:42:08 2024 +0000

    Use file-prefix-map rather than debug-prefix-map
    
    Use GCC's file-prefix-map option (available since gcc 8).
    
    This improves build reproducibilty and avoids leaking unhelpful details
    of the build environment through __FILE__ and similar macros.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygport.git;h=c60f801cb9238f43da2c81074ecc653ed5aa3a6a

commit c60f801cb9238f43da2c81074ecc653ed5aa3a6a
Author: Daisuke Fujimura <booleanlabel@gmail.com>
Date:   Sun Dec 3 18:44:05 2023 +0000

    git.cygclass: Retry without the depth option
    
    Some git providers do not support smart transport, so specifying the
    'depth' option will result in an error.
    
    ```
    Cloning into 'xxxx'...
    fatal: dumb http transport does not support shallow capabilities
    ```
    
    Retry without it in those cases


Diff:
---
 NEWS                     |  7 +++++++
 bin/cygport.in           | 23 ++++++++++++++++++-----
 cygclass/git.cygclass    | 24 +++++++++++++++++++++---
 cygport.spec             |  2 +-
 data/sample.cygport      |  2 +-
 lib/pkg_pkg.cygpart      | 20 ++++++++++++++++++--
 lib/src_postinst.cygpart | 22 +++++++++++++++++++---
 meson.build              |  2 +-
 8 files changed, 86 insertions(+), 16 deletions(-)

diff --git a/NEWS b/NEWS
index d30f8470..0a6a231d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+0.36.8:
+	* Switch from gpg to gpg2 for checking and making signatures
+	* cmake: Add src_test definition
+	* Define _FORTIFY_SOURCE as 3
+	* git: Retry clone without '--depth' if it fails due to dumb transport
+	* Add initial support for SOURCE_DATE_EPOCH
+
 0.36.7:
 	* Fix incorrect options passed to unzstd in unpack()
 	* Warn that DEPEND is deprecated
diff --git a/bin/cygport.in b/bin/cygport.in
index 3f89ac67..5fc89eaf 100755
--- a/bin/cygport.in
+++ b/bin/cygport.in
@@ -231,8 +231,9 @@ source ${_privlibdir}/check_funcs.cygpart
 ###
 
 # check now for all mandatory programs
-for _myprog in bzip2 cat chmod cp diff diffstat dos2unix file find gawk grep gzip \
-               install ln mkdir mv patch rm rsync sed sort tar xargs which xz
+for _myprog in bzip2 cat chmod cp date diff diffstat dos2unix file find gawk grep \
+               gzip install ln mkdir mv patch rm rsync sed sort tar touch which \
+               xargs xz
 do
 	if ! check_prog ${_myprog}
 	then
@@ -490,6 +491,18 @@ do
 done
 unset restrict
 
+if [ "${SOURCE_DATE_EPOCH+y}" = "y" ]
+then
+	if [ -n "$(echo "${SOURCE_DATE_EPOCH}" | sed -e 's/^$/X/' -e 's/[0-9]//g')" ]
+	then
+		error "SOURCE_DATE_EPOCH must be an integer number (seconds since the unix epoch)"
+	fi
+	case $(peflags --version 2>/dev/null | sed -n '1s/^.* //p') in
+		4.6.[6-9]|4.[7-9]*|[5-9]*) ;;
+		*) error "SOURCE_DATE_EPOCH requires peflags 4.6.6 or later"
+	esac
+fi
+
 
 ################################################################################
 #
@@ -617,10 +630,10 @@ then
 	do
 		for map in ${DEBUG_PREFIX_MAPS[*]}
 		do
-			declare ${flags}+=" -fdebug-prefix-map=${map}=/usr/src/debug/${PF}"
+			declare ${flags}+=" -ffile-prefix-map=${map}=/usr/src/debug/${PF}"
 		done
-		declare ${flags}+=" -fdebug-prefix-map=${B}=/usr/src/debug/${PF}"
-		declare ${flags}+=" -fdebug-prefix-map=${S}=/usr/src/debug/${PF}"
+		declare ${flags}+=" -ffile-prefix-map=${B}=/usr/src/debug/${PF}"
+		declare ${flags}+=" -ffile-prefix-map=${S}=/usr/src/debug/${PF}"
 	done
 	unset flags map
 fi
diff --git a/cygclass/git.cygclass b/cygclass/git.cygclass
index e53a7985..3cb2c0d5 100644
--- a/cygclass/git.cygclass
+++ b/cygclass/git.cygclass
@@ -78,17 +78,35 @@ git_fetch() {
 		_depth="--depth 1"
 		if defined GIT_TAG
 		then
-			_depth+=" --branch ${GIT_TAG}"
+			_branch="--branch ${GIT_TAG}"
 		elif defined GIT_BRANCH
 		then
-			_depth+=" --branch ${GIT_BRANCH}"
+			_branch="--branch ${GIT_BRANCH}"
 		fi
 	fi
 
 	# T likely doesn't exist at this point, so create it first
 	mkdir -p ${T}
 	cd ${T}
-	verbose git clone ${_depth} --no-checkout ${GIT_URI} ${GIT_MODULE} || error "git clone failed"
+
+	# Try to clone with the depth option (if appropriate), but retry if that
+	# fails due to lack of capabilities of the host of the specified
+	# GIT_URI.
+	_gitlog=${T}/git.$$.log
+	verbose git clone ${_depth} ${_branch} --no-checkout ${GIT_URI} ${GIT_MODULE} |& tee ${_gitlog}
+	if [ ${PIPESTATUS[0]} != 0 ]
+	then
+		grep -q "fatal: dumb http transport does not support shallow capabilities" ${_gitlog}
+		if [ $? = 0 ]
+		then
+			warning "git clone failed, retrying without --depth option"
+			verbose git clone ${_branch} --no-checkout ${GIT_URI} ${GIT_MODULE} || error "git clone failed"
+		else
+			cat ${_gitlog}
+			error "git clone failed"
+		fi
+	fi
+
 	cd ${T}/${GIT_MODULE}
 
 #****v* git.cygclass/GIT_BRANCH
diff --git a/cygport.spec b/cygport.spec
index 8d5aa090..0a242241 100644
--- a/cygport.spec
+++ b/cygport.spec
@@ -1,7 +1,7 @@
 %define debug_package %{nil}
 
 Name:           cygport
-Version:        0.36.7
+Version:        0.36.8
 Release:        1%{?dist}
 Summary:        Cygwin package building tool
 
diff --git a/data/sample.cygport b/data/sample.cygport
index 3406eeb1..8d57ecf0 100644
--- a/data/sample.cygport
+++ b/data/sample.cygport
@@ -1,7 +1,7 @@
 inherit meson
 
 NAME="cygport"
-VERSION=0.36.7
+VERSION=0.36.8
 RELEASE=1
 CATEGORY="Devel"
 SUMMARY="Cygwin source packaging tool"
diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 8f06a5f6..756a687c 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -42,7 +42,7 @@ TAR_COMPRESSION_EXT="${TAR_COMPRESSION_EXT:-xz}"
 #****
 
 __tar() {
-	local TAR_COMPRESSION_OPT;
+	local TAR_COMPRESSION_OPT TAR_SOURCE_DATE_OPTS;
 
 	# We could use --auto-compress, but this also constrains the extension
 	# to the currently valid set. We could probe if tar supports the
@@ -65,7 +65,14 @@ __tar() {
 			error "tar option for TAR_COMPRESSION_EXT='${TAR_COMPRESSION_EXT}' unknown"
 			;;
 	esac
-	tar ${TAR_COMPRESSION_OPT} --owner=Guest:501 --group=None:513 -cvf "$@"
+
+	if [ -n "${SOURCE_DATE_EPOCH}" ]
+	then
+		# Ensure reproducible sort order and last modification times <= SOURCE_DATE_EPOCH
+		TAR_SOURCE_DATE_OPTS="--sort=name --mtime=@${SOURCE_DATE_EPOCH} --clamp-mtime"
+	fi
+
+	tar ${TAR_COMPRESSION_OPT} ${TAR_SOURCE_DATE_OPTS} --owner=Guest:501 --group=None:513 -cvf "$@"
 }
 
 __pkg_binpkg() {
@@ -319,6 +326,7 @@ __pkg_diff() {
 	local difflevel;
 	local exclude;
 	local optional_patchfiles;
+	local source_date;
 
 	default_excludes="CYGWIN-PATCHES aclocal.m4~ aclocal.m4t autom4te.cache
 		config.cache config.guess config.log config.status config.sub
@@ -498,6 +506,14 @@ __pkg_diff() {
 
 	sed -b -e '/^diff -u/d' -i ${optional_patchfiles} ${patchdir}/${src_patchfile};
 
+	if [ -n "${SOURCE_DATE_EPOCH}" ]
+	then
+		# Ensure that the timestamp comment in the generated patch file is reproducible
+		source_date=$(date -d @"${SOURCE_DATE_EPOCH}" -u +'%Y-%m-%d %H:%M:%S.000000000 +0000')
+		sed -b -e  "s|^\(+++ [^\t]*\t\).*\$|\1${source_date}|" \
+			-i ${optional_patchfiles} ${patchdir}/${src_patchfile}
+	fi
+
 	diffstat -p${difflevel} ${optional_patchfiles} ${patchdir}/${src_patchfile};
 }
 
diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index dd947311..f06004e4 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -41,7 +41,7 @@ __prep_fonts_dir() {
 	for catalogue in ${D}${cataloguedir}/*
 	do
 		fontdir=$(readlink -f ${catalogue})
-		find ${D}${fontdir} -name '*.pcf' -exec gzip -q '{}' +
+		find ${D}${fontdir} -name '*.pcf' -exec gzip -q ${SOURCE_DATE_EPOCH:+-n} '{}' +
 		mkfontscale ${D}${fontdir}
 		mkfontdir ${D}${fontdir}
 	done
@@ -775,7 +775,7 @@ __prepman() {
 		while read -d $'\0' manpage
 		do
 			echo "        ${manpage##*/}";
-			gzip -q "${manpage}";
+			gzip -q ${SOURCE_DATE_EPOCH:+-n} "${manpage}";
 		done
 	fi
 }
@@ -819,7 +819,7 @@ __prepinfo() {
 		while read -d $'\0' infopage
 		do
 			echo "        ${infopage##*/}";
-			gzip -q "${infopage}";
+			gzip -q ${SOURCE_DATE_EPOCH:+-n} "${infopage}";
 		done
 	fi
 }
@@ -989,6 +989,12 @@ __prepstrip_one() {
 
 	objdump=${objcopy/copy/dump}
 
+	if [ -n "${SOURCE_DATE_EPOCH}" ]
+	then
+		# Do not embed timestamps for archive members; preserve PE header timestamps
+		objcopy+=" --enable-deterministic-archives --preserve-dates"
+	fi
+
 	# Static libraries should not be fully stripped, but we can
 	# still provide split debuginfo if desired
 	case "${exe}" in
@@ -1074,6 +1080,16 @@ __prepstrip_one() {
 	# keep sticky bit if present
 	chmod u+w,a+x "${exe}";
 
+	if [ -n "${SOURCE_DATE_EPOCH}" ]
+	then
+		case "${exe}" in
+		*.exe|*.dll|*.so|*.so.*|*.oct|*.mex|*.cmxs)
+			# Ensure PE header timestamp is reproducible and checksum is correct
+			# objcopy later inherits the timestamp to debug info and stripped file
+			peflags --checksum=1 --timestamp=${SOURCE_DATE_EPOCH} ${exe} >/dev/null ;;
+		esac
+	fi
+
 	if defined _CYGPORT_RESTRICT_debuginfo_
 	then
 		${objcopy} --strip-all "${exe}";
diff --git a/meson.build b/meson.build
index b648c3be..70e2f35b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 project('cygport',
-        version: '0.36.7')
+        version: '0.36.8')
 
 bindir = join_paths(get_option('prefix'), get_option('bindir'))
 datadir = join_paths(get_option('prefix'), get_option('datadir'))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-11 16:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-11 16:53 [cygport - the Cygwin packaging tool] branch master, updated. 0.36.8 Jon Turney

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).