This is the mail archive of the cygwin-apps@cygwin.com 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 maintainership (WAS Re: non-widget child"DropSiteManager" error)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charles Wilson wrote:
| Off the top of my head, there were patches submitted for some bugfixes
| (like the aformentioned sed stuff), functionality extensions (package
| listings, gpg signing, etc), and more that I can't recall right now.

Here is my submission, commented out chunk-by-chunk: (some of them are
"independant", such as the "empty postinstall directory" problem)

| @@ -26,15 +26,25 @@
|  export FULLPKG=${PKG}-${VER}-${REL}
|
|  # determine correct decompression option and tarball filename
| -if [ -e ${PKG}-${VER}.tar.gz ] ; then
| -  export opt_decomp=z
| -  export src_orig_pkg_ext=gz
| -elif [ -e ${PKG}-${VER}.tar.bz2 ] ; then
| +export BASEPKG=${PKG}-${VER}
| +if [ -e ${BASEPKG}.tar.bz2 ] ; then
|    export opt_decomp=j
| -  export src_orig_pkg_ext=bz2
| +  export src_orig_pkg_name=${BASEPKG}.tar.bz2
| +elif [ -e ${BASEPKG}.tar.gz ] ; then
| +  export opt_decomp=z
| +  export src_orig_pkg_name=${BASEPKG}.tar.gz
| +elif [ -e ${BASEPKG}.tgz ] ; then
| +  export opt_decomp=z
| +  export src_orig_pkg_name=${BASEPKG}.tgz
| +elif [ -e ${BASEPKG}.tar ] ; then
| +  export opt_decomp=
| +  export src_orig_pkg_name=${BASEPKG}.tar
| +else
| +  echo Cannot find original package.
| +  exit 1
|  fi
|
| -export src_orig_pkg_name=${PKG}-${VER}.tar.${src_orig_pkg_ext}
| +# determine correct names for generated files
|  export src_pkg_name=${FULLPKG}-src.tar.bz2
|  export src_patch_name=${FULLPKG}.patch
|  export bin_pkg_name=${FULLPKG}.tar.bz2

An improved "extesion-detection" code.
Main "problem" solved is that the default one doesn't have a "default
else" that stops the script.

| @@ -48,10 +58,6 @@
|  export instdir=${srcdir}/.inst
|  export srcinstdir=${srcdir}/.sinst
|  export checkfile=${topdir}/${FULLPKG}.check
| -# run on
| -host=i686-pc-cygwin
| -# if this package creates binaries, they run on
| -target=i686-pc-cygwin
|  prefix=/usr
|  sysconfdir=/etc
|  MY_CFLAGS="-O2"

Most modern "configure" script complain that --build should be used
instead of --host, and that this could use a cross-compiler, while
autodetections should work "better or equal".
But I guess tghis could be useful in case of compiling on linux with
cross-compiler?
does anybody needs this, actually?

| @@ -80,8 +86,7 @@
|    --libdir=${prefix}/lib --includedir=${prefix}/include \
|    --mandir=${prefix}/share/man --infodir=${prefix}/share/info \
|    --libexecdir='${sbindir}' --localstatedir=/var \
| -  --datadir='${prefix}/share'
| -)
| +  --datadir='${prefix}/share' )
|  }
|  build() {
|    (cd ${objdir} && \

Just "consistence" in the "close parens" style.

| @@ -103,8 +108,7 @@
|        rm -f ${instdir}${f} ; \
|      fi ;\
|    done &&\
| -  for d in ${prefix}/share/doc/${PKG}-${VER} ${prefix}/share/doc/Cygwin \
| -           ${sysconfdir}/postinstall ; do
| +  for d in ${prefix}/share/doc/${PKG}-${VER}
${prefix}/share/doc/Cygwin ; do
|      if [ ! -d ${instdir}${d} ] ; then
|        mkdir -p ${instdir}${d} ;\
|      fi ;\
| @@ -131,14 +135,16 @@
|      fi ;\
|    fi ;\
|    if [ -f ${srcdir}/CYGWIN-PATCHES/postinstall.sh ] ; then \
| +    if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
| +      mkdir -p ${instdir}${sysconfdir}/postinstall ; \
| +    fi && \
|    /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
|        ${instdir}${sysconfdir}/postinstall/${PKG}.sh
|    fi )
|  }

Creating postinstall dir only if it is used simplify the more common
(altough not dangerous) problem in packaging: an empty postinstall dir.

