[26359] in Source-Commits
Re: /svn/athena r25520 - trunk/athena/lib/firefox-extension/debian
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Wed May 30 14:30:35 2012
Date: Wed, 30 May 2012 11:30:33 -0700 (PDT)
From: Geoffrey Thomas <geofft@MIT.EDU>
To: Jonathan Reed <jdreed@MIT.EDU>
cc: source-commits@MIT.EDU
In-Reply-To: <C8864EF0-890D-4CBA-8A78-A12DACA7A57C@mit.edu>
Message-ID: <alpine.DEB.2.00.1205291004040.21310@dr-wily.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
On Tue, 29 May 2012, Jonathan Reed wrote:
> Looking at a package built with 4.12, it looks like all the necessary
> bash crap is there at the top of the postinst, and I could just call
> check_undivert_unlink() ? Is that a good idea?
I think the crap only gets included if config-package-dev itself believes
that it's useful to include the crap. (Or, at least, I'm relying on this
property in the debhelper rewrite.) So I'd say if c-p-d can't handle it on
it's own, you probably want to copy the code (like you did), preferably
with a clear comment saying _why_ we have this copy, instead of calling
into c-p-d's internal API.
> I kind of want cpd-maintscript-helper(1).
+1
> -Jon
>
>
> On May 29, 2012, at 5:47 AM, Geoffrey Thomas wrote:
>
>> Sigh. I was gonna say "I thought we didn't need the pile of bash copypasta since c-p-d 4.12", but since it's cleanup from a mismanaged transition, I guess we actually do?
>>
>> --
>> Geoffrey Thomas
>> geofft@mit.edu
>>
>> On Mon, 28 May 2012, Jonathan D Reed wrote:
>>
>>> Author: jdreed
>>> Date: 2012-05-28 12:17:01 -0400 (Mon, 28 May 2012)
>>> New Revision: 25520
>>>
>>> Modified:
>>> trunk/athena/lib/firefox-extension/debian/changelog
>>> trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst
>>> Log:
>>> In firefox-extension:
>>> * Clean up from when ubufox.js moved to /etc/xul-ext
>>>
>>>
>>> Modified: trunk/athena/lib/firefox-extension/debian/changelog
>>> ===================================================================
>>> --- trunk/athena/lib/firefox-extension/debian/changelog 2012-05-25 22:30:06 UTC (rev 25519)
>>> +++ trunk/athena/lib/firefox-extension/debian/changelog 2012-05-28 16:17:01 UTC (rev 25520)
>>> @@ -5,8 +5,9 @@
>>> worked since Firefox 3.x
>>> * Switch to XPCOMUtils.jsm for the XPCOM scaffolding (break
>>> compatibility with Firefox 2 and earlier)
>>> + * Clean up from when ubufox.js moved to /etc/xul-ext
>>>
>>> - -- Jonathan Reed <jdreed@mit.edu> Fri, 25 May 2012 17:07:03 -0400
>>> + -- Jonathan Reed <jdreed@mit.edu> Mon, 28 May 2012 12:03:40 -0400
>>>
>>> debathena-firefox-extension (10.0.7-0debathena5) unstable; urgency=low
>>>
>>>
>>> Modified: trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst
>>> ===================================================================
>>> --- trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst 2012-05-25 22:30:06 UTC (rev 25519)
>>> +++ trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst 2012-05-28 16:17:01 UTC (rev 25520)
>>> @@ -17,9 +17,82 @@
>>> # for details, see http://www.debian.org/doc/debian-policy/ or
>>> # the debian-policy package
>>>
>>> +package=debathena-firefox-extension
>>> +ours=.debathena
>>> +theirs=.debathena-orig
>>>
>>> +undivert_unlink_symlink()
>>> +{
>>> + file="$1"
>>> + ourfile="$2"
>>> + theirfile="$3"
>>> + if [ ! -L "$file" ] || \
>>> + [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \
>>> + "$(readlink "$file")" != "$(basename "$theirfile")" ]; then
>>> + echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2
>>> + else
>>> + rm -f "$file"
>>> + fi
>>> +}
>>> +
>>> +undivert_unlink_divert()
>>> +{
>>> + file="$1"
>>> + if [ ! -L "$file" ] && [ ! -e "$file" ]; then
>>> + dpkg-divert --remove --rename --package "$package" "$file"
>>> + else
>>> + echo "Not removing diversion of $file by $package" >&2
>>> + fi
>>> +}
>>> +
>>> +undivert_unlink()
>>> +{
>>> + prefix=$1
>>> + suffix=$2
>>> +
>>> + file=$prefix$suffix
>>> + ourfile=$prefix$ours$suffix
>>> + theirfile=$prefix$theirs$suffix
>>> +
>>> + undivert_unlink_symlink "$file" "$ourfile" "$theirfile"
>>> + undivert_unlink_divert "$file" "$package"
>>> +}
>>> +
>>> +cleanup_old_diversion() {
>>> + file="$1"
>>> + if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${file}${theirs} by ${package}"; then
>>> + undivert_unlink "$file"
>>> + fi
>>> +}
>>> +
>>> case "$1" in
>>> configure)
>>> + # In 0.9~rc2-0ubuntu2, the conffile moved to /etc/xul-ext
>>> + # and we horribly broke things. Let's attempt to unbreak them:
>>> + ubufox_version="$(dpkg-query -W -f '${Version}' ubufox)"
>>> + if dpkg --compare-versions "$ubufox_version" ge "0.9~rc2-0ubuntu2"; then
>>> + cleanup_old_diversion /etc/firefox-3.0/pref/ubufox.js
>>> + echo "*** The previous OMINOUS WARNING may be safely ignored ***" >&2
>>> + # If there are files in the location, move them to
>>> + # the new location, unless the user has already done that
>>> + # and that will restore any broken symlinks.
>>> + for f in $(ls /etc/firefox-3.0/pref/ubufox.js.debathena*); do
>>> + mv -u "$f" /etc/xul-ext
>>> + fi
>>> + new_file=/etc/xul-ext/ubufox.js
>>> + if [ -L "$new_file" ] &&
>>> + [ ! -e "$(readlink -f "$new_file")" ]; then
>>> + # If the link target is still missing, copy over upstream's
>>> + # new config file, or upstream's old config file, or give up
>>> + if [ -f /etc/xul-ext/ubufox.js.dpkg-new ]; then
>>> + mv -f /etc/xul-ext/ubufox.js.dpkg-new /etc/xul-ext/ubufox.js
>>> + elif [ -f /etc/xul-ext/ubufox.js.debathena-orig ]; then
>>> + mv -f /etc/xul-ext/ubufox.js.debathena-orig /etc/xul-ext/ubufox.js
>>> + else
>>> + echo "*** Manual inspection and cleanup of /etc/xul-ext/ubufox.js may be required"
>>> + fi
>>> + fi
>>> + fi
>>> if [ -d /usr/lib/firefox/extensions ] && ! [ -h /usr/lib/firefox/extensions ]; then
>>> ln -s /usr/lib/debathena-firefox-extension /usr/lib/firefox/extensions/athena@mit.edu
>>> fi
>>>
>>>
>
>