mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-11-20 16:24:59 +00:00
Package Distribution Restrictions
Packages can now restrict the debian distribution for which they can build using the new 'dists' package key. This is a csv list of distribution codenames. If the currently building distribution is not in the list then the package is ignored.
This commit is contained in:
@@ -136,8 +136,10 @@ class OnlPackage(object):
|
|||||||
'BUILD_DIR' : 'BUILD/%s' % g_dist_codename,
|
'BUILD_DIR' : 'BUILD/%s' % g_dist_codename,
|
||||||
|
|
||||||
# Default Templates Location
|
# Default Templates Location
|
||||||
'ONL_TEMPLATES' : "%s/packages/base/any/templates" % os.getenv("ONL")
|
'ONL_TEMPLATES' : "%s/packages/base/any/templates" % os.getenv("ONL"),
|
||||||
|
|
||||||
|
# Default Distribution
|
||||||
|
'DISTS' : g_dist_codename,
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
@@ -503,6 +505,13 @@ class OnlPackageGroup(object):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def distcheck(self):
|
||||||
|
for p in self.packages:
|
||||||
|
if p.pkg.get("dists", None):
|
||||||
|
if g_dist_codename not in p.pkg['dists'].split(','):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def prerequisite_packages(self):
|
def prerequisite_packages(self):
|
||||||
rv = []
|
rv = []
|
||||||
for e in list(onlu.sflatten(self._pkgs.get('prerequisites', {}).get('packages', []))):
|
for e in list(onlu.sflatten(self._pkgs.get('prerequisites', {}).get('packages', []))):
|
||||||
@@ -863,7 +872,8 @@ class OnlPackageManager(object):
|
|||||||
pg.filtered = True
|
pg.filtered = True
|
||||||
if not pg.archcheck(arches):
|
if not pg.archcheck(arches):
|
||||||
pg.filtered = True
|
pg.filtered = True
|
||||||
|
if not pg.distcheck():
|
||||||
|
pg.filtered = True
|
||||||
|
|
||||||
def load(self, basedir, usecache=True, rebuildcache=False):
|
def load(self, basedir, usecache=True, rebuildcache=False):
|
||||||
pkgspec = [ 'PKG.yml', 'pkg.yml' ]
|
pkgspec = [ 'PKG.yml', 'pkg.yml' ]
|
||||||
@@ -1089,6 +1099,8 @@ class OnlPackageManager(object):
|
|||||||
def list_platforms(self, arch):
|
def list_platforms(self, arch):
|
||||||
platforms = []
|
platforms = []
|
||||||
for pg in self.package_groups:
|
for pg in self.package_groups:
|
||||||
|
if not pg.distcheck():
|
||||||
|
continue
|
||||||
for p in pg.packages:
|
for p in pg.packages:
|
||||||
(name, pkgArch) = OnlPackage.idparse(p.id())
|
(name, pkgArch) = OnlPackage.idparse(p.id())
|
||||||
m = re.match(r'onl-platform-config-(?P<platform>.*)', name)
|
m = re.match(r'onl-platform-config-(?P<platform>.*)', name)
|
||||||
@@ -1103,7 +1115,7 @@ def defaultPm():
|
|||||||
packagedirs = os.environ['ONLPM_OPTION_PACKAGEDIRS'].split(':')
|
packagedirs = os.environ['ONLPM_OPTION_PACKAGEDIRS'].split(':')
|
||||||
repoPackageDir = os.environ.get('ONLPM_OPTION_REPO_PACKAGE_DIR', 'packages')
|
repoPackageDir = os.environ.get('ONLPM_OPTION_REPO_PACKAGE_DIR', 'packages')
|
||||||
subdir = os.getcwd()
|
subdir = os.getcwd()
|
||||||
arches = ['amd64', 'powerpc', 'armel', 'arm64', 'all',]
|
arches = ['amd64', 'powerpc', 'armel', 'armhf', 'arm64', 'all',]
|
||||||
|
|
||||||
if envJson:
|
if envJson:
|
||||||
for j in envJson.split(':'):
|
for j in envJson.split(':'):
|
||||||
@@ -1139,7 +1151,7 @@ if __name__ == '__main__':
|
|||||||
ap.add_argument("--csv", action='store_true')
|
ap.add_argument("--csv", action='store_true')
|
||||||
ap.add_argument("--show-group", action='store_true')
|
ap.add_argument("--show-group", action='store_true')
|
||||||
ap.add_argument("--arch")
|
ap.add_argument("--arch")
|
||||||
ap.add_argument("--arches", nargs='+', default=['amd64', 'powerpc', 'armel', 'arm64', 'all']),
|
ap.add_argument("--arches", nargs='+', default=['amd64', 'powerpc', 'armel', 'armhf', 'arm64', 'all']),
|
||||||
ap.add_argument("--pmake", action='store_true')
|
ap.add_argument("--pmake", action='store_true')
|
||||||
ap.add_argument("--prereq-packages", action='store_true')
|
ap.add_argument("--prereq-packages", action='store_true')
|
||||||
ap.add_argument("--lookup", metavar='PACKAGE')
|
ap.add_argument("--lookup", metavar='PACKAGE')
|
||||||
|
|||||||
Reference in New Issue
Block a user