|  strip() {
|    (cd ${instdir} && \
| -  find . -name "*.dll" | xargs strip > /dev/null 2>&1
| -  find . -name "*.exe" | xargs strip > /dev/null 2>&1
| +  find . -name "*.dll" -or -name "*.exe" | xargs strip > /dev/null 2>&1
|    true )
|  }

Just a bit smaller and faster...

| @@ -163,14 +169,53 @@
|  }
|  spkg() {
|    (mkpatch && \
| +  if [ "${SIG}" ]; then 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}/; fi && \
|    cp $0 ${srcinstdir}/`basename $0` && \
| +  name=$0 text="SCRIPT" sigfile && \
| +  if [ "${SIG}" ]; then cp $0.sig ${srcinstdir}/; fi && \
|    cd ${srcinstdir} && \
|    tar cvjf ${src_pkg} * )
|  }
|  finish() {
|    rm -rf ${srcdir}
|  }
| +sigfile() {
| +  if [ \( "${SIG}" \) -a \( -e $name \) -a \( \( ! -e $name.sig \) -o
\( $name -nt $name.sig \) \) ]; then \
| +    if [ -x /usr/bin/gpg ]; then \
| +      echo "$text signature need to be updated"; \
| +      rm -f $name.sig; \
| +      /usr/bin/gpg --detach-sign $name; \
| +    else \
| +      echo "You need the gnupg package installed in order to make
signatures."; \
| +    fi; \
| +  fi;
| +}
| +checksig() {
| +  if [ -x /usr/bin/gpg ]; then \
| +    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_orig_pkg}.sig ]; then \
| +      echo "ORIGINAL PACKAGE signature follows:"; \
| +      /usr/bin/gpg --verify ${src_orig_pkg}.sig ${src_orig_pkg}; \
| +    else \
| +      echo "ORIGINAL PACKAGE 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; \
| +  else
| +    echo "You need the gnupg package installed in order to check
signatures."; \
| +  fi;
| +}
|  case $1 in
|    prep)        prep ; STATUS=$? ;;
|    mkdirs)      mkdirs; STATUS=$? ;;
| @@ -187,6 +232,7 @@
|    src-package) spkg ; STATUS=$? ;;
|    spkg)        spkg ; STATUS=$? ;;
|    finish) finish ; STATUS=$? ;;
| +  checksig)    checksig ; STATUS=$? ;;
|    all) prep && conf && build && install && \
|       strip && pkg && spkg && finish ; \
|           STATUS=$? ;;

This part is the "GPG signature" patch itself.

Lapo

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkAP1wgACgkQaJiCLMjyUvs6kQCgp+EQgSRLB38o3/a9qJTme4yG
uY0AoJ0M+5IFU59kE2rlzHH/W6LNHD5O
=DAU6
-----END PGP SIGNATURE-----
--- templates/generic-build-script	2003-12-05 10:50:37.275959700 +0100
+++ generic.sh	2004-01-20 17:01:45.439514500 +0100
@@ -26,15 +26,25 @@
 export FULLPKG=${PKG}-${VER}-${REL}
 
 # determine correct decompression option and tarball filename
-if [ -e ${PKG}-${VER}.tar.gz ] ; then
-  export opt_decomp=z
-  export src_orig_pkg_ext=gz
-elif [ -e ${PKG}-${VER}.tar.bz2 ] ; then
+export BASEPKG=${PKG}-${VER}
+if [ -e ${BASEPKG}.tar.bz2 ] ; then
   export opt_decomp=j
-  export src_orig_pkg_ext=bz2
+  export src_orig_pkg_name=${BASEPKG}.tar.bz2
+elif [ -e ${BASEPKG}.tar.gz ] ; then
+  export opt_decomp=z
+  export src_orig_pkg_name=${BASEPKG}.tar.gz
+elif [ -e ${BASEPKG}.tgz ] ; then
+  export opt_decomp=z
+  export src_orig_pkg_name=${BASEPKG}.tgz
+elif [ -e ${BASEPKG}.tar ] ; then
+  export opt_decomp=
+  export src_orig_pkg_name=${BASEPKG}.tar
+else
+  echo Cannot find original package.
+  exit 1
 fi
 
-export src_orig_pkg_name=${PKG}-${VER}.tar.${src_orig_pkg_ext}
+# determine correct names for generated files
 export src_pkg_name=${FULLPKG}-src.tar.bz2
 export src_patch_name=${FULLPKG}.patch
 export bin_pkg_name=${FULLPKG}.tar.bz2
