Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 78 additions & 2 deletions scripts/setup_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ NO_DEBUGINFO_DOWNLOAD=0
# If this flag is enabled, then binary files are not downloaded.
NO_BINARY_DOWNLOAD=0

# If this flag is enabled, then -devel packages are not downloaded.
NO_DEVEL_DOWNLOAD=0

# If this flag is enabled, then extracted files are not cleaned.
NO_CLEANUP_EXTRACTED_FILES=0

Expand Down Expand Up @@ -157,7 +160,7 @@ set_url_platform()
# SLFO-1.1 for some weird reason has ':' appended to it in url. Hack it.
if [ $ver == "1.1" ]; then
URL="https://download.suse.de/download/ibs/SUSE:/SLFO:/$ver:/Build/standard"
elif [ $ver == "1.2" ]; then
else
URL="https://download.suse.de/download/ibs/SUSE:/SLFO:/$ver/standard"
fi
elif is_alp; then
Expand Down Expand Up @@ -410,6 +413,37 @@ get_list_of_binary_packages()
echo $bin_package_list
}

# Get list of devel packages.
get_list_of_devel_packages()
{
local packages="$*"
local devel_package_list=""

for package in $packages; do
local package_name=$(get_name_from_package_name $package)
local version=$(get_version_from_package_name $package)

# libopenssl1_1 binaries comes from openssl.
if [ "$package_name" = "libopenssl1_1" ]; then
package_name="libopenssl-1_1-devel"
fi

# libopenssl-3 binaries comes from openssl-3
if [ "$package_name" = "libopenssl3" -o "$package_name" = "libopenssl3-x86-64-v3" ]; then
package_name="libopenssl-3-devel"
fi

# glibc binaries comes from glibc-utils
if [ "$package_name" = "glibc" -o "$package_name" = "glibc-locale-base" -o "$package_name" = "glibc-gconv-modules-extra" ]; then
package_name="glibc-devel"
fi

devel_package_list="$devel_package_list $package_name-$version.$ARCH.rpm"
done

echo $devel_package_list
}

download_debuginfo_packages()
{
local packages=$(get_list_of_debuginfo_packages "$*")
Expand Down Expand Up @@ -449,6 +483,15 @@ download_binary_packages()
parallel_download_packages "$packages"
}

download_devel_packages()
{
local packages=$(get_list_of_devel_packages "$*")
local old_url=$URL

set_url_platform $PLATFORM $PRODUCT $ARCH "devel"
parallel_download_packages "$packages"
}

classify_rpm_task()
{
local rpm=$1
Expand Down Expand Up @@ -690,7 +733,7 @@ dump_interesting_info_from_elfs_in_lib()

sanitize_platform()
{
local platforms="SLE-15-SP3 SLE-15-SP4 SLE-15-SP5 SLE-15-SP6 SLE-15-SP7 ALP SLFO:1.1 SLFO:1.2"
local platforms="SLE-15-SP3 SLE-15-SP4 SLE-15-SP5 SLE-15-SP6 SLE-15-SP7 ALP SLFO:1.1 SLFO:1.2 SLFO:1.3"

for platform in ${platforms}; do
if [ "$PLATFORM" = "$platform" ]; then
Expand Down Expand Up @@ -756,6 +799,8 @@ print_help_message()
echo " --arch=ARCH System architecture (ex x86_64)"
echo " --no-src-download Do not download the src package."
echo " --no-ipa-clones-download Do not download the ipa-clones tarballs."
echo " --no-binary-download Do not download the binary packages."
echo " --no-devel-download Do not download the devel packages."
echo " --no-cleanup Do not cleanup downloaded .rpm files."
echo " --no-cleanup-extracted Do not cleanup extracted files."
echo " --no-information-extraction Do not extract and create .json files."
Expand All @@ -769,6 +814,29 @@ print_help_message()
echo "$SUPPORTED_PACKAGES."
}

check_required_programs()
{
local err=0

if ! repo2solv -h 2> /dev/null > /dev/null; then
echo "ERROR: repo2solv not found. Install libsolv-tools-base."
err=1
fi

if ! rpm2cpio --help 2> /dev/null > /dev/null; then
echo "ERROR: rpm2cpio not found. Install rpm."
err=1
fi

if ! rpm --help 2> /dev/null > /dev/null; then
echo "ERROR: rpm not found. Install rpm."
err=1
fi

if [ $err -eq 1 ]; then
exit 1
fi
}

parse_program_argv()
{
Expand Down Expand Up @@ -813,6 +881,10 @@ parse_program_argv()
NO_BINARY_DOWNLOAD=1
shift
;;
--no-devel-download)
NO_DEVEL_DOWNLOAD=1
shift
;;
--no-cleanup-extracted)
NO_CLEANUP_EXTRACTED_FILES=1
shift
Expand Down Expand Up @@ -926,6 +998,9 @@ main()
if [ $NO_BINARY_DOWNLOAD -eq 0 ]; then
download_binary_packages "$nevras"
fi
if [ $NO_DEVEL_DOWNLOAD -eq 0 ]; then
download_devel_packages "$nevras"
fi

all_names="$all_names $names"
all_nevras="$all_nevras $nevras"
Expand Down Expand Up @@ -960,4 +1035,5 @@ main()
echo "Done."
}

check_required_programs
main $*
Loading