Skip to content

Commit bf361c9

Browse files
committed
Refactory repos/containers handling in copy_sources
1 parent 3c32727 commit bf361c9

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

build

+20-6
Original file line numberDiff line numberDiff line change
@@ -842,20 +842,20 @@ copy_oldpackages() {
842842
}
843843

844844
copy_sources() {
845-
local include_directories
846-
if test -n "$RUNNING_IN_VM" -o "$BUILDTYPE" = kiwi -o "$BUILDTYPE" = docker -o "$BUILDTYPE" = fissile -o "$BUILDTYPE" = podman -o "$BUILDTYPE" = productcompose ; then
847-
include_directories=true
845+
local image_mode i
846+
if test "$BUILDTYPE" = kiwi -o "$BUILDTYPE" = docker -o "$BUILDTYPE" = fissile -o "$BUILDTYPE" = podman -o "$BUILDTYPE" = productcompose ; then
847+
image_mode=true
848848
fi
849849
if test -n "$RUNNING_IN_VM" -o -n "$COPY_SOURCES_ASIS" -o -n "$RPM_BUILD_IN_PLACE" ; then
850+
image_mode=
850851
( shopt -s nullglob ; cp -pRd "$1/".[^.]* "$1/"..?* "$1"/* "$2" )
851-
elif test -n "$include_directories" ; then
852-
cp -pRL "$1"/* "$2"
853852
elif test -e "$1/.git" ; then
854853
# check which directory belongs to the git repository and only copy those
855854
type -p git >& /dev/null || cleanup_and_exit 1 "need git to check file status"
856855
for i in "$1/".* "$1"/* ; do
857856
local ii="${i##*/}"
858857
test "$ii" = . -o "$ii" = .. -o "$ii" = .git && continue
858+
test -n "$image_mode" -a \( "$ii" = repos -o "$ii" = containers \) && continue
859859
if test -L "$i" -o -d "$i" -o "${ii#.}" != "$ii" ; then
860860
if test -e "$i/.build.asset" || git -C "$1" --noglob-pathspecs -c safe.directory="$ii" ls-files --error-unmatch -- "$ii" >& /dev/null ; then
861861
cp -pRd "$i" "$2"
@@ -871,7 +871,21 @@ copy_sources() {
871871
$BUILD_DIR/export_debian_orig_from_git "$1" "$2/build.origtar" || cleanup_and_exit 1 "export_debian_orig_from_git failed"
872872
fi
873873
else
874-
cp -p "$1"/* "$2"
874+
if test -n "$image_mode" ; then
875+
for i in "$1"/* ; do
876+
local ii="${i##*/}"
877+
test -n "$image_mode" -a \( "$ii" = repos -o "$ii" = containers \) && continue
878+
cp -p "$i" "$2"
879+
done
880+
else
881+
cp -p "$1"/* "$2"
882+
fi
883+
fi
884+
if test -n "$image_mode" ; then
885+
rm -rf "$2/repos" "$2/containers"
886+
for i in "$1/repos" "$1/containers" ; do
887+
test -d "$i" && cp -pRL "$i" "$2"
888+
done
875889
fi
876890
test -n "$RPM_BUILD_IN_PLACE" -a -z "$RUNNING_IN_VM" && cp -f "$RECIPEPATH" "$2"
877891
}

0 commit comments

Comments
 (0)