Mercurial > forge
comparison admin/releasePKG.m @ 12669:1c92b4b26ced octave-forge
releasePKG.m: exclude .hg* files of export as of bug #45669
author | jpicarbajal |
---|---|
date | Fri, 31 Jul 2015 19:49:28 +0000 |
parents | 89788e3f77db |
children |
comparison
equal
deleted
inserted
replaced
12668:7623d14dd29c | 12669:1c92b4b26ced |
---|---|
81 repo_path = tilde_expand (checkpath (parser.Results.repopath)); | 81 repo_path = tilde_expand (checkpath (parser.Results.repopath)); |
82 disp(['Exporting from ' repo_path]); | 82 disp(['Exporting from ' repo_path]); |
83 | 83 |
84 % Revision control system | 84 % Revision control system |
85 revsys = parser.Results.revsys; | 85 revsys = parser.Results.revsys; |
86 | 86 |
87 if strcmp (revsys,"svn") | 87 if strcmp (revsys,"svn") |
88 export_call = ["svn export " fullfile(repo_path,pkgname) " " exported " --force"]; | 88 export_call = ["svn export " fullfile(repo_path,pkgname) " " exported " --force"]; |
89 failed = system (export_call); | 89 failed = system (export_call); |
90 else | 90 else |
91 cdir = pwd (); | 91 cdir = pwd (); |
92 cd (fullfile (repo_path,pkgname)); | 92 cd (fullfile (repo_path,pkgname)); |
93 export_call = sprintf ('hg archive %s', exported) | 93 export_call = sprintf ('hg archive --exclude ".hg*" %s', exported) |
94 failed = system (export_call); | 94 failed = system (export_call); |
95 cd (cdir); | 95 cd (cdir); |
96 clear cdir | 96 clear cdir |
97 endif | 97 endif |
98 | 98 |
99 if failed | 99 if failed |
100 error ("Can not export.\n"); | 100 error ("Can not export.\n"); |
101 endif | 101 endif |
102 | 102 |
103 if isempty (OFPATH) || !strcmpi(repo_path, OFPATH) | 103 if isempty (OFPATH) || !strcmpi(repo_path, OFPATH) |
104 setenv('OFPATH',parser.Results.repopath); | 104 setenv('OFPATH',parser.Results.repopath); |
105 printf (["\nEnvironment variable OFPATH set to %s\n" ... | 105 printf (["\nEnvironment variable OFPATH set to %s\n" ... |
106 'add setenv("OFPATH","%s");' ... | 106 'add setenv("OFPATH","%s");' ... |
107 'to your .octaverc to make it permanent.' "\n\n"], ... | 107 'to your .octaverc to make it permanent.' "\n\n"], ... |
123 if !strcmp (tmp{end-1},pkgname_tmp) | 123 if !strcmp (tmp{end-1},pkgname_tmp) |
124 tmp = fullfile (filesep(),tmp{2:end-1}); | 124 tmp = fullfile (filesep(),tmp{2:end-1}); |
125 exported_tmp = tmpnam (); | 125 exported_tmp = tmpnam (); |
126 mv_call = sprintf ("mv -f -T %s %s", tmp, exported_tmp); | 126 mv_call = sprintf ("mv -f -T %s %s", tmp, exported_tmp); |
127 system (mv_call); | 127 system (mv_call); |
128 | 128 |
129 if !rmdir (exported, "s") | 129 if !rmdir (exported, "s") |
130 error ("Couldn't erase folder"); | 130 error ("Couldn't erase folder"); |
131 endif | 131 endif |
132 mv_call = sprintf ("mv %s %s", exported_tmp,exported); | 132 mv_call = sprintf ("mv %s %s", exported_tmp,exported); |
133 system (mv_call); | 133 system (mv_call); |
134 rmdir (exported_tmp,"s"); | 134 rmdir (exported_tmp,"s"); |
135 clear exported_tmp | 135 clear exported_tmp |
136 endif | 136 endif |
137 | 137 |
138 % Run bootstrap if found | 138 % Run bootstrap if found |
139 if has_dir ("src", exported) | 139 if has_dir ("src", exported) |
140 ndir = fullfile (exported,"src"); | 140 ndir = fullfile (exported,"src"); |
141 if has_file ("bootstrap", ndir) | 141 if has_file ("bootstrap", ndir) |
142 odir = pwd (); | 142 odir = pwd (); |
143 cd (ndir); | 143 cd (ndir); |
144 | 144 |
145 failed = system ("./bootstrap"); | 145 failed = system ("./bootstrap"); |
146 if failed | 146 if failed |
147 cd (odir); | 147 cd (odir); |
148 error ("Could run bootstrap.\n"); | 148 error ("Could run bootstrap.\n"); |
149 end | 149 end |
150 | 150 |
151 [success, msg] = rmdir ("autom4te.cache", "s"); | 151 [success, msg] = rmdir ("autom4te.cache", "s"); |
152 if !success | 152 if !success |
153 error (msg); | 153 error (msg); |
154 endif | 154 endif |
155 cd (odir); | 155 cd (odir); |
156 endif | 156 endif |
157 endif | 157 endif |
158 | 158 |
159 % Remove devel, deprecated, .*ignore an others | 159 % Remove devel, deprecated, .*ignore an others |
160 to_erase = {"devel","deprecated",".svnignore",".hgignore",".hg_archival.txt"}; | 160 to_erase = {"devel","deprecated",".svnignore",".hgignore",".hg_archival.txt"}; |
161 for idir = 1:numel(to_erase) | 161 for idir = 1:numel(to_erase) |
162 | 162 |
163 if has_dir (to_erase{idir}, exported) | 163 if has_dir (to_erase{idir}, exported) |
167 endif | 167 endif |
168 elseif has_file (to_erase{idir}, exported) | 168 elseif has_file (to_erase{idir}, exported) |
169 delete (fullfile (exported, to_erase{idir})); | 169 delete (fullfile (exported, to_erase{idir})); |
170 endif | 170 endif |
171 endfor | 171 endfor |
172 | 172 |
173 % Get package version | 173 % Get package version |
174 desc_file = textread (fullfile (exported,"DESCRIPTION"),"%s"); | 174 desc_file = textread (fullfile (exported,"DESCRIPTION"),"%s"); |
175 [tf ind] = ismember ("Version:",desc_file); | 175 [tf ind] = ismember ("Version:",desc_file); |
176 pkgversion = desc_file{ind+1}; | 176 pkgversion = desc_file{ind+1}; |
177 | 177 |
185 printf ("Tared to %s\n", pkgtar); | 185 printf ("Tared to %s\n", pkgtar); |
186 fflush (stdout); | 186 fflush (stdout); |
187 | 187 |
188 % Remove exported package | 188 % Remove exported package |
189 rmdir (exported, "s"); | 189 rmdir (exported, "s"); |
190 | 190 |
191 do_doc = input ("\nCreate documentation for Octave-Forge? [y|Yes|Y] / [n|No|N] ","s"); | 191 do_doc = input ("\nCreate documentation for Octave-Forge? [y|Yes|Y] / [n|No|N] ","s"); |
192 do_doc = strcmpi (do_doc(1),'y'); | 192 do_doc = strcmpi (do_doc(1),'y'); |
193 | 193 |
194 if do_doc | 194 if do_doc |
195 % Install package | 195 % Install package |
256 end | 256 end |
257 | 257 |
258 endfunction | 258 endfunction |
259 | 259 |
260 function tf = has_dir (ddir, exported) | 260 function tf = has_dir (ddir, exported) |
261 | 261 |
262 s = dir (exported); | 262 s = dir (exported); |
263 tf = any (cellfun (@(x) strcmpi (x,ddir), {s([s.isdir]).name})); | 263 tf = any (cellfun (@(x) strcmpi (x,ddir), {s([s.isdir]).name})); |
264 | 264 |
265 endfunction | 265 endfunction |
266 | 266 |
267 function tf = has_file (dfile, ddir) | 267 function tf = has_file (dfile, ddir) |
268 | 268 |
269 s = dir (ddir); | 269 s = dir (ddir); |
270 tf = any (cellfun (@(x) strcmpi (x,dfile), {s(![s.isdir]).name})); | 270 tf = any (cellfun (@(x) strcmpi (x,dfile), {s(![s.isdir]).name})); |
271 | 271 |
272 endfunction | 272 endfunction |
273 |