Commits

Darrell Schiebel authored cdabacc2604
version number substitution is still required (CAS-12970)

scripts/adjust

Deleted
1 -#!/usr/bin/perl
2 -use File::Find;
3 -use File::Fetch;
4 -use File::Copy;
5 -use File::Slurp;
6 -use File::Basename;
7 -use Cwd qw(abs_path getcwd);
8 -use File::Path qw(make_path remove_tree);
9 -use POSIX qw(strftime);
10 -use Config;
11 -
12 -#Fetch failed! HTTP response: 500 Internal Server Error [500 Can't verify SSL peers without knowing which Certificate Authorities to trust] at scripts/create-app line 62.
13 -$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
14 -###
15 -### avoid: TLSv1.0 backends...
16 -###
17 -$File::Fetch::BLACKLIST = [qw|lwp httptiny httplite|];
18 -
19 -$exe = abs_path($0);
20 -$path = abs_path(dirname($exe));
21 -$java = '/usr/bin/java';
22 -$jarfile_name = "create-app-assembly-1.7.jar";
23 -@java_version = ( );
24 -open(JAVAVER, "$java -version 2>&1 |");
25 -foreach ( <JAVAVER> ) {
26 - if ( m|version "?(\d+)\.(\d+)|i ) {
27 - @java_version = ($1,$2);
28 - print "found java version ", join('.',@java_version), "\n";
29 - }
30 -}
31 -close(JAVAVER);
32 -die "cannot run $java" unless scalar(@java_version) > 0;
33 -die "java version 1.8 or greater is required\n" unless $java_version[0] == 1 && $java_version[1] >= 8;
34 -
35 -### install path
36 -$distro_jarfile = $jarfile = "$path/java/$jarfile_name";
37 -if ( ! -e $jarfile ) {
38 - ### development path
39 - $jarfile = "$path/../target/scala-2.12/$jarfile_name";
40 - if ( ! -e $jarfile ) {
41 - $jarfile = $distro_jarfile;
42 - ### pull from download url
43 - my $jardir = dirname($jarfile);
44 - make_path($jardir);
45 - my $ff = File::Fetch->new(uri => "http://casa.nrao.edu/download/devel/xml-casa/java/$jarfile_name");
46 - my $where = $ff->fetch( to => $jardir );
47 - }
48 -}
49 -die "configuration error, cannot find jar file ($jarfile_name)" unless -e $jarfile;
50 -
51 -if ( $Config{osname} eq "darwin" && ! -e "casaviewer.icns" ) {
52 - my $ff = File::Fetch->new(uri => "http://casa.nrao.edu/download/devel/xml-casa/viewer/casaviewer.icns");
53 - $ff->fetch( );
54 -}
55 -
56 -open(VER,"cd casa-source/casa5 && code/install/resolvegitrevision.sh --pretty-print 2>&1 |");
57 -$major_ver = '';
58 -$minor_ver = '';
59 -$patch_ver = '';
60 -$build_ver = '';
61 -@lines = <VER>;
62 -foreach ( @lines ) {
63 - if ( m|^(\d+)\.(\d+)\.(\d+)[^0-9]+(\d+)\+?$| ) {
64 - $major_ver = $1;
65 - $minor_ver = $2;
66 - $patch_ver = $3;
67 - $build_ver = $4;
68 - break;
69 - }
70 -}
71 -close(VER);
72 -unless ( $major_ver ne '' && $minor_ver ne '' && $patch_ver ne '' && $build_ver ne '' ) {
73 - print "unable to determine version number from resolvegitrevision.sh output:\n";
74 - foreach ( @lines ) { print " $_"; }
75 - die "cannot continue...";
76 -}
77 -
78 -#unless ( -e ".casacore-measures-patch-applied" ) {
79 -# my $patchfile = "scripts/waiting-on-casacore-acceptance.diff";
80 -# if ( -f $patchfile ) {
81 -# my $now_string = strftime("%a %b %e %H:%M:%S %Y",localtime);
82 -# open( TURD, "> .casacore-measures-patch-applied" );
83 -# print TURD "$now_string\n";
84 -# close(TURD);
85 -# open( PATCH, "patch -p0 < $patchfile |" );
86 -# while ( my $line = <PATCH> ) { print $line; }
87 -# close(PATCH);
88 -# }
89 -#}
90 -
91 -%include_changes = ( 'display/region/QtRegionState.ui.h' => 'ui/ui_QtRegionState.h',
92 - 'display/region/QtImageRegionStats.ui.h' => 'ui/ui_QtImageRegionStats.h',
93 - 'display/region/QtMsRegionStats.ui.h' => 'ui/ui_QtMsRegionStats.h',
94 - 'display/region/SlicerStats.ui.h' => 'ui/ui_SlicerStats.h',
95 - 'display/region/PVLineStats.ui.h' => 'ui/ui_PVLineStats.h',
96 - 'display/region/QtRegionDock.ui.h' => 'ui/ui_QtRegionDock.h',
97 - 'display/QtViewer/AboutDialogViewer.ui.h' => 'ui/ui_AboutDialogViewer.h',
98 - 'display/QtViewer/AnimatorHolder.ui.h' => 'ui/ui_AnimatorHolder.h',
99 - 'display/QtViewer/AnimatorWidget.ui.h' => 'ui/ui_AnimatorWidget.h',
100 - 'display/QtViewer/ColorHistogram.ui.h' => 'ui/ui_ColorHistogram.h',
101 - 'guitools/Histogram/BinPlotWidget.ui.h' => 'ui/ui_BinPlotWidget.h',
102 - 'guitools/Histogram/FootPrintWidget.ui.h' => 'ui/ui_FootPrintWidget.h',
103 - 'display/QtViewer/ColorTransferWidget.ui.h' => 'ui/ui_ColorTransferWidget.h',
104 - 'display/QtViewer/CursorTrackingHolder.ui.h' => 'ui/ui_CursorTrackingHolder.h',
105 - 'adjustmentBottom.ui.h' => 'ui/ui_adjustmentBottom.h',
106 - 'sliderLabelItem.ui.h' => 'ui/ui_sliderLabelItem.h',
107 - 'sliderEditorItem.ui.h' => 'ui/ui_sliderEditorItem.h',
108 - 'lineEditorItem.ui.h' => 'ui/ui_lineEditorItem.h',
109 - 'comboItem.ui.h' => 'ui/ui_comboItem.h',
110 - 'checkButtonItem.ui.h' => 'ui/ui_checkButtonItem.h',
111 - 'pushButtonItem.ui.h' => 'ui/ui_pushButtonItem.h',
112 - 'minMaxEditorItem.ui.h' => 'ui/ui_minMaxEditorItem.h',
113 - 'pairItem.ui.h' => 'ui/ui_pairItem.h',
114 - 'display/QtViewer/QtAnnotatorGui.ui.h' => 'ui/ui_QtAnnotatorGui.h',
115 - 'display/QtViewer/QtCanvasManager.ui.h' => 'ui/ui_QtCanvasManager.h',
116 - 'display/QtViewer/CursorLink.ui.h' => 'ui/ui_CursorLink.h',
117 - 'display/QtViewer/SlicerGen.ui.h' => 'ui/ui_SlicerGen.h',
118 - 'display/QtViewer/QtDataManager.ui.h' => 'ui/ui_QtDataManager.h',
119 - 'display/QtViewer/QtDataMgrMsSelect.ui.h' => 'ui/ui_QtDataMgrMsSelect.h',
120 - 'display/QtViewer/VOParam.ui.h' => 'ui/ui_VOParam.h',
121 - 'display/QtViewer/QtDataOptionsPanel.ui.h' => 'ui/ui_QtDataOptionsPanel.h',
122 - 'display/RegionShapes/QtRegionShapeManager.ui.h' => 'ui/ui_QtRegionShapeManager.h',
123 - 'display/RegionShapes/QtRSFileLoader.ui.h' => 'ui/ui_QtRSFileLoader.h',
124 - 'display/RegionShapes/QtRSFileSaver.ui.h' => 'ui/ui_QtRSFileSaver.h',
125 - 'display/QtViewer/printControl.ui.h' => 'ui/ui_printControl.h',
126 - 'display/QtViewer/QtRegionMgr.ui.h' => 'ui/ui_QtRegionMgr.h',
127 - 'display/QtPlotter/QtProfileGUI.ui.h', => 'ui/ui_QtProfileGUI.h',
128 - 'display/QtPlotter/CanvasHolder.ui.h' => 'ui/ui_CanvasHolder.h',
129 - 'display/QtPlotter/LineOverlaysTab.ui.h' => 'ui/ui_LineOverlaysTab.h',
130 - 'display/QtPlotter/LineOverlaysSearchResultsDialog.ui.h' => 'ui/ui_LineOverlaysSearchResultsDialog.h',
131 - 'display/QtPlotter/SearchRedshiftDialog.ui.h' => 'ui/ui_SearchRedshiftDialog.h',
132 - 'display/QtPlotter/SettingsWidget.ui.h' => 'ui/ui_SettingsWidget.h',
133 - 'display/QtPlotter/SpectralPositioningWidget.ui.h' => 'ui/ui_SpectralPositioningWidget.h',
134 - 'display/QtViewer/QtExportManager.ui.h' => 'ui/ui_QtExportManager.h',
135 - 'display/QtViewer/ViewerPreferences.ui.h' => 'ui/ui_ViewerPreferences.h',
136 - 'display/QtViewer/ImageManager/ImageManagerDialog.ui.h' => 'ui/ui_ImageManagerDialog.h',
137 - 'display/QtViewer/ImageManager/ImageView.ui.h' => 'ui/ui_ImageView.h',
138 - 'display/Fit/Fit2DTool.ui.h' => 'ui/ui_Fit2DTool.h',
139 - 'display/Fit/FindSourcesDialog.ui.h' => 'ui/ui_FindSourcesDialog.h',
140 - 'display/Fit/PixelRangeDialog.ui.h' => 'ui/ui_PixelRangeDialog.h',
141 - 'display/Fit/ResidualHistogramDialog.ui.h' => 'ui/ui_ResidualHistogramDialog.h',
142 - 'display/Fit/Fit2DLogDialog.ui.h' => 'ui/ui_Fit2DLogDialog.h',
143 - 'display/Slicer/SlicerMainWindow.ui.h' => 'ui/ui_SlicerMainWindow.h',
144 - 'display/Slicer/ImageSlice.ui.h' => 'ui/ui_ImageSlice.h',
145 - 'guitools/Histogram/HistogramMain.ui.h' => 'ui/ui_HistogramMain.h',
146 - 'guitools/Histogram/ImageLoader.ui.h' => 'ui/ui_ImageLoader.h',
147 - 'guitools/Histogram/SaveHistogramWidget.ui.h' => 'ui/ui_SaveHistogramWidget.h',
148 - 'display/Clean/CleanGui.ui.h' => 'ui/ui_CleanGui.h',
149 - 'display/QtViewer/QtExportBrowser.ui.h' => 'ui/ui_QtExportBrowser.h',
150 - 'display/region/HistogramTab.ui.h' => 'ui/ui_HistogramTab.h',
151 - 'guitools/Histogram/FitWidget.ui.h' => 'ui/ui_FitWidget.h',
152 - 'guitools/Histogram/RangeControlsWidget.ui.h' => 'ui/ui_RangeControlsWidget.h',
153 - 'guitools/Histogram/BinCountWidget.ui.h' => 'ui/ui_BinCountWidget.h',
154 - 'guitools/Histogram/ChannelRangeWidget.ui.h' => 'ui/ui_ChannelRangeWidget.h',
155 - 'guitools/Histogram/ZoomWidget.ui.h' => 'ui/ui_ZoomWidget.h',
156 - 'display/RegionShapes/QtSingleRegionShape.ui.h' => 'ui/ui_QtSingleRegionShape.h',
157 - 'display/RegionShapes/QtEditRegionShape.ui.h' => 'ui/ui_QtEditRegionShape.h',
158 - 'display/RegionShapes/QtNewRegionShape.ui.h' => 'ui/ui_QtNewRegionShape.h',
159 - 'display/QtPlotter/SearchMoleculesWidget.ui.h' => 'ui/ui_SearchMoleculesWidget.h',
160 - 'display/QtPlotter/SearchMoleculesResultsWidget.ui.h' => 'ui/ui_SearchMoleculesResultsWidget.h',
161 - 'display/QtPlotter/SpecFitSettingsWidgetOptical.ui.h' => 'ui/ui_SpecFitSettingsWidgetOptical.h',
162 - 'display/QtPlotter/SpecFitSettingsWidgetRadio.ui.h' => 'ui/ui_SpecFitSettingsWidgetRadio.h',
163 - 'display/QtPlotter/GaussianEstimateDialog.ui.h' => 'ui/ui_GaussianEstimateDialog.h',
164 - 'display/QtPlotter/SearchMoleculesDialog.ui.h' => 'ui/ui_SearchMoleculesDialog.h',
165 - 'display/QtPlotter/MomentSettingsWidgetOptical.ui.h' => 'ui/ui_MomentSettingsWidgetOptical.h',
166 - 'display/QtPlotter/MomentSettingsWidgetRadio.ui.h' => 'ui/ui_MomentSettingsWidgetRadio.h',
167 - 'display/QtViewer/ImageManager/ImageScroll.ui.h' => 'ui/ui_ImageScroll.h',
168 - 'display/Slicer/SliceColorPreferences.ui.h' => 'ui/ui_SliceColorPreferences.h',
169 - 'display/Slicer/SlicePlotPreferences.ui.h' => 'ui/ui_SlicePlotPreferences.h',
170 - 'display/Slicer/SliceSegment.ui.h' => 'ui/ui_SliceSegment.h',
171 - 'guitools/Histogram/ColorPreferences.ui.h' => 'ui/ui_ColorPreferences.h',
172 - 'display/Clean/ConfirmStop.ui.h' => 'ui/ui_ConfirmStop.h',
173 - 'display/region/HistogramGraph.ui.h' => 'ui/ui_HistogramGraph.h',
174 - 'display/QtPlotter/SpecFitLogDialog.ui.h' => 'ui/ui_SpecFitLogDialog.h',
175 - 'display/QtPlotter/SpecFitSettingsFixedTableCell.ui.h' => 'ui/ui_SpecFitSettingsFixedTableCell.h',
176 - 'display/QtPlotter/GaussianEstimateWidget.ui.h' => 'ui/ui_GaussianEstimateWidget.h',
177 - 'display/QtPlotter/ThresholdingBinPlotDialog.ui.h' => 'ui/ui_ThresholdingBinPlotDialog.h',
178 - 'display/QtPlotter/annotations/AnnotationEditor.ui.h' => 'ui/ui_AnnotationEditor.h',
179 - 'display/RegionShapes/QtDS9WriteOptions.ui.h' => 'ui/ui_QtDS9WriteOptions.h',
180 - 'display/QtPlotter/annotations/AnnotationEditorText.ui.h' => 'ui/ui_AnnotationEditorText.h',
181 - 'display/QtPlotter/QtProfilePrefsGUI.ui.h' => 'ui/ui_QtProfilePrefsGUI.h',
182 - 'display/QtPlotter/ColorSummaryWidget.ui.h' => 'ui/ui_ColorSummaryWidget.h',
183 - 'display/QtPlotter/LegendPreferences.ui.h' => 'ui/ui_LegendPreferences.h',
184 - 'display/QtPlotter/SmoothPreferences.ui.h' => 'ui/ui_SmoothPreferences.h',
185 - 'guitools/Feather/PreferencesColor.ui.h' => 'ui/ui_PreferencesColor.h',
186 - 'guitools/Feather/PreferencesFunction.ui.h' => 'ui/ui_PreferencesFunction.h',
187 -
188 - );
189 -
190 -
191 -$adjust_headers = sub {
192 - if ( -f $_ && m@(\.cc|\.h|\.tcc)$@ ) {
193 - my $contents = read_file($_);
194 - foreach my $from ( keys %include_changes ) {
195 - my $to = $include_changes{$from};
196 - $contents =~ s|$from|$to|g;
197 - }
198 - open( my $out, "> $_" );
199 - write_file($_,$contents);
200 - }
201 -};
202 -
203 -find( { wanted => $adjust_headers }, 'casa-source' );
204 -
205 -make_path("source");
206 -open( VER_IN, "< casa-source/casa5/code/stdcasa/version.cc.in" );
207 -open( VER_OUT, "> source/casa-version.cc" );
208 -while ( $_ = <VER_IN> ) {
209 - s|\@CASA_VERSION_MAJOR\@|$major_ver|g;
210 - s|\@CASA_VERSION_MINOR\@|$minor_ver|g;
211 - s|\@CASA_VERSION_PATCH\@|$patch_ver|g;
212 - s|\@CASA_VERSION_FEATURE\@|$build_ver|g;
213 - print VER_OUT $_;
214 -}
215 -close(VER_OUT);
216 -close(VER_IN);
217 -if ( ! -f "casa-source/casatools/casacore/casa/version.cc" ) {
218 - die "casacore version file (casa-source/casatools/casacore/casa/version.cc) does not exist...";
219 -}
220 -copy("casa-source/casatools/casacore/casa/version.cc","source/casacore-version.cc");
221 -if ( -f "casa-source/casatools/casacore/casa/version.h.in" ) {
222 - my $casacore_major = "";
223 - my $casacore_minor = "";
224 - my $casacore_patch = "";
225 - open( CFG, "< casa-source/casatools/casacore/CMakeLists.txt" );
226 - while ( $_ = <CFG> ) {
227 - m|set\s*\(\s*PROJECT_VERSION_MAJOR\s+(\d+)\s*\)| && ($casacore_major = $1, next);
228 - m|set\s*\(\s*PROJECT_VERSION_MINOR\s+(\d+)\s*\)| && ($casacore_minor = $1, next);
229 - m|set\s*\(\s*PROJECT_VERSION_PATCH\s+(\d+)\s*\)| && ($casacore_patch = $1, next);
230 - }
231 - close(CFG);
232 - open( HIN, "< casa-source/casatools/casacore/casa/version.h.in" );
233 - my @hin = <HIN>;
234 - close(HIN);
235 - open( HOUT, "> casa-source/casatools/casacore/casa/version.h" );
236 - foreach ( @hin ) {
237 - s|\@PROJECT_VERSION_MAJOR\@|$casacore_major|g;
238 - s|\@PROJECT_VERSION_MINOR\@|$casacore_minor|g;
239 - s|\@PROJECT_VERSION_PATCH\@|$casacore_patch|g;
240 - print HOUT $_;
241 - }
242 - close(HOUT);
243 -}
244 -
245 -make_path("include/casacore/casa");
246 -make_path("include/casagrpc/protos");
247 -open(CONFIG_H,"> include/casacore/casa/config.h");
248 -print CONFIG_H casacore_config( );
249 -close(CONFIG_H);
250 -
251 -
252 -sub casacore_config {
253 - my $contents = <<'END-OF-STR';
254 -#ifndef CASA_CONFIG_H
255 -#define CASA_CONFIG_H
256 -#define CASA_DEFAULT_ALIGNMENT (32UL)
257 -#endif
258 -END-OF-STR
259 - return $contents;
260 -}

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut