Added priorities for centos extra repos

We need to be able to download packages from
various repositories taking into account repository
priority. We need this for patching story.

By default priorities are
1) upstream 90
2) proprietary 20
3) DENY_RPM_DOWNGRADE=1 (default: 1), we are
   not allowed to downgrade rpm packages. In some
   cases when we need to be able to use downgraded
   versions this flag should be set to 0:
      DENY_RPM_DOWNGRADE=0

EXTRA_RPM_REPOS is to have the following format
    "name1,url1,pri1 name2,url2,pri2"

In case when pri is not defined it will be set to 10,
for example:
    "name1,url1" is equal to "name1,url1,10"

Closes-Bug: #1446293
Change-Id: I4a26dd005852af60104c39e46384a21c39cce587
This commit is contained in:
Vladimir Kuklin 2015-06-23 17:21:10 +03:00 committed by Sergey Kulanov
parent 3b866d2ff3
commit 32f40f23a6
3 changed files with 35 additions and 18 deletions

View File

@ -86,6 +86,10 @@ SEPARATE_IMAGES?=/boot,ext2 /,ext4
# Rebuld packages locally (do not use upstream versions)
BUILD_PACKAGES?=1
# by default we are not allowed to downgrade rpm packages,
# setting this flag to 0 will cause to use repo priorities only (!)
DENY_RPM_DOWNGRADE?=1
# Build OpenStack packages from external sources (do not use prepackaged versions)
# Enter the comma-separated list of OpenStack packages to build, or '0' otherwise.
# Example: BUILD_OPENSTACK_PACKAGES=neutron,keystone
@ -261,7 +265,7 @@ YUM_REPOS?=official fuel subscr_manager
# Additional CentOS repos.
# Each repo must be comma separated tuple with repo-name and repo-path.
# Repos must be separated by space.
# Example: EXTRA_RPM_REPOS="lolo,http://my.cool.repo/rpm bar,ftp://repo.foo"
# Example: EXTRA_RPM_REPOS="lolo,http://my.cool.repo/rpm,priority bar,ftp://repo.foo,priority"
EXTRA_RPM_REPOS?=
# Comma or space separated list. Available feature groups:

View File

@ -13,9 +13,15 @@ $(BUILD_DIR)/mirror/centos/etc/yum-plugins/priorities.py: \
mkdir -p $(@D)
cp $(SOURCE_DIR)/mirror/centos/yum-priorities-plugin.py $@
# DENY_RPM_DOWNGRADE=0 - Disable full_match flag for yum priorities plugin.
# This means that we choose package candidate not by full match
# of version, realase and arch. This may lead to downgrading of
# packages (actually this is what we may want sometimes for
# testing purposes). Please use priorities plugin carefully
$(BUILD_DIR)/mirror/centos/etc/yum/pluginconf.d/priorities.conf:
mkdir -p $(@D)
/bin/echo -e "[main]\nenabled=1\ncheck_obsoletes=1\nfull_match=1" > $@
/bin/echo -e "[main]\nenabled=1\ncheck_obsoletes=1\nfull_match=$(DENY_RPM_DOWNGRADE)" > $@
$(BUILD_DIR)/mirror/centos/etc/yum.repos.d/base.repo: $(call depv,YUM_REPOS)
$(BUILD_DIR)/mirror/centos/etc/yum.repos.d/base.repo: \
@ -32,7 +38,7 @@ $(BUILD_DIR)/bin/yumdownloader: $(SOURCE_DIR)/mirror/centos/yumdownloader-deps.p
$(BUILD_DIR)/mirror/centos/etc/yum.repos.d/extra.repo: $(call depv,EXTRA_RPM_REPOS)
$(BUILD_DIR)/mirror/centos/etc/yum.repos.d/extra.repo: \
export contents:=$(foreach repo,$(EXTRA_RPM_REPOS),\n$(call create_extra_repo,repo)\n)
export contents:=$(foreach repo,$(EXTRA_RPM_REPOS),\n$(call create_extra_repo,$(repo))\n)
$(BUILD_DIR)/mirror/centos/etc/yum.repos.d/extra.repo:
@mkdir -p $(@D)
/bin/echo -e "$${contents}" > $@

View File

