Skip to content

Commit

Permalink
origin.spec OKD RPM build readiness
Browse files Browse the repository at this point in the history
- Prepared the specfile for builds of OKD packages
- Removed mentions of Tito
  • Loading branch information
LorbusChris committed Sep 26, 2019
1 parent b05811e commit b10d4b4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 deletions.
27 changes: 15 additions & 12 deletions hack/build-rpms.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# This script generates release zips and RPMs into _output/releases.
# tito and other build dependencies are required on the host. We will
# be running `hack/build-cross.sh` under the covers, so we transitively
# consume all of the relevant envars.
# All build dependencies are required on the host.
# We will be running `hack/build-cross.sh` under the covers,
# so we transitively consume all of the relevant envars.
source "$(dirname "${BASH_SOURCE}")/lib/init.sh"

function cleanup() {
Expand All @@ -22,7 +22,7 @@ os::build::setup_env

if [[ "${OS_ONLY_BUILD_PLATFORMS:-}" == 'linux/amd64' ]]; then
# when the user is asking for only Linux binaries, we will
# furthermore not build cross-platform clients in tito
# furthermore not build cross-platform clients
make_redistributable=0
else
make_redistributable=1
Expand Down Expand Up @@ -58,12 +58,13 @@ if [[ -n "${dirty}" && "${OS_GIT_TREE_STATE}" == "dirty" ]]; then
--define "_sourcedir ${rpm_tmp_dir}/SOURCES" \
--define "_builddir ${rpm_tmp_dir}/BUILD" \
--define "skip_prep 1" \
--define "skip_dist 1" \
--define "skip_dist ${SKIP_DIST:-1}" \
--define "make_redistributable ${make_redistributable}" \
--define "version ${OS_RPM_VERSION}" --define "release ${OS_RPM_RELEASE}" \
--define "version ${OS_RPM_VERSION}" \
--define "release ${OS_RPM_RELEASE}" \
--define "commit ${OS_GIT_COMMIT}" \
--define "os_git_vars ${OS_RPM_GIT_VARS}" \
--define 'dist .el7' --define "_topdir ${rpm_tmp_dir}"
--define "_topdir ${rpm_tmp_dir}"

mkdir -p "${OS_OUTPUT_RPMPATH}"
mv -f "${rpm_tmp_dir}"/RPMS/*/*.rpm "${OS_OUTPUT_RPMPATH}"
Expand All @@ -72,16 +73,18 @@ else
mkdir -p "${rpm_tmp_dir}/SOURCES"
tar czf "${rpm_tmp_dir}/SOURCES/${OS_RPM_NAME}-${OS_RPM_VERSION}.tar.gz" \
--owner=0 --group=0 \
--exclude=_output --exclude=.git --transform "s|^|${OS_RPM_NAME}-${OS_RPM_VERSION}/|rSH" \
--exclude=_output --exclude=.git \
--transform "s|^|${OS_RPM_NAME}-${OS_RPM_VERSION}/|rSH" \
.

rpmbuild -b${srpm} "${OS_RPM_SPECFILE}" \
--define "skip_dist 1" \
--define "skip_dist ${SKIP_DIST:-1}" \
--define "make_redistributable ${make_redistributable}" \
--define "version ${OS_RPM_VERSION}" --define "release ${OS_RPM_RELEASE}" \
--define "version ${OS_RPM_VERSION}" \
--define "release ${OS_RPM_RELEASE}" \
--define "commit ${OS_GIT_COMMIT}" \
--define "os_git_vars ${OS_RPM_GIT_VARS}" \
--define 'dist .el7' --define "_topdir ${rpm_tmp_dir}"
--define "_topdir ${rpm_tmp_dir}"

output_directory="$( find "${rpm_tmp_dir}" -type d -path "*/BUILD/${OS_RPM_NAME}-${OS_RPM_VERSION}/_output/local" )"
if [[ -z "${output_directory}" ]]; then
Expand All @@ -97,7 +100,7 @@ else
# an NFS volume exported with root_squash set. This can occur when running this
# script on a Vagrant box. The error shown is "mv: failed to preserve ownership
# for $FILE: Operation not permitted". As a workaround, if
# ${tito_output_directory} and ${OS_OUTPUT} are on different devices, use cp and
# ${output_directory} and ${OS_OUTPUT} are on different devices, use cp and
# rm instead.
if [[ $(stat -c %d "${output_directory}") == $(stat -c %d "${OS_OUTPUT}") ]]; then
mv "${output_directory}"/* "${OS_OUTPUT}"
Expand Down
26 changes: 9 additions & 17 deletions origin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
%global import_path github.com/openshift/origin

%global golang_version 1.12
# %commit and %os_git_vars are intended to be set by tito custom builders provided
# in the .tito/lib directory. The values in this spec file will not be kept up to date.
# commit and os_git_vars are intended to be set by the build system.
# NOTE: The values in this spec file will not be kept up to date.
%{!?commit:
%global commit 86b5e46426ba828f49195af21c56f7c6674b48f7
}
Expand Down Expand Up @@ -46,18 +46,10 @@
%endif
%{!?make_redistributable: %global make_redistributable %{need_redistributable_set}}

%if "%{dist}" == ".el7aos"
%global package_name openshift
%global product_name OpenShift
%else
%global package_name openshift
%global product_name OpenShift
%endif

%{!?version: %global version 0.0.1}
%{!?version: %global version 4.0.0}
%{!?release: %global release 1}

Name: %{package_name}
Name: openshift
Version: %{version}
Release: %{release}%{package_dist}
Summary: Open Source Container Management by Red Hat
Expand All @@ -78,7 +70,7 @@ BuildRequires: golang >= %{golang_version}
BuildRequires: krb5-devel
BuildRequires: rsync

#
# TODO: Add alternative to tito here to gather and inject Bundled Provides into specfile.
# The following Bundled Provides entries are populated automatically by the
# OpenShift tito custom builder found here:
# https://github.com/openshift/origin/blob/master/.tito/lib/origin/builder/
Expand All @@ -98,13 +90,13 @@ Kubernetes allowing you to safely host many different applications and workloads
on a unified cluster.

%package hyperkube
Summary: %{product_name} Kubernetes server commands
Summary: OpenShift Kubernetes server commands
Requires: util-linux
Requires: socat
Requires: iptables
Provides: hyperkube
Provides: atomic-openshift-hyperkube
Provides: atomic-openshift-node
Provides: hyperkube = %{version}
Obsoletes: atomic-openshift-hyperkube <= %{version}
Obsoletes: atomic-openshift-node <= %{version}

%description hyperkube
%{summary}
Expand Down

0 comments on commit b10d4b4

Please sign in to comment.