delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/04/18/09:37:59

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_NUMERIC_HELO,SARE_SUB_ENC_UTF8,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Achim Gratz <Stromeko AT NexGo DOT DE>
Subject: Re: [ANNOUNCEMENT] New package: =?utf-8?b?X2F1dG9yZWJhc2Uu?= Call rebaseall after installing new or updated DLLs
Date: Wed, 18 Apr 2012 13:36:46 +0000 (UTC)
Lines: 57
Message-ID: <loom.20120418T124833-808@post.gmane.org>
References: <announce DOT 20120327153750 DOT GM30721 AT calimero DOT vinschen DOT de> <87fwcslaa6 DOT fsf AT Rainer DOT invalid> <20120329080315 DOT GZ30721 AT calimero DOT vinschen DOT de>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
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

Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> Feel free to participate in further development of the rebase tool.
> Patches for useful functionality is always welcome.  The right forum is
> the cygwin-apps list.

Gmane still has cygwin-apps read-only, so I hope it is acceptable if I post it
here until that is resolved...  what I have implemented is to extract the list
of files to rebase into /etc/rebase/rebase_lst just like rebaseall would do. 
Any extra files to rebase can be placed into list(s) in /etc/rebase/user.d (e.g.
perl5.10.1.lst as produced by perlrebase).  Instead of rebuilding the whole list
every time, just extract from those package lists that are newer than the
rebase_lst.  The update will be very fast even on systems which are struck by a
slow filesystem (in contrast to the initial build of the list, which is in
essence what the current autorebase script _always_ does).

---8<----->8---
#!/bin/ash
rebase_lst () {
    g="/etc/rebase/rebase_lst"
    if [ ! -e "${g}" ]; then
	touch -t 7001010000  /etc/rebase/rebase_lst
    fi
    for f in $( find /etc/setup -name '*.lst.gz' -newer ${g} ); do
	echo "Updating rebase information from ${f} in ${g}."
	cat >>"${g}" <<EOF
# Updating rebase information from ${f}.
EOF
	gzip -d -c ${f} |
	grep -E "\.($Suffixes)\$" |
	sed -e '/cygwin1\.dll$/d' -e '/cyglsa.*\.dll$/d' \
            -e '/sys-root\/mingw/d' -e 's/^/\//' \
            -e '/d?ash\.exe$/d' -e '/rebase\.exe$/d' \
	    >>"${g}"
    done
    mv "${g}" "${g}.old"
    cat >"${g}" <<EOF
# autogenerated, do not edit!
EOF
    cat "${g}.old" /etc/rebase/user.d/* | grep -v "^#" | sort -u >> "${g}"
    chmod 444 "${g}"
}
Suffixes='dll|so|oct'
rebase_lst
---8<----->8---

The two directories in /etc and the /bin/rebaselst script are dropped in via a
package.  In the installer script I then do something like that:

%CYGWIN_INST%\bin\ash -c "PATH=/bin cd /etc/rebase/user.d&&/bin/perlrebase"
%CYGWIN_INST%\bin\ash -c "PATH=/bin rebaselst"
%CYGWIN_INST%\bin\ash -c "PATH=/bin rebase -s -v -T /etc/rebase/rebase_lst"

I'll probably roll this into another script, but for now this seems to work
nicely enough.


Achim.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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