@@ -620,172 +620,11 @@ tag_git () { # [--force]
620620 echo " Created tag $next_version " >&2
621621}
622622
623- version_from_pkgbuild () { # <PKGBUILD>
624- sed -ne \
625- ' /^_base_\?ver=/{N;N;s/.*=\([0-9].*\)\n.*\npkgrel=\(.*\)/\1-\2/p}' \
626- -e ' /^_ver=/{N;N;N;s/.*=\([.0-9]*\)\([a-z][a-z]*\)\n.*\n.*\npkgrel=\(.*\)/\1.\2-\3/p}' \
627- -e ' /^_\?pkgver=/{N;N;s/.*=\([0-9].*\)\npkgrel=\([0-9]*\)\nepoch=\([0-9\*\)/\3~\1-\2/p;s/.*=\([0-9].*\)\npkgrel=\([0-9]*\).*/\1-\2/p;N;s/.*=\([0-9].*\)\n.*\npkgrel=\([0-9]*\).*/\1-\2/p}' \
628- -e ' /^_\?pkgver=/{N;N;s/[^=]*=\([0-9].*\)\npkgrel=\([0-9]*\)\nepoch=\([0-9]*\).*/\3~\1-\2/p;s/[^=]*=\([0-9].*\)\npkgrel=\([0-9]*\).*/\1-\2/p}' \
629- -e ' /^_basever=/{N;s/^_basever=\([0-9].*\)\n_patchlevel=\([0-9]*\) .*\n.*\npkgrel=\([0-9]*\).*/\1.\2-\3/p}' \
630- < " $1 "
631- }
632-
633- pkg_files () {
634- pkgver=" $( version_from_pkgbuild PKGBUILD) "
635- test -n " $pkgver " ||
636- die " %s: could not determine pkgver\n" " $sdk$pkgpath "
637-
638- test a--for-upload ! = " a$1 " ||
639- echo $package -$pkgver .src.tar.gz
640-
641- if test -z " $sdk "
642- then
643- arch=" $( uname -m) "
644- elif test " a$sdk " = " a$sdk32 "
645- then
646- arch=i686
647- else
648- arch=x86_64
649- fi
650-
651- for p in $package $extra_packages
652- do
653- case " $p " in
654- mingw-w64-git-test-artifacts|mingw-w64-git-pdb)
655- test " --for-upload" = " $1 " || continue ;;
656- esac
657-
658- case " $p " in
659- mingw-w64-* )
660- suffix=-${p# mingw-w64-} -$pkgver -any.pkg.tar.xz
661- case " $1 " in
662- --for-upload)
663- printf " mingw-w64-i686$suffix "
664- printf " mingw-w64-x86_64$suffix "
665- ;;
666- --i686|--x86_64)
667- printf " mingw-w64${1# -} $suffix "
668- ;;
669- ' ' )
670- printf " mingw-w64-$arch$suffix "
671- ;;
672- * )
673- die " Whoops: unknown option %s\n" " $1 "
674- ;;
675- esac
676- ;;
677- git-extra)
678- prefix=$p -$pkgver
679- suffix=.pkg.tar.xz
680- case " $1 " in
681- --for-upload)
682- printf " $prefix -i686$suffix "
683- printf " $prefix -x86_64$suffix "
684- ;;
685- --i686|--x86_64)
686- printf " $prefix ${1# -} $suffix "
687- ;;
688- ' ' )
689- printf " $prefix -$arch$suffix "
690- ;;
691- * )
692- die " Whoops: unknown option %s\n" " $1 "
693- ;;
694- esac
695- ;;
696- * )
697- printf " $p -$pkgver -$arch .pkg.tar.xz"
698- ;;
699- esac
700- done
701- }
702-
703- pkg_install () {
704- require_clean_worktree
705-
706- files=" $( pkg_files) " || exit
707-
708- case " $package " in
709- msys2-runtime)
710- require_not_in_use " $sdk " " usr/bin/msys-2.0.dll"
711- ;;
712- bash)
713- require_not_in_use " $sdk " " usr/bin/sh.exe"
714- require_not_in_use " $sdk " " usr/bin/bash.exe"
715- ;;
716- esac
717-
718- prepare_keep_despite_upgrade " $sdk " ||
719- die ' Could not keep files as planned\n'
720-
721- " $sdk /git-cmd.exe" --command=usr\\ bin\\ sh.exe -l -c \
722- " pacman -U --noconfirm $files "
723-
724- process_keep_despite_upgrade " $sdk " ||
725- die ' Could not keep files as planned\n'
726-
727- if test MINGW = " $type "
728- then
729- prepare_keep_despite_upgrade " $sdk32 " ||
730- die ' Could not keep files as planned\n'
731-
732- " $sdk32 /git-cmd.exe" --command=usr\\ bin\\ sh.exe -l -c \
733- " pacman -U --noconfirm $( pkg_files --i686) "
734-
735- process_keep_despite_upgrade " $sdk32 " ||
736- die ' Could not keep files as planned\n'
737- fi
738- }
739-
740- # origin HEAD
741- really_push () {
742- if ! git push " $@ "
743- then
744- if test " origin HEAD" = " $* "
745- then
746- git pull origin main
747- else
748- git pull " $@ "
749- fi &&
750- git push " $@ " ||
751- return 1
752- fi
753- return 0
754- }
755-
756623pacman_helper () {
757624 " $sdk64 /git-cmd.exe" --command=usr\\ bin\\ bash.exe -l \
758625 " $sdk64 /usr/src/build-extra/pacman-helper.sh" " $@ "
759626}
760627
761- create_bundle_artifact () {
762- test -n " $artifactsdir " || return 0
763- upstream_main_branch=" $( git rev-parse --verify -q git-for-windows/main) " ||
764- upstream_main_branch=" $( git rev-parse --verify -q origin/main) " ||
765- return
766- repo_name=$( git rev-parse --show-toplevel) &&
767- repo_name=${repo_name##*/ } &&
768- if ! main_branch=" $( git symbolic-ref --short HEAD) "
769- then
770- main_branch=main &&
771- git switch -C $main_branch
772- fi &&
773- range=" $upstream_main_branch ..$main_branch " &&
774- if test 0 -lt $( git rev-list --count " $range " )
775- then
776- git bundle create " $artifactsdir " /$repo_name .bundle " $range "
777- else
778- echo " Range $range is empty" > " $artifactsdir /$repo_name .empty"
779- fi
780- }
781-
782- pkg_copy_artifacts () {
783- test -n " $artifactsdir " || return 0
784- files=" $( pkg_files --for-upload) " || exit
785- cp $files " $artifactsdir /" &&
786- create_bundle_artifact
787- }
788-
789628bundle_pdbs () { # [--directory=<artifacts-directory] [--unpack=<directory>] [--arch=<arch>] [<package-versions>]
790629 packages=" mingw-w64-git-pdb mingw-w64-curl-pdb mingw-w64-openssl-pdb"
791630
@@ -1633,48 +1472,6 @@ make_installers_from_mingw_w64_git () { # [--pkg=<package>[,<package>...]] [--ve
16331472 done
16341473}
16351474
1636- # This function can build a given package in the current SDK and copy the result into a specified directory
1637- build_and_copy_artifacts () { # --directory=<artifacts-directory> [--force] [--cleanbuild] <package>
1638- artifactsdir=
1639- force=
1640- cleanbuild=
1641- while case " $1 " in
1642- --directory=* )
1643- artifactsdir=" $( cygpath -am " ${1#* =} " ) " || exit
1644- test -d " $artifactsdir " ||
1645- mkdir " $artifactsdir " ||
1646- die " Could not create artifacts directory: %s\n" " $artifactsdir "
1647- ;;
1648- --directory)
1649- shift
1650- artifactsdir=" $( cygpath -am " $1 " ) " || exit
1651- test -d " $artifactsdir " ||
1652- mkdir " $artifactsdir " ||
1653- die " Could not create artifacts directory: %s\n" " $artifactsdir "
1654- ;;
1655- -f|--force)
1656- force=--force
1657- ;;
1658- --cleanbuild)
1659- cleanbuild=--cleanbuild
1660- ;;
1661- -* ) die " Unknown option: %s\n" " $1 " ;;
1662- * ) break ;;
1663- esac ; do shift ; done
1664- test $# = 1 ||
1665- die " Expected 1 argument, got $# : %s\n" " $* "
1666-
1667- test -n " $artifactsdir " ||
1668- die " Need a directory to copy the artifacts to\n"
1669-
1670- set_package " $1 " &&
1671-
1672- cd " $pkgpath " &&
1673- sdk= pkg_build $force $cleanbuild &&
1674- sdk= pkg_copy_artifacts ||
1675- die " Could not copy artifacts for '%s' to '%s'\n" " $package " " $artifactsdir "
1676- }
1677-
16781475this_script_path=" $( cd " $( dirname " $0 " ) " && echo " $( pwd -W) /$( basename " $0 " ) " ) " ||
16791476die " Could not determine this script's path\n"
16801477
0 commit comments