44
55(require 'package-build nil t )
66
7- (defun package-build--create-tar (name version directory mtime )
8- " Create a tar file containing the contents of VERSION of package NAME .
7+ (defun package-build--create-tar (rcp directory )
8+ " Create a tar file containing the package version specified by RCP .
99DIRECTORY is a temporary directory that contains the directory
10- that is put in the tarball. MTIME is used as the modification
11- time of all files, making the tarball reproducible."
12- (let ((tar (expand-file-name (concat name " -" version " .tar" )
13- package-build-archive-dir))
14- (dir (concat name " -" version)))
10+ that is put in the tarball."
11+ (let* ((name (oref rcp name))
12+ (version (oref rcp version))
13+ (time (oref rcp time))
14+ (tar (expand-file-name (concat name " -" version " .tar" )
15+ package-build-archive-dir))
16+ (dir (concat name " -" version)))
1517 ; ; XXX: https://github.com/melpa/package-build/pull/34
1618 ; ;
1719 ; ; We definitely need to remove these two lines, or else it won't able to
@@ -29,7 +31,7 @@ time of all files, making the tarball reproducible."
2931 ; ; prevent a reproducable tarball as described at
3032 ; ; https://reproducible-builds.org/docs/archives.
3133 " --sort=name"
32- (format " --mtime=@%d " mtime )
34+ (format " --mtime=@%d " time )
3335 " --owner=0" " --group=0" " --numeric-owner"
3436 " --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime" ))
3537 (when (and package-build-verbose noninteractive)
@@ -40,7 +42,7 @@ time of all files, making the tarball reproducible."
4042 (message " %s " line)))))
4143
4244; ;
43- ; ; NOTE: Following code are brought in cuz it's very useful, but we don't want
45+ ; ; NOTE: Following code are brought in cuz it's very useful, but we don't want
4446; ; to bring the whole `package-build' package unless it's needed.
4547; ;
4648
@@ -55,42 +57,49 @@ time of all files, making the tarball reproducible."
5557 " lisp/test.el" " lisp/tests.el" " lisp/*-test.el" " lisp/*-tests.el" ))
5658 " Default value for :files attribute in recipes." )
5759
58- (defun package-build-expand-file-specs (dir specs &optional subdir allow-empty )
59- " In DIR, expand SPECS, optionally under SUBDIR.
60- The result is a list of (SOURCE . DEST), where SOURCE is a source
61- file path and DEST is the relative path to which it should be copied.
60+ (defun package-build-expand-files-spec (rcp &optional assert repo spec )
61+ " No documentation."
62+ (let ((default-directory (or repo (package-recipe--working-tree rcp)))
63+ (spec (or spec (oref rcp files ))))
64+ (when (eq (car spec) :defaults )
65+ (setq spec (append package-build-default-files-spec (cdr spec))))
66+ (let ((files (package-build--expand-files-spec-1
67+ (or spec package-build-default-files-spec))))
68+ (when assert
69+ (when (and rcp spec
70+ (equal files (package-build--expand-files-spec-1
71+ package-build-default-files-spec)))
72+ (message " Warning: %s :files spec is equivalent to the default "
73+ (oref rcp name)))
74+ (unless files
75+ (error " No matching file(s) found in %s using %s "
76+ default-directory (or spec " default spec" ))))
77+ files )))
6278
63- If the resulting list is empty, an error will be reported. Pass t
64- for ALLOW-EMPTY to prevent this error."
65- (let ((default-directory dir)
66- (prefix (if subdir (format " %s /" subdir) " " ))
67- (lst))
68- (dolist (entry specs)
69- (setq lst
70- (if (consp entry)
71- (if (eq :exclude (car entry))
72- (cl-nset-difference lst
73- (package-build-expand-file-specs
74- dir (cdr entry) nil t )
75- :key #'car
76- :test #'equal )
77- (nconc lst
78- (package-build-expand-file-specs
79- dir
80- (cdr entry)
81- (concat prefix (car entry))
82- t )))
83- (nconc
84- lst (mapcar (lambda (f )
85- (cons f
86- (concat prefix
87- (replace-regexp-in-string
88- " \\ .el\\ .in\\ '"
89- " .el"
90- (file-name-nondirectory f)))))
91- (file-expand-wildcards entry))))))
92- (when (and (null lst) (not allow-empty))
93- (error " No matching file(s) found in %s : %s " dir specs))
94- lst))
79+ (defun package-build--expand-files-spec-1 (spec &optional subdir )
80+ (let ((files nil ))
81+ (dolist (entry spec)
82+ (setq files
83+ (cond
84+ ((stringp entry)
85+ (nconc files
86+ (mapcar (lambda (f )
87+ (cons f
88+ (concat subdir
89+ (replace-regexp-in-string
90+ " \\ .el\\ .in\\ '" " .el"
91+ (file-name-nondirectory f)))))
92+ (file-expand-wildcards entry))))
93+ ((eq (car entry) :exclude )
94+ (cl-nset-difference
95+ files
96+ (package-build--expand-files-spec-1 (cdr entry))
97+ :key #'car :test #'equal ))
98+ (t
99+ (nconc files
100+ (package-build--expand-files-spec-1
101+ (cdr entry)
102+ (concat subdir (car entry) " /" )))))))
103+ files ))
95104
96105; ;; extern/package-build.el ends here
0 commit comments