This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: generic-build-script extension to update version numbers in README


Igor Pechtchanski wrote:

At the time I've thought long and hard about integrating more features.
The original argument for including them was to allow the maintainers to
release packages with minor modifications of the g-b-s (mostly to set
parameters).  And this worked for most *new* packages (though I agree that
the maintainer-only features are getting clunky).  It probably won't work
for any package that has a more sophisticated build procedure.  Perhaps
it's time to rethink this.

At times I wish that I had originally stored all of my build scripts in a cvs repository. If I imported the "official" generic-build-script as a "vendor branch", then I could more easily do a 'cvs merge -j vendor-release-27' within a workspace on the 'gettext' branch...


That would have made this a lot easier. But now, it's just too much work to set up for all 30+ packages, so I keep on keeping on, hand-merging with every new release...

Could these added features be simply refactored into ancillary scripts
instead of integrated into the main gbs?
E.g.

./foo.sh externaltool /path/to/update-readme

where the gbs's externaltool function would simply source the
update-readme fragment -- and the update-readme fragment would inherit
all of the variable settings from the top of the gbs.  I'd figure that
'update-readme' would NOT be shipped with cygwin packages, but could be
downloaded from the sourceware cvs by a maintainer who wanted to use it
on her machine when maintaining her package foo.


FWIW, I like this idea.  A lot.  Maybe we should have only *one* ancillary
script that contains all maintainer-only features.  That way,

./foo.sh maintainer-action update-readme

would do what you said (say, use the 'update-readme' function from a local
'maintainer.sh', or pass the 'update-readme' option to some function that
would properly dispatch it, or even fetch the proper 'maintainer.sh'
version from CVS on sourceware.org and eval it).  That way, the package
maintainers would have less to worry about, since the core g-b-s would not
change all that often.

I too thought of a "regular" gbs and a single "maintainer-extras" script. However, I suggested multiple fragments because it's open-ended. We just keep adding more fragments to the master repository, and it's up to the end-user (e.g. package maintainers) which ones they actually download and use. Or they can write their own. Maybe the "regular" gbs's 'maintainer-action' function can honor an environment variable, like CVSROOT: GBS_PATH=.:/usr/src/gbs-fragments or something. That way, gbs can look in the specified locations for the proper fragments ('.' first for package-specific versions).


Sure, it's insecure as all heck, but if you're maintaining cygwin packages on a compromised machine...we've ALL got a problem!

Yes, but there's the question of the extent to which it has diverged.  If
all you do is change parameters, it ought to be easy.  It would help if
you outlined the difficulties you had (feel free to email me privately,
though I think a public summary might produce more patches).

See attached patch, which shows the changes from gbs-1.38 and gettext-0.14.5-1. These changes were necessary to support:


1) four separate binary packages

2) two variant builds: "normal" and "relocatable". I wanted both variants to be buildable with only minor changes to the buildscript (it's simply a 3 line change to the buildscript now)

3) The upstream maintainer is VERY specific about which files should go into the "runtime" package (cygwin's libintl3 + libgettextpo0 + gettext packages) and which files should go into the developer's package (cygwin's gettext-devel). It's not a simple regex, but specific file listings.

4) The test suite CAN be run all at once -- but the rpath tests take over an hour. I split them up into three different sets.

5) My modifications require bootstrapping. To ease maintainance and avoid giant patches, I ship only the pre-autotool patches and run the bootstrap as part of the prep() phase.

6) I *also* run the boostrap in the -orig directory as part of the mkpatch() step. Thus, I ship two patches: the pre-autotool one, and the post-autotool one (which SHOULD just be the contents of CYGWIN-PATCHES if I've done it right).

7) Since I've got two patches, I had to include them both in the checksig and spkg functions, along with their signatures. (No, I don't actually sign anything, but it's all set up if someone more security obsessed were to take over my package)

BTW, the cvs buildscript is even worse: I have to keep track of which tests in the testsuite are known-to-fail, for two different test harnesses (local and pseudo-remote) -- because a failed test completely stops the suite. No '-k' option! Heck, even my simplest package, zlib, doesn't use the gbs directly; zlib is not autotool enabled so...

