File tree Expand file tree Collapse file tree 4 files changed +46
-7
lines changed Expand file tree Collapse file tree 4 files changed +46
-7
lines changed Original file line number Diff line number Diff line change @@ -864,12 +864,29 @@ def packages(self) -> str:
864
864
:command:`zypper in`.
865
865
866
866
"""
867
+ packages_to_install : list [str ] = []
867
868
for pkg in self .package_list :
868
- if isinstance (pkg , Package ) and pkg .pkg_type != PackageType .IMAGE :
869
+ if isinstance (pkg , Package ) and pkg .pkg_type not in (
870
+ PackageType .IMAGE ,
871
+ PackageType .DELETE ,
872
+ ):
869
873
raise ValueError (
870
874
f"Cannot add a package of type { pkg .pkg_type } into a Dockerfile based build."
871
875
)
872
- return " " .join (str (pkg ) for pkg in self .package_list )
876
+ if isinstance (pkg , Package ) and pkg .pkg_type == PackageType .DELETE :
877
+ continue
878
+ packages_to_install .append (str (pkg ))
879
+ return " " .join (packages_to_install )
880
+
881
+ @property
882
+ def packages_to_delete (self ) -> str :
883
+ """The list of packages joined that can be passed to zypper -n rm after an install`."""
884
+ packages_to_delete : list [str ] = [
885
+ str (pkg )
886
+ for pkg in self .package_list
887
+ if (isinstance (pkg , Package ) and pkg .pkg_type == PackageType .DELETE )
888
+ ]
889
+ return " " .join (packages_to_delete )
873
890
874
891
@overload
875
892
def _kiwi_volumes_expose (
Original file line number Diff line number Diff line change 6
6
from bci_build .package import DOCKERFILE_RUN
7
7
from bci_build .package import OsContainer
8
8
from bci_build .package import OsVersion
9
+ from bci_build .package import Package
10
+ from bci_build .package import PackageType
9
11
from bci_build .package import Replacement
10
12
from bci_build .package import _build_tag_prefix
11
13
@@ -82,6 +84,7 @@ def _get_sac_supported_until(
82
84
"curl" ,
83
85
# currently needed by custom_end
84
86
"sed" ,
87
+ Package ("util-linux" , PackageType .DELETE ),
85
88
]
86
89
+ [f"java-{ jre_version } -openjdk" , f"java-{ jre_version } -openjdk-headless" ],
87
90
replacements_via_service = [
Original file line number Diff line number Diff line change 43
43
COPY --from=target / /target
44
44
{%- endif %}
45
45
46
- {% if image.packages %}{{ DOCKERFILE_RUN }} zypper{% if image.from_target_image %} --installroot /target --gpg-auto-import-keys {% endif %} -n in {% if image.no_recommends %}--no-recommends {% endif %}{{ image.packages }}; zypper -n clean; {{ LOG_CLEAN }}{% endif %}
46
+ {% if image.packages %}{{ DOCKERFILE_RUN }} \\
47
+ zypper -n {%- if image.from_target_image %} --installroot /target --gpg-auto-import-keys {%- endif %} install {% if image.no_recommends %}--no-recommends {% endif %}{{ image.packages }}; \\
48
+ {%- if image.packages_to_delete %}
49
+ zypper -n {%- if image.from_target_image %} --installroot /target {%- endif %} remove {{ image.packages_to_delete }}; \\
50
+ {%- endif %}
51
+ zypper -n clean; \\
52
+ {{ LOG_CLEAN }}
53
+ {%- endif %}
47
54
{% if image.from_target_image %}FROM {{ image.dockerfile_from_target_ref }}
48
55
COPY --from=builder /target /{% endif %}
49
56
# Define labels according to https://en.opensuse.org/Building_derived_containers
Original file line number Diff line number Diff line change 30
30
#!BuildVersion: 15.6.27
31
31
FROM bci/bci-base:15.6
32
32
33
- RUN zypper -n in --no-recommends gcc emacs; zypper -n clean; ##LOGCLEAN##
33
+ RUN \\
34
+ zypper -n install --no-recommends gcc emacs; \\
35
+ zypper -n clean; \\
36
+ ##LOGCLEAN##
34
37
35
38
# Define labels according to https://en.opensuse.org/Building_derived_containers
36
39
# labelprefix=com.suse.bci.test
140
143
#!BuildVersion: 15.5
141
144
FROM bci/bci-base:15.5
142
145
143
- RUN zypper -n in --no-recommends gcc emacs; zypper -n clean; ##LOGCLEAN##
146
+ RUN \\
147
+ zypper -n install --no-recommends gcc emacs; \\
148
+ zypper -n clean; \\
149
+ ##LOGCLEAN##
144
150
145
151
# Define labels according to https://en.opensuse.org/Building_derived_containers
146
152
# labelprefix=com.suse.bci.test
241
247
#!BuildVersion: 15.6.29
242
248
FROM bci/bci-base:15.6
243
249
244
- RUN zypper -n in --no-recommends gcc emacs; zypper -n clean; ##LOGCLEAN##
250
+ RUN \\
251
+ zypper -n install --no-recommends gcc emacs; \\
252
+ zypper -n clean; \\
253
+ ##LOGCLEAN##
245
254
246
255
# Define labels according to https://en.opensuse.org/Building_derived_containers
247
256
# labelprefix=com.suse.bci.test
348
357
349
358
FROM suse/base:18
350
359
351
- RUN zypper -n in --no-recommends gcc emacs; zypper -n clean; ##LOGCLEAN##
360
+ RUN \\
361
+ zypper -n install --no-recommends gcc emacs; \\
362
+ zypper -n clean; \\
363
+ ##LOGCLEAN##
352
364
353
365
# Define labels according to https://en.opensuse.org/Building_derived_containers
354
366
# labelprefix=org.opensuse.bci.test
You can’t perform that action at this time.
0 commit comments