blob: 0f7b256e79def74e6a4ac290a70cdad419b12dbe (
plain)
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
|
# file : tests/pkg-purge.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
.include common.test config.test
# Source repository:
#
# pkg-purge
# |-- libfoo-1.0.0.tar.gz
# `-- libfoo-1.1.0 ->
# |-- build
# | `-- bootstrap.build
# |-- buildfile
# `-- manifest
pkg_fetch += -d cfg 2>-
pkg_unpack += -d cfg 2>-
pkg_status += -d cfg
: no-name
:
$clone_cfg;
$* 2>>EOE != 0
error: package name argument expected
info: run 'bpkg help pkg-purge' for more information
EOE
: no-package
:
$clone_cfg;
$* libfoo 2>>/EOE != 0
error: package libfoo does not exist in configuration cfg/
EOE
: fetched
:
{
$clone_cfg && $pkg_fetch -e $src/libfoo-1.0.0.tar.gz;
$* libfoo 2>'purged libfoo/1.0.0';
$pkg_status libfoo 1>'unknown'
}
: keep
:
{
$clone_cfg && $pkg_fetch -e $src/libfoo-1.0.0.tar.gz;
$* -k libfoo 2>'keeping archive libfoo/1.0.0';
$pkg_status libfoo 1>'fetched 1.0.0';
$* libfoo 2>'purged libfoo/1.0.0'
}
: purge-archive
:
{
$clone_cfg;
cp $src/libfoo-1.0.0.tar.gz cfg/ &!cfg/libfoo-1.0.0.tar.gz;
$pkg_fetch -e -p cfg/libfoo-1.0.0.tar.gz;
$* libfoo 2>'purged libfoo/1.0.0';
$pkg_status libfoo 1>'unknown';
test -f cfg/libfoo-1.0.0.tar.gz == 1
}
: no-archive-keep
:
{
$clone_cfg && $pkg_unpack -e $src/libfoo-1.1.0;
$* --keep libfoo 2>>EOE != 0;
error: package libfoo has no archive to keep
EOE
$pkg_status libfoo 1>'unpacked 1.1.0';
$* libfoo 2>'purged libfoo/1.1.0'
}
: unpacked-dir
:
{
$clone_cfg && $pkg_unpack -e $src/libfoo-1.1.0;
$* libfoo 2>'purged libfoo/1.1.0';
$pkg_status libfoo 1>'unknown'
}
: unpacked-archive
:
{
$clone_cfg;
$pkg_fetch -e $src/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo;
$* libfoo 2>'purged libfoo/1.0.0';
$pkg_status libfoo 1>'unknown';
test -d cfg/libfoo-1.0.0 == 1
}
: keep-unpacked-archive
:
{
$clone_cfg;
$pkg_fetch -e $src/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo;
$* --keep libfoo 2>'keeping archive libfoo/1.0.0';
$pkg_status libfoo 1>'fetched 1.0.0';
test -d cfg/libfoo-1.0.0 == 1;
$* libfoo 2>'purged libfoo/1.0.0';
$pkg_status libfoo 1>'unknown'
}
: purge-dir
:
{
$clone_cfg;
# @@ Use --no-cleanup for cp builtin when implemented.
#
d = &!cfg/libfoo-1.1.0/;
c = $d/ $d/build/ $d/build/bootstrap.build $d/buildfile $d/manifest;
cp -r $src/libfoo-1.1.0 cfg/ $c;
$pkg_unpack -e -p cfg/libfoo-1.1.0;
$* libfoo 2>'purged libfoo/1.1.0';
$pkg_status libfoo 1>'unknown';
test -d cfg/libfoo-1.1.0 == 1
}
: purge-unpacked-archive
:
{
$clone_cfg;
cp $src/libfoo-1.0.0.tar.gz cfg/ &!cfg/libfoo-1.0.0.tar.gz;
$pkg_fetch -e -p cfg/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo;
$* libfoo 2>'purged libfoo/1.0.0';
$pkg_status libfoo 1>'unknown';
test -d cfg/libfoo-1.0.0 == 1;
test -f cfg/libfoo-1.0.0.tar.gz == 1
}
: broken
:
if ($cxx.target.class != 'windows')
{
$clone_cfg;
cp $src/libfoo-1.0.0.tar.gz cfg/ &!cfg/libfoo-1.0.0.tar.gz;
$pkg_fetch -e -p cfg/libfoo-1.0.0.tar.gz;
$pkg_unpack libfoo;
chmod 000 cfg/libfoo-1.0.0;
$* libfoo 2>>/~%EOE% != 0;
%error: unable to remove directory cfg/libfoo-1.0.0/.+%
info: package libfoo is now broken; use 'pkg-purge --force' to remove
EOE
$pkg_status libfoo/1.0.0 >'broken';
$* -f -k libfoo 2>'error: cannot keep broken package libfoo' != 0;
$pkg_status libfoo/1.0.0 >'broken';
$* -f libfoo 2>>/EOE != 0;
error: source directory of broken package libfoo still exists
info: remove cfg/libfoo-1.0.0/ manually then re-run pkg-purge
EOE
$pkg_status libfoo/1.0.0 >'broken';
chmod 755 cfg/libfoo-1.0.0;
rm -r cfg/libfoo-1.0.0;
$* -f libfoo 2>>/EOE != 0;
error: archive file of broken package libfoo still exists
info: remove cfg/libfoo-1.0.0.tar.gz manually then re-run pkg-purge
EOE
rm cfg/libfoo-1.0.0.tar.gz;
$* -f libfoo 2>'purged libfoo/1.0.0';
$pkg_status libfoo >'unknown'
}
|