Heh, the argument for including the logs (which I, after having installed
some package source tarballs, think aren't such a hot idea anymore) was
that when users build the packages on their machines, they can see if they
get a different configuration from what the maintainer had.  And it may be
a useful feature to run the build with logging turned on (though I don't
think it should be the default).  Perhaps another job for an external
maintainer.sh script.

Well, the problem is, logging is a decorator: it decorates the existing functions. Unless you want a whole new build-with-logging() function that has to be maintained in parallel with the regular build() function for package foo, I don't see how this particular feature can be moved out of the core gbs without getting REAL ugly: building cmd strings, possibly decorating _those_, and then eval'ing them. Sad, really.


Every new feature added to gbs makes it that much more difficult for
maintainers to keep pace with gbs updates when they update their
packages. Please think carefully before adding new stuff: is feature X
*really* worth it?

True enough, though this is the first official complaint from an active package maintainer about the new features.

I know. I'm just a curmudgeon.


Let me try to find some time (probably in a couple of weeks) to extract
the non-core features of the g-b-s into a separate script (tentative name:
"maintainer-only-features.sh", suggestions welcome).  In the meantime,
another thing that would help is defining the "core g-b-s" features.  Is
anyone using the package signature feature?

Unfortunately, no -- because it's intrinsically tied in with spkg. If we didn't need to actually SHIP the signatures, then we could move all signature-related stuff to an aux script. But that kinda defeats the purpose.


acceptpatch?

IMO, yes. Ditto 'muck-with-readme', 'list', 'depends'.

logging?

No, for reasons described above. I'd *LOVE* to be wrong about this, but the only cures I see are worse than the disease.

But gbs ain't like that.

What's stopping us from trying to get there? Anything specific to the nature of the g-b-s? One way to address this may be defining more functions like "unpack()" to contain the pluggable/overridable behavior.

There was also Jari Aalto's build script (I forget the name) which had
some of the above properties, IIRC.

Sure, with enough man-hours you can do anything you want. But if it's hard for existing maintainers to keep up with the current incremental changes to gbs, it'll be durn near impossible to follow a wholesale architectural redesign.


BTW, thanks for your comments, Chuck.  I'm afraid I lost sight of the fact
that many maintainers have private mods to the g-b-s, and that feature
updates may cause them trouble.  We should definitely rectify this.

You're still thinking that they are "private mods" as in 'tetchy little changes here and there'. It's more like gbs is used as a base from which to massively fork, with wholesale rewriting of some of the functions. Maybe I'm just lucky in that my packages SUCK and everybody else gets to use the gbs unmodified, but not me. I almost ALWAYS have to modify install(), for instance. And any time I have to re-run the autotools, Katie bar the door...


The problem comes in when trying to 'upgrade' our fork to the ongoing development in the 'trunk'. It really is a branch-and-merge-from type of operation. Maybe I should give that local cvs mirror idea some more thought...

--
Chuck

--- /desktop/generic-build-script	2005-10-31 00:09:38.359375000 -0500
+++ gettext-0.14.5-1.sh	2005-11-15 03:38:42.000000000 -0500
@@ -43,6 +43,10 @@
 export SHORTPKG=${PKG}-${VER}
 export FULLPKG=${SHORTPKG}-${REL}
 
+PKG2=libintl3
+PKG3=gettext-devel
+PKG4=libgettextpo0
+
 # determine correct decompression option and tarball filename
 export src_orig_pkg_name=
 if [ -e "${src_orig_pkg_name}" ] ; then
@@ -70,20 +74,38 @@
 # determine correct names for generated files
 export src_pkg_name=${FULLPKG}-src.tar.bz2
 export src_patch_name=${FULLPKG}.patch
+export src_patch_name2=${FULLPKG}.patch2
 export bin_pkg_name=${FULLPKG}.tar.bz2
+export bin_pkg_name2=${PKG2}-${VER}-${REL}.tar.bz2
+export bin_pkg_name3=${PKG3}-${VER}-${REL}.tar.bz2
+export bin_pkg_name4=${PKG4}-${VER}-${REL}.tar.bz2
 
 export src_pkg=${topdir}/${src_pkg_name}
 export src_patch=${topdir}/${src_patch_name}
+export src_patch2=${topdir}/${src_patch_name2}
 export bin_pkg=${topdir}/${bin_pkg_name}
+export bin_pkg2=${topdir}/${bin_pkg_name2}
+export bin_pkg3=${topdir}/${bin_pkg_name3}
+export bin_pkg4=${topdir}/${bin_pkg_name4}
 export srcdir=${topdir}/${BASEPKG}
 export objdir=${srcdir}/.build
 export instdir=${srcdir}/.inst
 export srcinstdir=${srcdir}/.sinst
 export checkfile=${topdir}/${FULLPKG}.check
 
-prefix=/usr
-sysconfdir=/etc
-localstatedir=/var
+if [ -f ${objdir}/RELOC ] ; then
+  RELOCDIR=`cat ${objdir}/RELOC`
+else
+  # RELOCDIR=`mktemp -d /tmp/gettext-reloc-XXXXXX`
+  RELOCDIR=
+  echo -n ${RELOCDIR} > ${objdir}/RELOC
+fi
+
+prefix=${RELOCDIR}/usr
+sysconfdir=${RELOCDIR}/etc
+localstatedir=${RELOCDIR}/var
+pnoslash=`echo $prefix | sed -e "s#^${RELOCDIR}##" -e 's#^/##'`
+snoslash=`echo $sysconfdir | sed -e "s#^${RELOCDIR}##" -e 's#^/##'`
 if [ -z "$MY_CFLAGS" ]; then
   MY_CFLAGS="-O2"
 fi
@@ -91,6 +113,8 @@
   MY_LDFLAGS=
 fi
 
+alias_path="${RELOCDIR}/usr/share/locale:${RELOCDIR}/usr/local/share/locale:${RELOCDIR}/usr/X11R6/lib/X11/locale"
+
 export install_docs="\
 	ABOUT-NLS \
 	ANNOUNCE \
@@ -126,6 +150,80 @@
 # Sort in POSIX order.
 export LC_ALL=C
 
+PKG1_LIST="\
+  ${pnoslash}/share/doc/Cygwin/${PKG}-${VER}.README \
+  ${pnoslash}/share/doc/${PKG}-${VER}/* \
+  ${pnoslash}/share/gettext/ABOUT-NLS \
+  ${pnoslash}/bin/gettext.*exe \
+  ${pnoslash}/bin/ngettext.*exe \
+  ${pnoslash}/bin/envsubst.*exe \
+  ${pnoslash}/bin/gettext.sh \
+  ${pnoslash}/share/man/man1/gettext.* \
+  ${pnoslash}/share/man/man1/ngettext.* \
+  ${pnoslash}/share/man/man1/envsubst.* \
+  ${pnoslash}/share/doc/gettext/gettext.1.html \
+  ${pnoslash}/share/doc/gettext/ngettext.1.html \
+  ${pnoslash}/share/doc/gettext/envsubst.1.html \
+  ${pnoslash}/share/locale/*/LC_MESSAGES/gettext-runtime.mo \
+  ${pnoslash}/lib/libintl.* \
+  ${pnoslash}/lib/charset.alias \
+  ${pnoslash}/share/locale/locale.alias \
+  ${pnoslash}/include/libintl.h \
+  ${pnoslash}/share/man/man3/* \
+  ${pnoslash}/share/doc/gettext/*.3.html \
+  ${pnoslash}/share/doc/gettext/javadoc1/* \
+  ${pnoslash}/share/doc/gettext/javadoc2/* \
+  ${pnoslash}/share/doc/gettext/csharpdoc/* \
+  ${pnoslash}/lib/libasprintf.* \
+  ${pnoslash}/include/autosprintf.h \
+  ${pnoslash}/share/doc/libasprintf/autosprintf.html \
+  ${pnoslash}/share/info/autosprintf.info* \
+"
+PKG2_LIST="\
+  ${pnoslash}/bin/cygintl-*.dll \
+"
+PKG4_LIST="\
+  ${pnoslash}/bin/cyggettextpo-*.dll \
+  ${pnoslash}/bin/cyggettextlib-*.dll \
+  ${pnoslash}/bin/cyggettextsrc-*.dll \
+"
+PKG3_LIST="\
+  ${pnoslash}/share/doc/Cygwin/${PKG3}-${VER}.README \
+  ${pnoslash}/bin/msg*.*exe \
+  ${pnoslash}/bin/xgettext.*exe \
+  ${pnoslash}/bin/gettextize \
+  ${pnoslash}/bin/autopoint \
+  ${pnoslash}/share/man/man1/msg*.* \
+  ${pnoslash}/share/man/man1/xgettext.* \
+  ${pnoslash}/share/man/man1/gettextize.* \
+  ${pnoslash}/share/man/man1/autopoint.* \
+  ${pnoslash}/share/doc/gettext/msg*.1.html \
+  ${pnoslash}/share/doc/gettext/xgettext.1.html \
+  ${pnoslash}/share/doc/gettext/gettextize.1.html \
+  ${pnoslash}/share/doc/gettext/autopoint.1.html \
+  ${pnoslash}/share/doc/gettext/gettext_*.html \
+  ${pnoslash}/share/doc/gettext/tutorial.html \
+  ${pnoslash}/share/doc/gettext/FAQ.html \
+  ${pnoslash}/share/doc/gettext/examples/* \
+  ${pnoslash}/share/info/gettext.info* \
+  ${pnoslash}/include/gettext-po.h \
+  ${pnoslash}/lib/libgettextlib* \
+  ${pnoslash}/lib/libgettextsrc* \
+  ${pnoslash}/lib/libgettextpo* \
+  ${pnoslash}/lib/gettext/* \
+  ${pnoslash}/share/locale/*/LC_MESSAGES/gettext-tools.mo \
+  ${pnoslash}/share/gettext/config.rpath \
+  ${pnoslash}/share/gettext/mkinstalldirs \
+  ${pnoslash}/share/gettext/intl/* \
+  ${pnoslash}/share/gettext/po/* \
+  ${pnoslash}/share/gettext/projects/* \
+  ${pnoslash}/share/gettext/gettext.h \
+  ${pnoslash}/share/gettext/msgunfmt.tcl \
+  ${pnoslash}/share/gettext/archive.tar.gz \
+  ${pnoslash}/share/aclocal/* \
+  ${pnoslash}/share/emacs/site-lisp/* \
+"
+
 # helper functions
 
 # Provide help.
@@ -142,6 +240,9 @@
     reconf		Rerun configure
     build, make		Build the package (make)
     check, test		Run the testsuite (make ${test_rule})
+    check-rpath         Run the rpath subset of make check
+    check-runtime       Run the runtime subset of make check
+    check-tools         Run the tools subset of make check
     clean		Remove built files (make clean)
     install		Install package to staging area (make install)
     list		List package contents
@@ -179,17 +280,35 @@
   mkdir -p ${instdir} && \
   mkdir -p ${srcinstdir} )
 }
