Browse Source

tools/version.sh: Use backup files on Win32

Windows doesn't permit us to edit a file in-place with Perl.
So create backup files when we perform the edit, and remove them
when we are done.  This is a tad slower on POSIX systems, but is
much more portable.

Change-Id: I429c7d698924cb32e709363f5da82f7232bbdab2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.9
Shawn O. Pearce 15 years ago
parent
commit
200f3caefc
  1. 11
      tools/version.sh

11
tools/version.sh

@ -109,13 +109,13 @@ API_N=$(perl -e '
print "$a.$b.0"; print "$a.$b.0";
' "$API_V") ' "$API_V")
perl -pi -e ' perl -pi~ -e '
s/^(Bundle-Version:\s*).*$/${1}'"$OSGI_V"'/; s/^(Bundle-Version:\s*).*$/${1}'"$OSGI_V"'/;
s/(org.eclipse.jgit.*;version=")[^"[(]*(")/${1}'"$API_V"'${2}/; s/(org.eclipse.jgit.*;version=")[^"[(]*(")/${1}'"$API_V"'${2}/;
s/(org.eclipse.jgit.*;version="\[)[^"]*(\)")/${1}'"$API_V,$API_N"'${2}/; s/(org.eclipse.jgit.*;version="\[)[^"]*(\)")/${1}'"$API_V,$API_N"'${2}/;
' $(git ls-files | grep META-INF/MANIFEST.MF) ' $(git ls-files | grep META-INF/MANIFEST.MF)
perl -pi -e ' perl -pi~ -e '
if ($ARGV ne $old_argv) { if ($ARGV ne $old_argv) {
$seen_version = 0; $seen_version = 0;
$old_argv = $ARGV; $old_argv = $ARGV;
@ -126,11 +126,11 @@ perl -pi -e '
} }
' org.eclipse.jgit.packaging/org.*.feature/feature.xml ' org.eclipse.jgit.packaging/org.*.feature/feature.xml
perl -pi -e ' perl -pi~ -e '
s{<(version)>.*</\1>}{<${1}>'"$POM_V"'</${1}>}; s{<(version)>.*</\1>}{<${1}>'"$POM_V"'</${1}>};
' org.eclipse.jgit.packaging/org.*.feature/pom.xml ' org.eclipse.jgit.packaging/org.*.feature/pom.xml
perl -pi -e ' perl -pi~ -e '
if ($ARGV ne $old_argv) { if ($ARGV ne $old_argv) {
$seen_version = 0; $seen_version = 0;
$old_argv = $ARGV; $old_argv = $ARGV;
@ -141,7 +141,7 @@ perl -pi -e '
} }
' org.eclipse.jgit.packaging/org.eclipse.jgit.updatesite/pom.xml ' org.eclipse.jgit.packaging/org.eclipse.jgit.updatesite/pom.xml
perl -pi -e ' perl -pi~ -e '
if ($ARGV ne $old_argv) { if ($ARGV ne $old_argv) {
$seen_version = 0; $seen_version = 0;
$old_argv = $ARGV; $old_argv = $ARGV;
@ -152,4 +152,5 @@ perl -pi -e '
} }
' $(git ls-files | grep pom.xml) ' $(git ls-files | grep pom.xml)
find . -name '*~' | xargs rm -f
git diff git diff

Loading…
Cancel
Save