annotate scripts/pkg/private/build.m @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 7854d5752dd2
children 6e91c61f626f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
3 ## Copyright (C) 2016-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
7 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
8 ## This file is part of Octave.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 21951
diff changeset
13 ## (at your option) any later version.
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
14 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 21951
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 21951
diff changeset
18 ## GNU General Public License for more details.
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
19 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
25
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
26 ## -*- texinfo -*-
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
27 ## @deftypefn {} {} build (@var{builddir}, @var{tarballs}, @var{verbose})
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
28 ## Prepare binary packages from Octave source packages.
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
29 ##
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
30 ## Boils down to (for each in @var{tarballs}):
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
31 ##
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
32 ## @enumerate
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
33 ## @item untar the tarball in @var{builddir};
21546
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 21518
diff changeset
34 ##
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
35 ## @item build anything necessary (configure and make);
21546
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 21518
diff changeset
36 ##
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
37 ## @item repackage specifying the build arch in the tarball filename.
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
38 ## @end enumerate
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
39 ##
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
40 ## @end deftypefn
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
41
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
42 function build (builddir, tarballs, verbose)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21546
diff changeset
43
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
44 if (nargin != 3)
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
45 print_usage ();
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
46 endif
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
47
25787
3293cd2651fb prefer 'isfolder' over 'exist (..., "dir")' in Octave functions
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
48 if (! isfolder (builddir))
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
49 warning ("creating build directory %s", builddir);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
50 [status, msg] = mkdir (builddir);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
51 if (status != 1)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
52 error ("could not create installation directory: %s", msg);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
53 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
54 endif
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
55
25885
75ed70a1c108 Overhaul unpack and associated functions (bug #54567).
Rik <rik@octave.org>
parents: 25787
diff changeset
56 for i = 1:numel (tarballs)
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
57 filelist = unpack (tarballs{i}, builddir);
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
58
21951
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
59 ## We want the path for the package root but we can't assume that
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
60 ## exists in the filelist (see patch #9030). So we deduce it from
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
61 ## the path of the DESCRIPTION file (smallest in case there's another
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
62 ## file named DESCRIPTION somewhere).
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
63 desc_pos = regexp (filelist, "DESCRIPTION$");
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
64 desc_mask = ! cellfun ("isempty", desc_pos);
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
65 [~, desc_r_idx] = min ([desc_pos{desc_mask}]);
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
66 desc_path = fullfile (builddir, filelist(desc_mask){desc_r_idx});
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
67 build_root = desc_path(1:end-12); # do not include the last filesep
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
68
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
69 desc = get_description (desc_path);
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
70
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
71 ## If there is no configure or Makefile within src/, there is nothing
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
72 ## to do to prepare a "binary" package. We only repackage to add more
21951
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
73 ## info to the tarball filename (version and arch).
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
74 if (! exist (fullfile (build_root, "src", "configure"), "file")
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
75 && ! exist (fullfile (build_root, "src", "Makefile"), "file"))
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
76 arch_abi = "any-none";
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
77 else
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
78 arch_abi = getarch ();
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
79 configure_make (desc, build_root, verbose);
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
80 unlink (fullfile (build_root, "src", "configure"));
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
81 unlink (fullfile (build_root, "src", "Makefile"));
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
82 endif
21951
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
83 tar_name = [desc.name "-" desc.version "-" arch_abi ".tar"];
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
84 tar_path = fullfile (builddir, tar_name);
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
85
21951
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
86 ## Figure out the directory name of the build. Note that fileparts
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
87 ## gets confused with the version string (the periods makes it think
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
88 ## it's a file extension).
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
89 [~, package_root, package_ext] = fileparts (build_root);
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
90 package_root = [package_root, package_ext];
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
91
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
92 tar (tar_path, package_root, builddir);
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
93 gzip (tar_path, builddir);
28877
cd2178d0e43b pkg.m,build.m: capture output of rmdir() so that error is not thrown.
Rik <rik@octave.org>
parents: 28503
diff changeset
94 [~] = rmdir (build_root, "s");
21951
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
95
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
96 ## Currently does nothing because gzip() removes the original tar
f0303b64e59a pkg build: do not assume entry for root directory after untar (bug #48096)
Carnë Draug <carandraug@octave.org>
parents: 21758
diff changeset
97 ## file but that should change in the future (bug #43431).
28503
f480103d8333 Fix unlink() calls in package m-files for new syntax (bug #57830)
Rik <rik@octave.org>
parents: 27923
diff changeset
98 [~] = unlink (tar_path);
21518
2ee20a290d61 pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
99 endfor
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21546
diff changeset
100
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
101 endfunction