[ANNOUNCEMENT] New package: _autorebase. Call rebaseall after installing new or updated DLLs

Achim Gratz Stromeko@NexGo.DE
Wed Apr 18 13:37:00 GMT 2012


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



More information about the Cygwin mailing list