+patchit() {
+  thedir=$1
+  (cd ${thedir} && \
+  if [ -f ${src_patch} ] ; then \
+    patch -Z -p1 < ${src_patch} ;\
+  fi )
+}
+fixup() {
+  thedir=$1
+  (cd ${thedir} && \
+  ./autogen.sh )
+}  
 prep() {
   (cd ${topdir} && \
   unpack ${src_orig_pkg} && \
   cd ${topdir} && \
-  if [ -f ${src_patch} ] ; then \
-    patch -Z -p0 < ${src_patch} ;\
-  fi && \
-  mkdirs )
+  patchit ${srcdir}
+  fixup ${srcdir}
+  if [ -f ${src_patch2} ] ; then \
+    patch -Z -p0 < ${src_patch2} ;\
+  fi
+  mkdirs && \
+  cd ${srcdir} && \
+  chmod +x gettext-tools/misc/gettextize.in && \
+  chmod +x gettext-tools/misc/autopoint.in )
 }
 conf() {
   (cd ${objdir} && \
+  export PATH=/usr/X11R6/bin:/usr/bin:/bin
   CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
   ${srcdir}/configure \
   --srcdir=${srcdir} --prefix="${prefix}" \
@@ -197,7 +316,10 @@
   --libdir='${prefix}/lib' --includedir='${prefix}/include' \
   --mandir='${prefix}/share/man' --infodir='${prefix}/share/info' \
   --libexecdir='${sbindir}' --localstatedir="${localstatedir}" \
-  --datadir='${prefix}/share' )
+  --datadir='${prefix}/share' \
+  --with-included-gettext --disable-rpath && \
+  chmod +x gettext-tools/misc/gettextize && \
+  chmod +x gettext-tools/misc/autopoint )
 }
 reconf() {
   (cd ${topdir} && \
@@ -207,11 +329,27 @@
 }
 build() {
   (cd ${objdir} && \
-  make CFLAGS="${MY_CFLAGS}" )
+  make CFLAGS="${MY_CFLAGS}" aliaspath=${alias_path} EMACS=no )
 }