@@ -48,10 +58,6 @@
 export instdir=${srcdir}/.inst
 export srcinstdir=${srcdir}/.sinst
 export checkfile=${topdir}/${FULLPKG}.check
-# run on
-host=i686-pc-cygwin
-# if this package creates binaries, they run on
-target=i686-pc-cygwin
 prefix=/usr
 sysconfdir=/etc
 MY_CFLAGS="-O2"
@@ -80,8 +86,7 @@
   --libdir=${prefix}/lib --includedir=${prefix}/include \
   --mandir=${prefix}/share/man --infodir=${prefix}/share/info \
   --libexecdir='${sbindir}' --localstatedir=/var \
-  --datadir='${prefix}/share'
-)
+  --datadir='${prefix}/share' )
 }
 build() {
   (cd ${objdir} && \
@@ -103,8 +108,7 @@
       rm -f ${instdir}${f} ; \
     fi ;\
   done &&\
-  for d in ${prefix}/share/doc/${PKG}-${VER} ${prefix}/share/doc/Cygwin \
-           ${sysconfdir}/postinstall ; do
+  for d in ${prefix}/share/doc/${PKG}-${VER} ${prefix}/share/doc/Cygwin ; do
     if [ ! -d ${instdir}${d} ] ; then
       mkdir -p ${instdir}${d} ;\
     fi ;\
@@ -131,14 +135,16 @@
     fi ;\
   fi ;\
   if [ -f ${srcdir}/CYGWIN-PATCHES/postinstall.sh ] ; then \
+    if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
+      mkdir -p ${instdir}${sysconfdir}/postinstall ; \
+    fi && \
   /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
       ${instdir}${sysconfdir}/postinstall/${PKG}.sh
   fi )
 }
 strip() {
   (cd ${instdir} && \
-  find . -name "*.dll" | xargs strip > /dev/null 2>&1
-  find . -name "*.exe" | xargs strip > /dev/null 2>&1
+  find . -name "*.dll" -or -name "*.exe" | xargs strip > /dev/null 2>&1
   true )
 }
 list() {
@@ -163,14 +169,53 @@
 }
 spkg() {
   (mkpatch && \
+  if [ "${SIG}" ]; then 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}/; fi && \
   cp $0 ${srcinstdir}/`basename $0` && \
+  name=$0 text="SCRIPT" sigfile && \
+  if [ "${SIG}" ]; then cp $0.sig ${srcinstdir}/; fi && \
   cd ${srcinstdir} && \
   tar cvjf ${src_pkg} * )
 }
 finish() {
   rm -rf ${srcdir} 
 }
+sigfile() {
+  if [ \( "${SIG}" \) -a \( -e $name \) -a \( \( ! -e $name.sig \) -o \( $name -nt $name.sig \) \) ]; then \
+    if [ -x /usr/bin/gpg ]; then \
+      echo "$text signature need to be updated"; \
+      rm -f $name.sig; \
+      /usr/bin/gpg --detach-sign $name; \
+    else \
+      echo "You need the gnupg package installed in order to make signatures."; \
+    fi; \
+  fi;
+}
+checksig() {
+  if [ -x /usr/bin/gpg ]; then \
+    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_orig_pkg}.sig ]; then \
+      echo "ORIGINAL PACKAGE signature follows:"; \
+      /usr/bin/gpg --verify ${src_orig_pkg}.sig ${src_orig_pkg}; \
+    else \
+      echo "ORIGINAL PACKAGE 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; \
+  else
+    echo "You need the gnupg package installed in order to check signatures."; \
+  fi;
+}
 case $1 in
   prep)	prep ; STATUS=$? ;;
   mkdirs)	mkdirs; STATUS=$? ;;
@@ -187,6 +232,7 @@
   src-package)	spkg ; STATUS=$? ;;
   spkg)	spkg ; STATUS=$? ;;
   finish) finish ; STATUS=$? ;;
+  checksig)	checksig ; STATUS=$? ;;
   all) prep && conf && build && install && \
      strip && pkg && spkg && finish ; \
 	  STATUS=$? ;;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Cygwin)

iEYEABECAAYFAkAP1poACgkQaJiCLMjyUvuNnQCgw4MD535qgsguwwvyxt/c2YZs
dwoAoOHAt6hN/QP5m4+5LM4nrHZNa3BN
=OOwl
-----END PGP SIGNATURE-----


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