delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/07/12/14:27:56

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Andrew Schulman <schulman DOT andrew AT epamail DOT epa DOT gov>
Subject: cygport: patches welcome?
Date: Thu, 12 Jul 2007 14:26:56 -0400
Lines: 48
Message-ID: <uhsc93hu2herpu9ioqb98m7upnrnqng6k4@4ax.com>
Mime-Version: 1.0
X-Archive: encrypt
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I like cygport and would like to make a couple of improvements to it:

(1) Comprehensive man page, describing the available facilities for writing
cygport scripts.  As it is now, I have to page through
/usr/lib/cygport/bin/* and even /usr/bin/cygport itself, to see what the
available functions are and exactly how they work.  Some of the functions
are described in /usr/share/doc/cygport/README, but not all and not
completely.  I want to add a complete description of them to the man page.

(2) Smarter update of config files.  In cygport's make_etc_defaults
function, we have a golden opportunity to fix a problem that's persisted for
a long time in Cygwin:  when a package's default config file (typically in
/etc) is updated, we don't currently have a standard way of automatically
and safely installing the new version, because just copying it into /etc
would destroy any of the user's existing customizations.  Our current best
practice is to put

[ -f /etc/file ] || cp /etc/defaults/etc/file /etc

in a postinstall script.  If the package has ever been installed before,
even if the user has never touched it, the new config file won't be copied
in; we have to alert users to copy them in manually.  Debian has a smarter
way of handling this problem:  in pseudocode, it looks something like:

  if md5hash(/etc/file) == stored md5hash(/etc/defaults/etc/file)
  then
    # user hasn't changed their config; install the new one in its place
    cp /etc/defaults/etc/file /etc
  else
    # user changed their config; install the new one alongside it
    cp /etc/defaults/etc/file /etc/file.conf-new
  fi
  store md5hash(/etc/defaults/etc/file)

With this method, users still have to manually merge in any customizations
they've made, but at least if they haven't customized the config file, the
new one will be automatically installed in its place.

make_etc_defaults would be an excellent place to start implementing this,
especially as more packagers move to cygport.  The packager could still call
make_etc_defaults as before, and cygport would insert code for the above
algorithm.

Question for Yaakov:  If I submit patches for these things, are you at least
potentially interested in merging them into cygport?

Thanks,
Andrew.


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019