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




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

commit 8e73ca6ab7501bf40112418ba8571b84f47f1253
Author: Christian Franke <christian.franke@t-online.de>
Date:   Fri Mar 1 19:46:50 2024 +0100

    Add repro-build, repro-diff und repro-check commands
    
    These commands check for reproducibility of distribution packages.
    
    The repro-build command unpacks the source package from the dist
    directory to the temp directory and performs a nested rebuild of the
    packages there.
    
    The repro-diff command compares original and rebuild packages. If
    different, a report about individual differing files in dist, inst and
    spkg directories is printed.
    
    The repro-check command combines both commands.

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

commit df281c68949460dd4dcd9def5a1574f06b75b7af
Author: Christian Franke <christian.franke@t-online.de>
Date:   Fri Mar 1 13:56:45 2024 +0100

    dodoc: Document handling of .md, .rst and .txt extensions
    
    Add missing documentation about the handling of FILE.md, FILE.rst and
    FILE.txt by 'dodoc FILE'.

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

commit dc51f0619da1db59092c4bbc1ace38133e797555
Author: Christian Franke <christian.franke@t-online.de>
Date:   Wed Feb 28 16:46:51 2024 +0100

    Modify origsrc timestamp in patch files if SOURCE_DATE_EPOCH is used
    
    Also the timestamp of a file in origsrc directory may be newer than
    SOURCE_DATE_EPOCH if modified after unpacking e.g. by a src_*_hook.

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

commit dc03dbe3106f01148304f8e1f9d81730014f7d95
Author: Christian Franke <christian.franke@t-online.de>
Date:   Fri Feb 23 13:04:21 2024 +0100

    Fix variable expansion in error message of embedded SMTP perl script

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

commit 9b29821afb5f6ac10ec795c7cbdf163715d75c36
Author: Christian Franke <christian.franke@t-online.de>
Date:   Fri Feb 23 11:35:01 2024 +0100

    Use correct wording if only one package is announced

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

commit 1eace44cc5ea501d98f9067b40c07447338f081e
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Feb 11 17:15:19 2024 +0000

    Update copyrights to 2024


Diff:
---
 README                  |  3 +++
 bin/cygport.in          | 19 ++++++++++++++-
 lib/help.cygpart        |  3 +++
 lib/pkg_pkg.cygpart     | 62 ++++++++++++++++++++++++++++++++++++++++++++++---
 lib/pkg_upload.cygpart  |  7 ++++--
 lib/src_install.cygpart |  2 ++
 6 files changed, 90 insertions(+), 6 deletions(-)

diff --git a/README b/README
index fd16df6b..3c9e4d4a 100644
--- a/README
+++ b/README
@@ -163,6 +163,9 @@ Other COMMANDs are meant primarily for maintainers:
     diff     - write a patch file capturing changes to source in the working directory
     stage    - as upload, but don't request processing of uploaded packages
     announce - compose and send a package announcement
+    repro-build - rebuild from created source package to temp directory
+    repro-diff  - check whether packages from original and rebuild differ
+    repro-check - run repro-build and repro-diff
 
 The standard arguments --help or --version may also be passed to cygport.
 
diff --git a/bin/cygport.in b/bin/cygport.in
index 5fc89eaf..df38a8b5 100755
--- a/bin/cygport.in
+++ b/bin/cygport.in
@@ -29,6 +29,10 @@ set -e;
 #
 ################################################################################
 
+# Preserve original environment for repro-check command
+declare -r _cygport_orig_env=$(export)
+declare -r _cygport_orig_pwd=$(pwd)
+
 # for regexes, sort, etc.
 export LC_COLLATE=C
 
@@ -57,7 +61,7 @@ source ${_privlibdir}/syntax.cygpart
 #  The Cygport Reference Manual documents cygport, a utility for creating and
 #  building software packages for the Cygwin platform.
 #
-#  |html Copyright &#169; 2006-2023 Cygport authors
+#  |html Copyright &#169; 2006-2024 Cygport authors
 #
 #  Permission is granted to copy, distribute and/or modify this manual
 #  under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -784,6 +788,19 @@ do
 			test ${PIPESTATUS[0]} -eq 0
 			_status=$?;
 			;;
+		repro-build)
+			__pkg_repro_build
+			_status=$?
+			;;
+		repro-diff)
+			__pkg_repro_diff
+			_status=$?
+			;;
+		repro-check)
+			__pkg_repro_build && \
+			__pkg_repro_diff
+			_status=$?
+			;;
 		help)
 			__show_help;
 			exit 0;