+check_rpath() {
+  (cd ${objdir}/autoconf-lib-link && \
+  CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
+  make aliaspath=${alias_path} EMACS=no check | tee ${checkfile}-rpath 2>&1
+)}
+check_runtime() {
+  (cd ${objdir}/gettext-runtime && \
+  CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
+  make aliaspath=${alias_path} EMACS=no check | tee ${checkfile}-runtime 2>&1
+)}
+check_tools() {
+  (cd ${objdir}/gettext-tools && \
+  CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
+  make aliaspath=${alias_path} EMACS=no check | tee ${checkfile}-tools 2>&1
+)}
 check() {
-  (cd ${objdir} && \
-  make ${test_rule} | tee ${checkfile} 2>&1 )
+  check_rpath
+  check_runtime
+  check_tools
 }
 clean() {
   (cd ${objdir} && \
@@ -220,17 +358,21 @@
 install() {
   (cd ${objdir} && \
   rm -fr ${instdir}/* && \
-  make install DESTDIR=${instdir} && \
+  make install DESTDIR=${instdir} alias_path=${alias_path} EMACS=no && \
+  (cd ${instdir}${prefix}/bin ; chmod +x *.dll ) && \
   for f in ${prefix}/share/info/dir ${prefix}/info/dir ; do \
     if [ -f ${instdir}${f} ] ; then \
       rm -f ${instdir}${f} ; \
     fi ;\
   done &&\
-  for d in ${prefix}/share/doc/${SHORTPKG} ${prefix}/share/doc/Cygwin ; do \
+  for d in ${prefix}/share/doc/${SHORTPKG} ${prefix}/share/doc/Cygwin \
+           ${prefix}/share/emacs/site-lisp ; do \
     if [ ! -d ${instdir}${d} ] ; then \
       mkdir -p ${instdir}${d} ;\
     fi ;\
   done &&\
+  /usr/bin/install -m 644 ${srcdir}/gettext-tools/misc/*.el \
+     ${instdir}${prefix}/share/emacs/site-lisp/ && \
   if [ -d ${instdir}${prefix}/share/info ] ; then \
     find ${instdir}${prefix}/share/info -name "*.info" | xargs -r gzip -q ; \
   fi && \
@@ -254,6 +396,12 @@
     /usr/bin/install -m 644 $templist \
 	 ${instdir}${prefix}/share/doc/${SHORTPKG} ; \
   fi && \
+  cat ${srcdir}/CYGWIN-PATCHES/${PKG}.frag \
+    ${srcdir}/CYGWIN-PATCHES/README.frag > \
+         ${instdir}${prefix}/share/doc/Cygwin/${PKG}-${VER}.README && \
+  cat ${srcdir}/CYGWIN-PATCHES/${PKG3}.frag \
+    ${srcdir}/CYGWIN-PATCHES/README.frag > \
+         ${instdir}${prefix}/share/doc/Cygwin/${PKG3}-${VER}.README && \
   if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}.README ]; then \
     /usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}.README \
       ${instdir}${prefix}/share/doc/Cygwin/${SHORTPKG}.README ; \
@@ -290,6 +438,8 @@
   fi )
 }
 strip() {
+  # maybe: only strip cygintl.  The other dlls are fragile.
+  #   find . -name "cygintl*.dll" | xargs strip > /dev/null 2>&1
   (cd ${instdir} && \
   find . -name "*.dll" -or -name "*.exe" | xargs -r strip 2>&1 ; \
   true )
@@ -307,18 +457,26 @@
   true )
 }
 pkg() {
-  (cd ${instdir} && \
-  tar cvjf ${bin_pkg} * )
+  (cd ${instdir}${RELOCDIR} && \
+  tar cvjf ${bin_pkg} ${PKG1_LIST}   && \
+  tar cvjf ${bin_pkg2} ${PKG2_LIST}  && \
+  tar cvjf ${bin_pkg3} ${PKG3_LIST}  && \
+  tar cvjf ${bin_pkg4} ${PKG4_LIST}  )
 }
 mkpatch() {
   (cd ${srcdir} && \
   find . -name "autom4te.cache" | xargs -r rm -rf ; \
   unpack ${src_orig_pkg} && \
   mv ${BASEPKG} ../${BASEPKG}-orig && \
+  temp=`(cd ../${PKG}-${VER}-orig ; pwd)` && \
+  patchit $temp
+  fixup $temp
+  cd $temp
+  find . -name "autom4te.cache" | xargs -r rm -rf ; \
   cd ${topdir} && \
-  diff -urN -x '.build' -x '.inst' -x '.sinst' \
+  diff -urN -x '.build' -x '.inst' -x '.sinst' -x '*~' \
     ${BASEPKG}-orig ${BASEPKG} > \
-    ${srcinstdir}/${src_patch_name} ; \
+    ${srcinstdir}/${src_patch_name2} ; \
   rm -rf ${BASEPKG}-orig )
 }
 # Note: maintainer-only functionality
@@ -327,9 +485,13 @@
 }
 spkg() {
   (mkpatch && \
+  cp ${src_patch} ${srcinstdir}
   if [ "${SIG}" -eq 1 ] ; then \
     name=${srcinstdir}/${src_patch_name} text="PATCH" sigfile ; \
   fi && \
+  if [ -e ${srcinstdir}/${src_patch_name2} -a "${SIG}" -eq 1 ] ; then \
+    name=${srcinstdir}/${src_patch_name2} text="PATCH2" sigfile ; \
+  fi && \
   cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
   if [ -e ${src_orig_pkg}.sig ] ; then \
     cp ${src_orig_pkg}.sig ${srcinstdir}/ ; \
@@ -376,6 +538,12 @@
     else \
       echo "PATCH signature missing."; \
     fi; \
+    if [ -e ${src_patch2}.sig ]; then \
+      echo "PATCH2 signature follows:"; \
+      /usr/bin/gpg --verify ${src_patch2}.sig ${src_patch2}; \
+    else \
+      echo "PATCH2 signature missing."; \
+    fi; \
   else
     echo "You need the gnupg package installed in order to check signatures." ; \
   fi
@@ -392,6 +560,9 @@
     build)		build ; STATUS=$? ;;
     make)		build ; STATUS=$? ;;
     check)		check ; STATUS=$? ;;
+    check-rpath)        check_rpath ; STATUS=$? ;;
+    check-runtime)      check_runtime ; STATUS=$? ;;
+    check-tools)        check_tools ; STATUS=$? ;;
     test)		check ; STATUS=$? ;;
     clean)		clean ; STATUS=$? ;;
     install)		install ; STATUS=$? ;;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]