-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpacman.patch
230 lines (204 loc) · 7.5 KB
/
pacman.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
commit 3b868914d0475a742bdef2995e6f437b8b8dde67
Author: Kyle Ladd <[email protected]>
Date: Thu Aug 11 07:17:04 2022 -0400
mac.patch
diff --git a/meson.build b/meson.build
index 76b9d2aa..e85908ea 100644
--- a/meson.build
+++ b/meson.build
@@ -125,7 +125,6 @@ foreach header : [
'sys/mnttab.h',
'sys/mount.h',
'sys/param.h',
- 'sys/statvfs.h',
'sys/types.h',
'sys/ucred.h',
'termios.h',
@@ -152,7 +151,6 @@ endforeach
foreach member : [
['struct stat', 'st_blksize', '''#include <sys/stat.h>'''],
- ['struct statvfs', 'f_flag', '''#include <sys/statvfs.h>'''],
['struct statfs', 'f_flags', '''#include <sys/param.h>
#include <sys/mount.h>'''],
]
diff --git a/scripts/libmakepkg/executable/checksum.sh.in b/scripts/libmakepkg/executable/checksum.sh.in
index 7cecafca..37df427a 100644
--- a/scripts/libmakepkg/executable/checksum.sh.in
+++ b/scripts/libmakepkg/executable/checksum.sh.in
@@ -24,6 +24,7 @@ LIBMAKEPKG_EXECUTABLE_CHECKSUM_SH=1
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
+source "$LIBRARY/util/mac.sh"
executable_functions+=('executable_checksum')
diff --git a/scripts/libmakepkg/executable/fakeroot.sh.in b/scripts/libmakepkg/executable/fakeroot.sh.in
index 61329fe8..0183e229 100644
--- a/scripts/libmakepkg/executable/fakeroot.sh.in
+++ b/scripts/libmakepkg/executable/fakeroot.sh.in
@@ -28,10 +28,5 @@ source "$LIBRARY/util/message.sh"
executable_functions+=('executable_fakeroot')
executable_fakeroot() {
- if (( SOURCEONLY || BUILDPKG )); then
- if ! type -p fakeroot >/dev/null; then
- error "$(gettext "Cannot find the %s binary.")" "fakeroot"
- return 1
- fi
- fi
+ return 0
}
diff --git a/scripts/libmakepkg/integrity/verify_checksum.sh.in b/scripts/libmakepkg/integrity/verify_checksum.sh.in
index 22b82d0b..92bee01e 100644
--- a/scripts/libmakepkg/integrity/verify_checksum.sh.in
+++ b/scripts/libmakepkg/integrity/verify_checksum.sh.in
@@ -26,6 +26,7 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
source "$LIBRARY/util/pkgbuild.sh"
source "$LIBRARY/util/schema.sh"
+source "$LIBRARY/util/mac.sh"
check_checksums() {
local integ a
diff --git a/scripts/libmakepkg/lint_config/source_date_epoch.sh.in b/scripts/libmakepkg/lint_config/source_date_epoch.sh.in
index e5031fc7..efe50812 100755
--- a/scripts/libmakepkg/lint_config/source_date_epoch.sh.in
+++ b/scripts/libmakepkg/lint_config/source_date_epoch.sh.in
@@ -29,9 +29,9 @@ lint_config_functions+=('lint_source_date_epoch')
lint_source_date_epoch() {
- if [[ $SOURCE_DATE_EPOCH = *[^[:digit:]]* ]]; then
+ if [[ $SOURCE_DATE_EPOCH = *[^[:digit:]\-T:]* ]]; then
error "$(gettext "%s contains invalid characters: %s")" \
- "\$SOURCE_DATE_EPOCH" "${SOURCE_DATE_EPOCH//[[:digit:]]}"
+ "\$SOURCE_DATE_EPOCH" "${SOURCE_DATE_EPOCH//[[:digit:]\-T:]}"
return 1
fi
}
diff --git a/scripts/libmakepkg/util/mac.sh.in b/scripts/libmakepkg/util/mac.sh.in
new file mode 100644
index 00000000..58a3b6ea
--- /dev/null
+++ b/scripts/libmakepkg/util/mac.sh.in
@@ -0,0 +1,3 @@
+function sha256sum() {
+ shasum -a 256 $1
+}
diff --git a/scripts/libmakepkg/util/meson.build b/scripts/libmakepkg/util/meson.build
index a160fd06..2a919088 100644
--- a/scripts/libmakepkg/util/meson.build
+++ b/scripts/libmakepkg/util/meson.build
@@ -5,6 +5,7 @@ sources = [
'config.sh.in',
'dirsize.sh.in',
'error.sh.in',
+ 'mac.sh.in',
'message.sh.in',
'option.sh.in',
'parseopts.sh.in',
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e58edfa1..85437007 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -83,7 +83,7 @@ VERIFYSOURCE=0
if [[ -n $SOURCE_DATE_EPOCH ]]; then
REPRODUCIBLE=1
else
- SOURCE_DATE_EPOCH=$(date +%s)
+ SOURCE_DATE_EPOCH=$(date -u +'%FT%T')
fi
export SOURCE_DATE_EPOCH
@@ -180,8 +180,8 @@ clean_up() {
}
enter_fakeroot() {
- msg "$(gettext "Entering %s environment...")" "fakeroot"
- fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
+ msg "$(gettext "Entering %s environment...")" "bash"
+ bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
}
# Automatically update pkgver variable if a pkgver() function is provided
@@ -597,7 +597,6 @@ write_pkginfo() {
merge_arch_attrs
printf "# Generated by makepkg %s\n" "$makepkg_version"
- printf "# using %s\n" "$(fakeroot -v)"
write_kv_pair "pkgname" "$pkgname"
write_kv_pair "pkgbase" "$pkgbase"
@@ -719,13 +718,13 @@ create_package() {
[[ -f $pkg_file.sig ]] && rm -f "$pkg_file.sig"
# ensure all elements of the package have the same mtime
- find . -exec touch -h -d @$SOURCE_DATE_EPOCH {} +
+ find . -exec touch -h -d $SOURCE_DATE_EPOCH {} +
msg2 "$(gettext "Generating .MTREE file...")"
list_package_files | LANG=C bsdtar -cnf - --format=mtree \
--options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \
--null --files-from - --exclude .MTREE | gzip -c -f -n > .MTREE
- touch -d @$SOURCE_DATE_EPOCH .MTREE
+ touch -d $SOURCE_DATE_EPOCH .MTREE
msg2 "$(gettext "Compressing package...")"
# TODO: Maybe this can be set globally for robustness
@@ -1186,17 +1185,10 @@ if (( LOGGING )) && ! ensure_writable_dir "LOGDEST" "$LOGDEST"; then
exit $E_FS_PERMISSIONS
fi
-if (( ! INFAKEROOT )); then
- if (( EUID == 0 )); then
- error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
+if (( EUID == 0 )); then
+ error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
catastrophic damage to your system.")" "makepkg"
- exit $E_ROOT
- fi
-else
- if [[ -z $FAKEROOTKEY ]]; then
- error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg"
- exit $E_INVALID_OPTION
- fi
+ exit $E_ROOT
fi
unset pkgname "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}"
@@ -1435,7 +1427,7 @@ if (( !REPKG )); then
if (( REPRODUCIBLE )); then
# We have activated reproducible builds, so unify source times before
# building
- find "$srcdir" -exec touch -h -d @$SOURCE_DATE_EPOCH {} +
+ find "$srcdir" -exec touch -h -d $SOURCE_DATE_EPOCH {} +
fi
fi
@@ -1456,7 +1448,6 @@ else
rm -rf "$pkgdirbase"
fi
mkdir -p "$pkgdirbase"
- chmod a-srw "$pkgdirbase"
cd_safe "$startdir"
prepare_buildenv
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index d3938396..a8683be7 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -278,9 +278,9 @@ db_write_entry() {
# compute checksums
msg2 "$(gettext "Computing checksums...")"
- md5sum=$(md5sum "$pkgfile")
+ md5sum=$(md5 -r "$pkgfile")
md5sum=${md5sum%% *}
- sha256sum=$(sha256sum "$pkgfile")
+ sha256sum=$(shasum -a 256 "$pkgfile")
sha256sum=${sha256sum%% *}
# remove an existing entry if it exists, ignore failures
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index e398855a..45cf0341 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1086,7 +1086,6 @@ static void cl_to_log(int argc, char *argv[])
int main(int argc, char *argv[])
{
int ret = 0;
- uid_t myuid = getuid();
console_cursor_hide();
install_segv_handler();
@@ -1130,12 +1129,6 @@ int main(int argc, char *argv[])
cleanup(ret);
}
- /* check if we have sufficient permission for the requested operation */
- if(myuid > 0 && needs_root()) {
- pm_printf(ALPM_LOG_ERROR, _("you cannot perform this operation unless you are root.\n"));
- cleanup(EXIT_FAILURE);
- }
-
/* we support reading targets from stdin if a cmdline parameter is '-' */
if(alpm_list_find_str(pm_targets, "-")) {
if(!isatty(fileno(stdin))) {