@ -1,7 +1,7 @@
# Problem: --archlist=x86_64 really means "x86_64 and i686". Therefore yum
# tries to resolve dependencies of i686 packages. Sometimes this fails due
# to an upgraded x86_64 only package available in the fuel repo. For
# to an upgraded x86_64 only package available in the fuel repo. For
# instance, when yum is asked to download dmraid package it tries to resolve
# the dependencies of i686 version. This fails since the upgraded
# device-mapper-libs package (from the fuel repo) is x86_64 only:
@ -44,7 +44,7 @@ baseurl=$(MIRROR_CENTOS)/os/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
exclude=*i686 $(x86_rpm_packages_whitelist)
priority=10
priority=90
[updates]
name=CentOS-$(CENTOS_RELEASE) - Updates
@ -53,7 +53,7 @@ baseurl=$(MIRROR_CENTOS)/updates/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
exclude=*i686 $(x86_rpm_packages_whitelist)
priority=10
priority=90
[base_i686_whitelisted]
name=CentOS-$(CENTOS_RELEASE) - Base
@ -62,7 +62,7 @@ baseurl=$(MIRROR_CENTOS)/os/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
includepkgs=$(x86_rpm_packages_whitelist)
priority=10
priority=90
[updates_i686_whitelisted]
name=CentOS-$(CENTOS_RELEASE) - Updates
@ -71,7 +71,7 @@ baseurl=$(MIRROR_CENTOS)/updates/$(CENTOS_ARCH)
gpgcheck=0
enabled=1
includepkgs=$(x86_rpm_packages_whitelist)
priority=10
priority=90
[extras]
name=CentOS-$(CENTOS_RELEASE) - Extras
@ -79,7 +79,7 @@ name=CentOS-$(CENTOS_RELEASE) - Extras
baseurl=$(MIRROR_CENTOS)/extras/$(CENTOS_ARCH)
gpgcheck=0
enabled=0
priority=10
priority=90
[centosplus]
name=CentOS-$(CENTOS_RELEASE) - Plus
@ -87,7 +87,7 @@ name=CentOS-$(CENTOS_RELEASE) - Plus
baseurl=$(MIRROR_CENTOS)/centosplus/$(CENTOS_ARCH)
gpgcheck=0
enabled=0
priority=10
priority=90
[contrib]
name=CentOS-$(CENTOS_RELEASE) - Contrib
@ -95,7 +95,7 @@ name=CentOS-$(CENTOS_RELEASE) - Contrib
baseurl=$(MIRROR_CENTOS)/contrib/$(CENTOS_ARCH)
gpgcheck=0
enabled=0
priority=10
priority=90
endef
define yum_repo_fuel
@ -105,7 +105,7 @@ name=Mirantis OpenStack Custom Packages
baseurl=$(MIRROR_FUEL)
gpgcheck=0
enabled=1
priority=1
priority=20
endef
define yum_repo_proprietary
@ -114,18 +114,25 @@ name = CentOS $(CENTOS_RELEASE) - Proprietary
baseurl = $(MIRROR_CENTOS)/os/$(CENTOS_ARCH)
gpgcheck = 0
enabled = 1
priority=1
priority=20
endef
# Accept EXTRA_RPM_REPOS in a form of a list of: name,url,priority
# Accept EXTRA_RPM_REPOS in a form of list of (default priority=10): name,url
get_repo_name=$(shell echo $1 | cut -d ',' -f 1)
get_repo_url=$(shell echo $1 | cut -d ',' -f2)
get_repo_priority=$(shell val=`echo $1 | cut -d ',' -f3`; echo $${val:-10})
# It's a callable object.
# Usage: $(call create_extra_repo,repo)
# where:
# repo="repo_name,http://path_to_the_repo another_name,http://awesome_repo"
# repo=repo_name,http://path_to_the_repo,repo_priority
# repo_priority is a number from 1 to 99
define create_extra_repo
[$(shell VAR=$($1); echo "$${VAR%%,*}")]
name = Extra repo "$(shell VAR=$($1); echo "$${VAR%%,*}")"
baseurl = $(shell VAR=$($1); echo "$${VAR#*,}")
[$(call get_repo_name,$1)]
name = Repo "$(call get_repo_name,$1)"
baseurl = $(call get_repo_url,$1)
gpgcheck = 0
enabled = 1
priority = 10
priority = $(call get_repo_priority,$1)
endef