diff --git a/lib/help.cygpart b/lib/help.cygpart
index a7f30f7a..d28fd7bb 100644
--- a/lib/help.cygpart
+++ b/lib/help.cygpart
@@ -56,6 +56,9 @@ __show_help() {
 		  finish        delete the working directory
 		  all           run prep, compile, install and package
 		  all-test      run prep, compile, install and package-test
+		  repro-build   rebuild from created source package to temp directory
+		  repro-diff    check whether packages from original and rebuild differ
+		  repro-check   run repro-build and repro-diff
 
 		See the included README file for further documentation.
 
diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 756a687c..25b80906 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -508,9 +508,9 @@ __pkg_diff() {
 
 	if [ -n "${SOURCE_DATE_EPOCH}" ]
 	then
-		# Ensure that the timestamp comment in the generated patch file is reproducible
+		# Ensure that the timestamp comments in the generated patch files are 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}|" \
+		sed -E -b -e "s/^((---|\+\+\+) [^\t]*\t).*\$/\1${source_date}/" \
 			-i ${optional_patchfiles} ${patchdir}/${src_patchfile}
 	fi
 
@@ -992,6 +992,62 @@ _EOF
 	fi
 }
 
+__pkg_repro_build() {
+	local srcpkg=${distdir}/${PN}/${PF}-src.tar.${TAR_COMPRESSION_EXT}
+	local t_spkgdir=${T}/${spkgdir##*/}
+	local t_workdir=${t_spkgdir}/${PF}.${ARCH}
+	local t_cygport="cygport ${cygportfile} finish all"
+	local rc
+
+	__stage "Rebuilding"
+	__step "Unpacking ${srcpkg}"
+	[ -f ${srcpkg} ] || error "Packages not built yet"
+	tar xf ${srcpkg} -C ${T} || error "tar xf ${srcpkg} -C ${T} failed"
+
+	__step "Rebuilding in ${t_spkgdir}"
+	echo "${_cygport_orig_env}" > ${T}/.cygport_orig_env
+	echo
+	__step "=== Start: ${t_cygport} ================================="
+
+	# Start nested cygport with original environment in temp directory
+	rc=0
+	env --chdir=${_cygport_orig_pwd} --ignore-environment /bin/bash -c \
+		"source ${T}/.cygport_orig_env && cd ${t_spkgdir} && ${t_cygport}" \
+		|| rc=$?
+
+	__step "=== Done: ${t_cygport} (exit $rc) ========================="
+	echo
+	[ $rc = 0 ] || error "Rebuild failed"
+}
+
+__pkg_repro_diff() {
+	local t_spkgdir=${T}/${spkgdir##*/}
+	local t_workdir=${t_spkgdir}/${PF}.${ARCH}
+	local t_srcpkg=${t_workdir}/dist/${PN}/${PF}-src.tar.${TAR_COMPRESSION_EXT}
+	local d
+
+	__stage "Comparing original and rebuild of"
+	inform "Rebuild dir: ${t_spkgdir}"
+	[ -f ${t_srcpkg} ] || error "Packages not rebuilt yet"
+
+	if ! diff -qr --no-dereference ${distdir} ${t_workdir}/dist >/dev/null
+	then
+		echo "Differing files found:"
+		for d in dist inst spkg
+		do
+			LC_MESSAGES=C \
+			diff -qr --no-dereference ${workdir}/${d} ${t_workdir}/${d} \
+				| sed -n -e "s|^Files ${workdir}/\([^ ][^ ]*\) and .* differ\$|! \\1|p" \
+					 -e "s|^Only in ${workdir}/\(${d}/[^:]*\): |- \\1/|p" \
+					 -e "s|^Only in ${t_workdir}/\(${d}/[^:]*\): |+ \\1/|p"
+		done
+		echo
+		error "Rebuild differs from original"
+	fi
+	echo
+	inform "Rebuild produced identical packages"
+}
+
 # protect functions
 readonly -f __pkg_binpkg __pkg_diff __gpg_sign __pkg_srcpkg __pkg_dist \
-	 __squeeze_whitespace __tar
+	 __pkg_repro_build __pkg_repro_diff __squeeze_whitespace __tar
diff --git a/lib/pkg_upload.cygpart b/lib/pkg_upload.cygpart
index dcae8e2c..5f3a91be 100644
--- a/lib/pkg_upload.cygpart
+++ b/lib/pkg_upload.cygpart
@@ -172,6 +172,9 @@ __pkg_announce() {
 	local msg=$(mktemp -t cygwin-announce-${PF}.XXXXXX)
 	local msgat=$(date +@%s)
 	local -i n=0
+	local s_have="s have"
+
+	[ $pkg_count != 1 ] || s_have=" has"
 
 	cat > ${msg} <<_EOF
 From cygwin-announce-${PF} $(date '+%a %b %d %H:%M:%S %Y' --date=${msgat})
@@ -181,7 +184,7 @@ Date: $(date -R --date=${msgat})
 Message-Id: <$(date "+%Y%m%d%H%M%S.$$" --date=${msgat})-1-$(echo ${SMTP_SENDER} | sed 's|.*<\(.*\)>.*|\1|')>
 Subject: ${NAME} ${PVR}
 
-The following packages have been uploaded to the Cygwin distribution:
+The following package${s_have} been uploaded to the Cygwin distribution:
 
 _EOF
 
@@ -222,7 +225,7 @@ if (\$smtp_encryption eq 'tls') {
 	require Net::SMTP::SSL;
 	\$smtp->command('STARTTLS');
 	\$smtp->response();
-	\$smtp->code == 220 or die "$server does not support STARTTLS";
+	\$smtp->code == 220 or die "\$smtp_server does not support STARTTLS";
 	\$smtp = Net::SMTP::SSL->start_SSL(\$smtp) or die "STARTTLS failed";
 	\$smtp->hello(\$smtp_server);
 }
diff --git a/lib/src_install.cygpart b/lib/src_install.cygpart
index 481457dc..18210488 100644
--- a/lib/src_install.cygpart
+++ b/lib/src_install.cygpart
@@ -162,6 +162,8 @@ docinto() {
 #  DESCRIPTION
 #  Installs the given files or directories into $D/usr/share/doc/PN/, or a
 #  subdirectory thereof specified by the previous call to docinto.
+#  If a FILE does not exist, FILE.md, FILE.rst and FILE.txt are also
+#  considered.
 #****
 dodoc() {
 	local docdir d f i x


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

only message in thread, other threads:[~2024-03-10 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-10 17:17 [cygport - the Cygwin packaging tool] branch master, updated. 0.36.8-6-g8e73ca6a 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).