File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ include $(top_builddir)/src/Makefile.global
14
14
srcdir =$(top_srcdir ) /$(subdir )
15
15
16
16
all :
17
- true
17
+ $(PERL ) setver.pl $(top_srcdir ) $(top_builddir )
18
+ chmod 0755 pgpro_upgrade
18
19
19
20
install : installdirs
20
21
$(INSTALL_PROGRAM ) $(srcdir ) /pgpro_upgrade ' $(DESTDIR)$(bindir)/pgpro_upgrade'
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+ use Cwd qw( getcwd abs_path) ;
3
+ my $major_version ;
4
+ my $catversion ;
5
+ my $curdir = abs_path(getcwd()." /../.." );
6
+ my $top_srcdir = $ARGV [0] || $curdir ;
7
+ my $top_builddir = $ARGV [1] || $curdir ;
8
+ open F," $top_builddir /src/include/pg_config.h" ;
9
+ while (<F>) {
10
+ $major_version = $1 if / #define PG_MAJORVERSION "(.*)"/ ;
11
+ }
12
+ close F;
13
+ open F," $top_srcdir /src/include/catalog/catversion.h" or die " catversion.h $! \n " ;
14
+ while (<F>) {
15
+ $catversion = $1 if / #define CATALOG_VERSION_NO\s +(\S +)/ ;
16
+ }
17
+ close F;
18
+ if (-f " pgpro_upgrade" ) {
19
+ unlink (" pgpro_upgrade.bak" ) if -f " pgpro_upgrade.bak" ;
20
+ rename (" pgpro_upgrade" ," pgpro_upgrade.bak" );
21
+ open IN," pgpro_upgrade.bak"
22
+ } else {
23
+ open IN," $top_srcdir /src/pgpro-upgrade/pgpro_upgrade" ;
24
+ }
25
+ open OUT," >" ," pgpro_upgrade" ;
26
+ while (<IN>) {
27
+ s / ^CATALOG_VERSION_NO=.*$/ CATALOG_VERSION_NO=$catversion / ;
28
+ s / ^MAJORVER=.*$/ MAJORVER=$major_version / ;
29
+ print OUT $_ ;
30
+ }
31
+ close IN;
32
+ close OUT;
You can’t perform that action at this time.
0 commit comments