Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Reply-To: From: "Alan Miles" To: Subject: Diff for generic readme and generic-build script to automatically generate pkg data and file listings Date: Tue, 25 Nov 2003 18:00:52 -0600 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00CE_01C3B37E.111054C0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal ------=_NextPart_000_00CE_01C3B37E.111054C0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit All, Was wondering if this patch got dropped, or is it on a todo list? Alan -----Original Message----- From: Alan Miles [mailto:miles0201 AT cox DOT net] Sent: November 21, 2003 18:35 To: cygwin AT cygwin DOT com Subject: RE: Diff for generic readme and generic-build script Igor, New patch - basically I store the /usr/bin/basename of the Readme file variable == > /tmp/%PKG%.README Then I do an effective "mv -f /tmp/%PKG%.README /usr/share/doc/Cygwin/%PKG%.README" operation. Hopefully that mitigates all of your concerns. -----Original Message----- From: Igor Pechtchanski [mailto:pechtcha AT cs DOT nyu DOT edu] Sent: November 19, 2003 11:55 To: alan DOT miles AT ieee DOT org Cc: cygwin AT cygwin DOT com Subject: RE: Diff for generic readme and generic-build script Alan, The bug with 'sed -i' was that if it's unable to write to (or, rather, "creat") "/tmp/sedGARBAGE", it assumes that the file exists and tries another name ("/tmp/sedMOREGARBAGE"), and so on (in a loop). If /tmp is not writeable at all, sed will loop indefinitely. As long as your script checks only once (and redirection is usually better at handling existing files, since you never claimed your script is reentrant), you should be ok. You can simply replace "${ThePackageReadMeFile}.tmp" in your patch with "/tmp/${ThePackageReadMeFile}.tmp" (or even "`mktemp -t "${ThePackageReadMeFile}.XXXXXX"`", but you'd need to store that in a variable). Igor On Tue, 18 Nov 2003, Alan Miles wrote: > Igor, > > With this change I discovered a very subtle problem - the files listed will > show two entries instead of one for the README: > > /usr/share/doc/Cygwin/%PKG%.README > /usr/share/doc/Cygwin/%PKG%.README.tmp > > This is due to the way where I redirected the file to. > > There are two solutions: > 1/ Put the redirected temp file under /tmp, i.e., /tmp/%PKG%.README and then > doing a 'mv -f /tmp/%PKG%.README /usr/share/doc/Cygwin/%PKG%.README'. The > listing won't be affected since before and after will contain the same file > name. > > 2/ Adjusting the find command to filter-out the > /usr/share/doc/Cygwin/%PKG%.README.tmp file in its listing. > > Which solution would be your preference? (Unless you have another one of > course ...) > > Alan ------=_NextPart_000_00CE_01C3B37E.111054C0 Content-Type: application/octet-stream; name="packaging_templates.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="packaging_templates.diff" diff -ur Original/generic-build-script New/generic-build-script=0A= --- Original/generic-build-script 2003-10-26 23:14:08.000000000 -0600=0A= +++ New/generic-build-script 2003-11-21 17:30:10.750328000 -0600=0A= @@ -24,6 +24,7 @@=0A= export VER=3D`echo $tscriptname | sed -e "s/${PKG}\-//" -e = 's/\-[^\-]*$//'`=0A= export REL=3D`echo $tscriptname | sed -e "s/${PKG}\-${VER}\-//"`=0A= export FULLPKG=3D${PKG}-${VER}-${REL}=0A= +export NEWVER=3D"" # Place Holder for 'newer' version number=0A= =0A= # determine correct decompression option and tarball filename=0A= if [ -e ${PKG}-${VER}.tar.gz ] ; then=0A= @@ -48,6 +49,7 @@=0A= export instdir=3D${srcdir}/.inst=0A= export srcinstdir=3D${srcdir}/.sinst=0A= export checkfile=3D${topdir}/${FULLPKG}.check=0A= +=0A= # run on=0A= host=3Di686-pc-cygwin=0A= # if this package creates binaries, they run on=0A= @@ -57,6 +59,8 @@=0A= MY_CFLAGS=3D"-O2"=0A= MY_LDFLAGS=3D=0A= =0A= +export = ThePackageReadMeFile=3D"${instdir}${prefix}/share/doc/Cygwin/${PKG}-${VER= }.README"=0A= +=0A= mkdirs() {=0A= (cd ${topdir} && \=0A= rm -fr ${objdir} ${instdir} ${srcinstdir} && \=0A= @@ -123,11 +127,11 @@=0A= fi && \=0A= if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}.README ]; then \=0A= /usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}.README \=0A= - ${instdir}${prefix}/share/doc/Cygwin/${PKG}-${VER}.README ; \=0A= + "${ThePackageReadMeFile}" ; \=0A= else \=0A= if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \=0A= /usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \=0A= - ${instdir}${prefix}/share/doc/Cygwin/${PKG}-${VER}.README ; \=0A= + "${ThePackageReadMeFile}" ; \=0A= fi ;\=0A= fi ;\=0A= if [ -f ${srcdir}/CYGWIN-PATCHES/postinstall.sh ] ; then \=0A= @@ -142,9 +146,23 @@=0A= true )=0A= }=0A= list() {=0A= - (cd ${instdir} && \=0A= - find . -name "*" ! -type d | sed 's/\.\/\(.*\)/\1/'=0A= - true )=0A= + if [ -s "${ThePackageReadMeFile}" ]=0A= + then=0A= + TmpPackageReadMe=3D"/tmp/$(/usr/bin/basename = "${ThePackageReadMeFile}")"=0A= + (cd ${instdir} && = \=0A= + find . -name "*" | sed 's/\.\/\(.*\)/ \/\1/' | = \=0A= + sed -e "s#%PKG%#${PKG}#g" = \=0A= + -e "s#%VER%#${VER}#g" = \=0A= + -e "s#%REL%#${REL}#g" = \=0A= + -e "s#%NEWER_VER%#${NEWVER}#g" = \=0A= + -e '\|%THEFILES%| e /usr/bin/cat -' = \=0A= + -e '\|%THEFILES%| d' = \=0A= + "${ThePackageReadMeFile}" > = \=0A= + "${TmpPackageReadMe}" && = \=0A= + mv -f "${TmpPackageReadMe}" = \=0A= + "${ThePackageReadMeFile}" && = \=0A= + true )=0A= + fi=0A= }=0A= pkg() {=0A= (cd ${instdir} && \=0A= @@ -188,7 +206,7 @@=0A= spkg) spkg ; STATUS=3D$? ;;=0A= finish) finish ; STATUS=3D$? ;;=0A= all) prep && conf && build && install && \=0A= - strip && pkg && spkg && finish ; \=0A= + strip && list && pkg && spkg && finish ; \=0A= STATUS=3D$? ;;=0A= *) echo "Error: bad arguments" ; exit 1 ;;=0A= esac=0A= diff -ur Original/generic-readme New/generic-readme=0A= --- Original/generic-readme 2003-09-12 12:36:02.000000000 -0500=0A= +++ New/generic-readme 2003-11-17 17:24:44.467372800 -0600=0A= @@ -1,4 +1,4 @@=0A= -=0A= +%PKG%=0A= ------------------------------------------=0A= =0A= =0A= @@ -21,36 +21,36 @@=0A= ------------------------------------=0A= =0A= Build instructions:=0A= - unpack -VER-REL-src.tar.bz2=0A= + unpack %PKG%-%VER%-%REL%-src.tar.bz2=0A= if you use setup to install this src package, it will be=0A= unpacked under /usr/src automatically=0A= cd /usr/src=0A= - ./-VER-REL.sh all=0A= + ./%PKG%-%VER%-%REL%.sh all=0A= =0A= This will create:=0A= - /usr/src/-VER-REL.tar.bz2=0A= - /usr/src/-VER-REL-src.tar.bz2=0A= + /usr/src/%PKG%-%VER%-%REL%.tar.bz2=0A= + /usr/src/%PKG%-%VER%-%REL%-src.tar.bz2=0A= =0A= -------------------------------------------=0A= =0A= Files included in the binary distro=0A= =0A= /usr/bin/...=0A= - /usr/share/doc/-/AUTHORS=0A= - /usr/share/doc/-/...=0A= - /usr/share/doc/Cygwin/-.README=0A= + /usr/share/doc/%PKG%-%VER%/AUTHORS=0A= + /usr/share/doc/Cygwin/%PKG%-%VER%.README=0A= /usr/share/man/man1/...=0A= /usr/share/info/...=0A= - /etc/postinstall/.sh=0A= + /etc/postinstall/%PKG%.sh=0A= +%THEFILES%=0A= =0A= ------------------=0A= =0A= Port Notes:=0A= =0A= ------ version -----=0A= +----- version %NEWER_VER% -----=0A= Other information=0A= =0A= ------ version -----=0A= +----- version %VER% -----=0A= Initial release=0A= =0A= =0A= ------=_NextPart_000_00CE_01C3B37E.111054C0 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_00CE_01C3B37E.111054C0--