Skip to content

Commit 13878d5

Browse files
authored
Merge pull request #474 from dscho/drop-obsolete-please.sh-sync
please.sh: drop the obsolete `sync` command
2 parents 9544308 + 5f2a6c1 commit 13878d5

File tree

1 file changed

+0
-178
lines changed

1 file changed

+0
-178
lines changed

please.sh

Lines changed: 0 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -181,170 +181,6 @@ process_keep_despite_upgrade () { # [--keep] <sdk-path>
181181
rm -rf "$1/.keep"
182182
}
183183

184-
sync () { # [--force]
185-
force=
186-
y_opt=y
187-
only=
188-
while case "$1" in
189-
--force)
190-
force='--overwrite=\*'
191-
y_opt=yy
192-
;;
193-
--only-i686|--only-32-bit)
194-
only="$sdk32"
195-
;;
196-
--only-x86_64|--only-64-bit)
197-
only="$sdk64"
198-
;;
199-
-*) die "Unknown option: %s\n" "$1";;
200-
*) break;;
201-
esac; do shift; done
202-
test $# = 0 ||
203-
die "Expected no argument, got $#: %s\n" "$*"
204-
205-
export MSYSTEM=msys
206-
export MSYS2_PATH_TYPE=minimal
207-
for sdk in "$sdk32" "$sdk64"
208-
do
209-
test -z "$only" ||
210-
test "$only" = "$sdk" ||
211-
continue
212-
213-
case "$sdk" in
214-
"$sdk32")
215-
PACMAN_ARCH=i686
216-
;;
217-
"$sdk64")
218-
PACMAN_ARCH=x86_64
219-
;;
220-
*)
221-
die "Invalid SDK $sdk"
222-
;;
223-
esac
224-
225-
mkdir -p "$sdk/var/log" ||
226-
die "Could not ensure %s/var/log/ exists\n" "$sdk"
227-
228-
remove_obsolete_packages ||
229-
die "Could not remove obsolete packages\n"
230-
231-
"$sdk/git-cmd.exe" --command=usr\\bin\\bash.exe -lc \
232-
"for key in 4A6129F4E4B84AE46ED7F635628F528CF3053E04 \
233-
5F944B027F7FE2091985AA2EFA11531AA0AA7F57
234-
do
235-
pacman-key --list-keys \$key >/dev/null 2>&1 || {
236-
pacman-key --recv-keys \$key &&
237-
pacman-key --lsign-key \$key;
238-
} || exit 1
239-
done
240-
pacman.exe -S$y_opt" ||
241-
die "Cannot run pacman in %s\n" "$sdk"
242-
243-
prepare_keep_despite_upgrade "$sdk" ||
244-
die 'Could not keep files as planned\n'
245-
246-
"$sdk/git-cmd.exe" --cd="$sdk" --command=usr\\bin\\bash.exe \
247-
-lc 'pacman.exe -Su '$force' --noconfirm' ||
248-
die "Could not update packages in %s\n" "$sdk"
249-
250-
"$sdk/git-cmd.exe" --command=usr\\bin\\bash.exe -l -c '
251-
pacman-key --list-keys BB3AA74136C569BB >/dev/null ||
252-
pacman-key --populate git-for-windows' ||
253-
die "Could not re-populate git-for-windows-keyring\n"
254-
255-
process_keep_despite_upgrade --keep "$sdk" ||
256-
die 'Could not copy back files-to-keep\n'
257-
258-
case "$(tail -c 16384 "$sdk/var/log/pacman.log" |
259-
grep '\[PACMAN\] starting .* system upgrade' |
260-
tail -n 1)" in
261-
*"full system upgrade")
262-
;; # okay
263-
*)
264-
# only "core" packages were updated, update again
265-
"$sdk/git-cmd.exe" --cd="$sdk" \
266-
--command=usr\\bin\\bash.exe -l \
267-
-c 'pacman -Su '$force' --noconfirm' ||
268-
die "Cannot update packages in %s\n" "$sdk"
269-
270-
process_keep_despite_upgrade --keep "$sdk" ||
271-
die 'Could not copy back files-to-keep\n'
272-
273-
"$sdk/git-cmd.exe" --command=usr\\bin\\bash.exe -l -c '
274-
pacman-key --list-keys BB3AA74136C569BB \
275-
>/dev/null ||
276-
pacman-key --populate git-for-windows' ||
277-
die "Could not re-populate git-for-windows-keyring\n"
278-
;;
279-
esac
280-
281-
process_keep_despite_upgrade "$sdk" ||
282-
die 'Could not copy back files-to-keep\n'
283-
284-
# A ruby upgrade (or something else) may require a re-install
285-
# of the `asciidoctor` gem. We only do this for the 64-bit
286-
# SDK, though, as we require asciidoctor only when building
287-
# Git, whose 32-bit packages are cross-compiled in from 64-bit.
288-
test "$sdk64" != "$sdk" ||
289-
"$sdk/git-cmd.exe" --command=usr\\bin\\bash.exe -l -c \
290-
'test -n "$(gem list --local | grep "^asciidoctor ")" ||
291-
gem install asciidoctor || exit;
292-
export PATH=/mingw32/bin:$PATH;
293-
test -n "$(gem list --local | grep "^asciidoctor ")" ||
294-
gem install asciidoctor' ||
295-
die "Could not re-install asciidoctor in %s\n" "$sdk"
296-
297-
# mingw-w64-git-extra rewrites some files owned by other packages,
298-
# therefore it has to be (re-)installed now
299-
"$sdk/git-cmd.exe" --command=usr\\bin\\bash.exe -l -c \
300-
'pacman -S '$force' --noconfirm mingw-w64-'$PACMAN_ARCH'-git-extra' ||
301-
die "Cannot update mingw-w64-'$PACMAN_ARCH'-git-extra in %s\n" "$sdk"
302-
303-
pacnew="$(sed -ne '/starting core system upgrade/{
304-
:1;
305-
s/.*/WAIT/;x
306-
:2;
307-
n;
308-
/warning:.*installed as .*\.pacnew$/{s/.* as //;H;b2}
309-
/starting full system upgrade/{x;s/WAIT//;x;b2}
310-
/starting core system upgrade/{x;/WAIT/{x;b2};b1}
311-
${x;s/WAIT//;s/^\n//;/./p}
312-
b2;
313-
}' <"$sdk"/var/log/pacman.log)" ||
314-
die "Could not get list of .pacnew files\n"
315-
if test -n "$pacnew"
316-
then
317-
# Make sure we have the mingw-w64-git-extra package locally, as
318-
# one of the .pacnew files could be pacman.conf, and
319-
# replacing it removes the link to Git for Windows'
320-
# Pacman repository
321-
"$sdk/git-cmd.exe" --command=usr\\bin\\bash.exe -l -c \
322-
'pkg=/var/cache/pacman/pkg/$(pacman -Q mingw-w64-'$PACMAN_ARCH'-git-extra |
323-
tr \ -)*.pkg.tar.xz
324-
test -f $pkg || {
325-
pacman -Sw --noconfirm mingw-w64-'$PACMAN_ARCH'-git-extra &&
326-
test -f $pkg || {
327-
echo "Could not cache $pkg" >&2
328-
exit 1
329-
}
330-
}
331-
for f in '"$(echo "$pacnew" | tr '\n' ' ')"'
332-
do
333-
test ! -f $f ||
334-
mv -f $f ${f%.pacnew} || {
335-
echo "Could not rename $f" >&2
336-
exit 1
337-
}
338-
done
339-
pacman -U --noconfirm '$force' $pkg || {
340-
echo "Could not reinstall $pkg" >&2
341-
exit 1
342-
}' ||
343-
die "Could not handle .pacnew files\n"
344-
fi
345-
done
346-
}
347-
348184
mount_sdks () { #
349185
test -d /sdk32 || mount "$sdk32" /sdk32
350186
test -d /sdk64 || mount "$sdk64" /sdk64
@@ -583,20 +419,6 @@ ff_main_branch () {
583419
die "%s: cannot fast-forward main branch\n" "$sdk$pkgpath"
584420
}
585421

586-
remove_obsolete_packages () {
587-
test "a$sdk" = "a$sdk32" &&
588-
arch=i686 ||
589-
arch=x86_64
590-
591-
for p in mingw-w64-$arch-curl-winssl-bin
592-
do
593-
test ! -d "$sdk"/var/lib/pacman/local/$p-[0-9]* ||
594-
"$sdk"/git-cmd.exe --command=usr\\bin\\pacman.exe \
595-
-R --noconfirm $p ||
596-
die "Could not remove %s\n" "$p"
597-
done
598-
}
599-
600422
# require <metapackage> <telltale>
601423
require () {
602424
test -d "$sdk"/var/lib/pacman/local/"${2:-$1}"-[0-9]* ||

0 commit comments

Comments
 (0)