This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
g-b-s patch: upstream patch list
- From: Eric Blake <ebb9 at byu dot net>
- To: cygwin-apps <cygwin-apps at cygwin dot com>
- Date: Mon, 30 Jan 2006 07:18:01 -0700
- Subject: g-b-s patch: upstream patch list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I finally made my upstream patching generic, following Igor's suggestion
of providing foo-ver-rel.patch.tar.bz2 if there is more than one patch
file being applied to foo-ver.tar.*. I used this patch on readline-5.1-2,
and have been testing it on my (soon-to-be-released) bash-3.1-2. The idea
is that you create a single file, CYGWIN-PATCHES/upstream_patches.lst,
which is a listing of pathnames relative to ${srcdir} containing upstream
patches. Then g-b-s can use the contents of that file to manipulate a
.patches directory to create/unpack the patch tarball.
2006-01-30 Eric Blake <ebb9@byu.net>
* templates/generic-build-script: Add ability to apply upstream
patches, listed in CYGWIN-PATCHES/upstream_patches.lst.
(mkdirs): Use new .patches directory.
(fixup): New function.
(prep): Unpack patch tarball.
(mkpatch): Apply upstream patches before doing diff.
(spkg): Make patch tarball if needed.
(checksig): Look at patch tarball sig.
(install): manifest.lst is not executable.
- --
Life is short - so eat dessert first!
Eric Blake ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFD3iAY84KuGfSFAYARArKCAJ9THVYXlUa7rfKrSOZN/JYacbGNPQCbBilw
fI79URGOOQqxE0OwvOYTgqk=
=jX/A
-----END PGP SIGNATURE-----
Index: templates/generic-build-script
===================================================================
RCS file: /cvs/cygwin-apps/packaging/templates/generic-build-script,v
retrieving revision 1.46
diff -u -p -r1.46 generic-build-script
--- templates/generic-build-script 28 Jan 2006 20:33:13 -0000 1.46
+++ templates/generic-build-script 30 Jan 2006 14:12:19 -0000
@@ -70,6 +70,7 @@ export src_orig_pkg=${topdir}/${src_orig
# determine correct names for generated files
export src_pkg_name=${FULLPKG}-src.tar.bz2
export src_patch_name=${FULLPKG}.patch
+export src_patch_tar_name=${FULLPKG}.patch.tar.bz2
export bin_pkg_name=${FULLPKG}.tar.bz2
export log_pkg_name=${FULLPKG}-BUILDLOGS.tar.bz2
@@ -80,12 +81,15 @@ export installlogname=${FULLPKG}-INSTALL
export src_pkg=${topdir}/${src_pkg_name}
export src_patch=${topdir}/${src_patch_name}
+export src_patch_tar=${topdir}/${src_patch_tar_name}
export bin_pkg=${topdir}/${bin_pkg_name}
export srcdir=${topdir}/${BASEPKG}
export objdir=${srcdir}/.build
export instdir=${srcdir}/.inst
export srcinstdir=${srcdir}/.sinst
export buildlogdir=${srcdir}/.buildlogs
+export patchdir=${srcdir}/.patches
+export upstream_patchlist=${srcdir}/CYGWIN-PATCHES/upstream_patches.lst
export configurelogfile=${srcinstdir}/${configurelogname}
export makelogfile=${srcinstdir}/${makelogname}
export checklogfile=${srcinstdir}/${checklogname}
@@ -182,12 +186,11 @@ unpack() {
tar xv${opt_decomp}f "$1"
}
+# make hidden directories used by g-b-s
mkdirs() {
(cd ${topdir} && \
- rm -fr ${objdir} ${instdir} ${srcinstdir} && \
- mkdir -p ${objdir} && \
- mkdir -p ${instdir} && \
- mkdir -p ${srcinstdir} )
+ rm -fr ${objdir} ${instdir} ${srcinstdir} ${patchdir} && \
+ mkdir -p ${objdir} ${instdir} ${srcinstdir} ${patchdir} )
}
mkdirs_log() {
(cd ${topdir} && \
@@ -195,14 +198,45 @@ mkdirs_log() {
rm -fr ${buildlogdir} && \
mkdir -p ${buildlogdir} )
}
+
+# Internal function for applying upstream patches
+# $1 is directory to patch, $2 is file containing patch names
+fixup() {
+ if [ -f "$2" ] ; then
+ (cd "$1" &&
+ for patch in `cat "$2"` ; do
+ echo "APPLYING UPSTREAM PATCH `basename ${patch}`"
+ patch -Z -p0 < ${srcdir}/${patch}
+ done
+ )
+ fi
+}
+
+# Unpack the original tarball, and get everything set up for g-b-s
prep() {
(cd ${topdir} && \
unpack ${src_orig_pkg} && \
+ mkdirs && \
+ if [ -f ${src_patch_tar} ] ; then
+ (cd ${patchdir} &&
+ tar xvjf ${src_patch_tar} &&
+ if [ -f ${src_patch_name} ] ; then
+ mv ${src_patch_name} ${src_patch}
+ fi &&
+ if [ -f upstream_patches.lst ] ; then
+ for patch in `cat upstream_patches.lst` ; do
+ cp -p ${patch} ${srcdir}/${patch} &&
+ if [ -f ${patch}.sig ] ; then
+ cp -p ${patch}.sig ${srcdir}/${patch}.sig
+ fi
+ done
+ fi )
+ fi &&
+ fixup "${srcdir}" ${patchdir}/upstream_patches.lst &&
cd ${topdir} && \
if [ -f ${src_patch} ] ; then \
patch -Z -p0 < ${src_patch} ;\
- fi && \
- mkdirs )
+ fi )
}
prep_log() {
prep "$@" && \
@@ -212,6 +246,8 @@ prep_log() {
tar xvjf ${topdir}/${log_pkg_name}
fi
}
+
+# Configure the package
conf() {
(cd ${objdir} && \
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
@@ -227,6 +263,8 @@ conf_log() {
conf "$@" 2>&1 | tee ${configurelogfile}
return ${PIPESTATUS[0]}
}
+
+# Rerun configure
reconf() {
(cd ${topdir} && \
rm -fr ${objdir} && \
@@ -237,6 +275,8 @@ reconf_log() {
reconf "$@" 2>&1 | tee ${configurelogfile}
return ${PIPESTATUS[0]}
}
+
+# Run make
build() {
(cd ${objdir} && \
make CFLAGS="${MY_CFLAGS}" )
@@ -245,6 +285,8 @@ build_log() {
build "$@" 2>&1 | tee ${makelogfile}
return ${PIPESTATUS[0]}
}
+
+# Run the package testsuite
check() {
(cd ${objdir} && \
make -k ${test_rule} )
@@ -253,10 +295,14 @@ check_log() {
check "$@" 2>&1 | tee ${checklogfile}
return ${PIPESTATUS[0]}
}
+
+# Remove built files
clean() {
(cd ${objdir} && \
make clean )
}
+
+# Install the package, with DESTDIR of .inst
install() {
(cd ${objdir} && \
rm -fr ${instdir}/* && \
@@ -325,7 +371,7 @@ install() {
if [ ! -d ${instdir}${sysconfdir}/preremove ]; then
mkdir -p ${instdir}${sysconfdir}/preremove ;
fi &&
- /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/manifest.lst \
+ /usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/manifest.lst \
${instdir}${sysconfdir}/preremove/${PKG}-manifest.lst ;
fi )
}
@@ -333,16 +379,22 @@ install_log() {
install "$@" 2>&1 | tee ${installlogfile}
return ${PIPESTATUS[0]}
}
+
+# Strip binaries
strip() {
(cd ${instdir} && \
find . -name "*.dll" -or -name "*.exe" | xargs -r strip 2>&1 ; \
true )
}
+
+# List files that belong to the package
list() {
(cd ${instdir} && \
find . -name "*" ! -type d | sed 's%^\.% %' | sort ; \
true )
}
+
+# List .dll dependencies of the package
depend() {
(cd ${instdir} && \
find ${instdir} -name "*.exe" -o -name "*.dll" | xargs -r cygcheck | \
@@ -350,30 +402,68 @@ depend() {
xargs -r -n1 cygpath -u | xargs -r cygcheck -f | sed 's%^% %' | sort -u ; \
true )
}
+
+# Build the binary package
pkg() {
(cd ${instdir} && \
tar cvjf ${bin_pkg} * )
}
+
+# Compare the original tarball with cygwin modifications
mkpatch() {
(cd ${srcdir} && \
find . -name "autom4te.cache" | xargs -r rm -rf ; \
unpack ${src_orig_pkg} && \
mv ${BASEPKG} ../${BASEPKG}-orig && \
+ fixup "../${BASEPKG}-orig" ${upstream_patchlist} &&
cd ${topdir} && \
- diff -urN -x '.build' -x '.inst' -x '.sinst' -x '.buildlogs' \
+ rm -f ${BASEPKG}-filter &&
+ if [ -f ${upstream_patchlist} ] ; then
+ cp ${upstream_patchlist} ${BASEPKG}-filter &&
+ for patch in `cat ${upstream_patchlist}` ; do
+ echo ${patch}.sig >> ${BASEPKG}-filter
+ done
+ else
+ touch ${BASEPKG}-filter
+ fi &&
+ for dir in '.build' '.inst' '.sinst' '.buildlogs' '.patches' ; do
+ echo ${dir} >> ${BASEPKG}-filter
+ done &&
+ diff -urN -X ${BASEPKG}-filter \
${BASEPKG}-orig ${BASEPKG} > \
${srcinstdir}/${src_patch_name} ; \
- rm -rf ${BASEPKG}-orig )
+ rm -rf ${BASEPKG}-filter ${BASEPKG}-orig &&
+ if [ -f ${upstream_patchlist} ] ; then
+ rm -Rf ${patchdir} &&
+ mkdir -p ${patchdir} &&
+ mv ${srcinstdir}/${src_patch_name} ${patchdir}/${src_patch_name} &&
+ for patch in `cat ${upstream_patchlist}` ; do
+ cp -p ${srcdir}/${patch} ${patchdir}/ &&
+ if [ -f ${srcdir}/${patch}.sig ] ; then
+ cp -p ${srcdir}/${patch}.sig ${patchdir}/
+ fi
+ done &&
+ cp ${upstream_patchlist} ${patchdir}/upstream_patches.lst &&
+ (cd ${patchdir} &&
+ tar cvjf ${srcinstdir}/${src_patch_tar_name} *
+ )
+ fi
+ )
}
+
# Note: maintainer-only functionality
acceptpatch() {
cp --backup=numbered ${srcinstdir}/${src_patch_name} ${topdir}
}
+
+# Build the source tarball
spkg() {
(mkpatch && \
- if [ "${SIG}" -eq 1 ] ; then \
- name=${srcinstdir}/${src_patch_name} text="PATCH" sigfile ; \
- fi && \
+ if [ -f ${upstream_patchlist} ] ; then
+ name=${srcinstdir}/${src_patch_tar_name} text="PATCH" sigfile
+ else
+ name=${srcinstdir}/${src_patch_name} text="PATCH" sigfile
+ fi &&
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
if [ -e ${src_orig_pkg}.sig ] ; then \
cp ${src_orig_pkg}.sig ${srcinstdir}/ ; \
@@ -398,9 +488,13 @@ spkg_log() {
fi && \
tar uvjf ${src_pkg} * )
}
+
+# Clean up everything
finish() {
rm -rf ${srcdir}
}
+
+# Generate GPG signatures
sigfile() {
if [ \( "${SIG}" -eq 1 \) -a \( -e $name \) -a \( \( ! -e $name.sig \) -o \( $name -nt $name.sig \) \) ]; then \
if [ -x /usr/bin/gpg ]; then \
@@ -412,6 +506,8 @@ sigfile() {
fi; \
fi
}
+
+# Validate signatures
checksig() {
if [ -x /usr/bin/gpg ]; then \
if [ -e ${src_orig_pkg}.sig ]; then \
@@ -420,18 +516,37 @@ checksig() {
else \
echo "ORIGINAL PACKAGE signature missing."; \
fi; \
+ if [ -f ${upstream_patchlist} ] ; then
+ for patch in `cat ${upstream_patchlist}` ; do
+ if [ -f ${srcdir}/${patch}.sig ] ; then
+ echo "UPSTREAM PATCH ${patch} signature follows:"
+ /usr/bin/gpg --verify ${srcdir}/${patch}.sig ${srcdir}/${patch}
+ else
+ echo "UPSTREAM PATCH ${patch} signature missing."
+ fi
+ done
+ fi
if [ -e $0.sig ]; then \
echo "SCRIPT signature follows:"; \
/usr/bin/gpg --verify $0.sig $0; \
else \
echo "SCRIPT signature missing."; \
fi; \
- if [ -e ${src_patch}.sig ]; then \
- echo "PATCH signature follows:"; \
- /usr/bin/gpg --verify ${src_patch}.sig ${src_patch}; \
- else \
- echo "PATCH signature missing."; \
- fi; \
+ if [ -f ${src_patch_tar} ] ; then
+ if [ -f ${src_patch_tar}.sig ] ; then
+ echo "PATCH signature follows:"; \
+ /usr/bin/gpg --verify ${src_patch_tar}.sig ${src_patch_tar}; \
+ else \
+ echo "PATCH signature missing."; \
+ fi; \
+ elif [ -e ${src_patch} ] ; then
+ if [ -e ${src_patch}.sig ]; then \
+ echo "PATCH signature follows:"; \
+ /usr/bin/gpg --verify ${src_patch}.sig ${src_patch}; \
+ else \
+ echo "PATCH signature missing."; \
+ fi; \
+ fi
else
echo "You need the gnupg package installed in order to check signatures." ; \
fi