mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2026-01-27 10:22:15 +00:00
Fix bug in add_package() when the realpath of the package contains an underscore.
When a package is added to the REPO any duplicates are supposed to be removed automatically. The (package-name, version, arch) was determined by splitting the (fullpath) name by underscore. If an underscore was present in any of the parent directories then the split did not yield the correct information. As a result any duplicate packages were not removed and were instead left in the REPO. This fix splits the package basename instead of the package path. You may now clone your ONL worktree as JEFF_IS_STUPID and it should work now.
This commit is contained in:
@@ -723,7 +723,7 @@ class OnlPackageRepoUnlocked(object):
|
||||
if not os.path.exists(p):
|
||||
raise OnlPackageError("Package file '%s' does not exist." % p)
|
||||
logger.info("adding package '%s'..." % p)
|
||||
underscores = p.split('_')
|
||||
underscores = os.path.basename(p).split('_')
|
||||
# Package name is the first entry
|
||||
package = os.path.split(underscores[0])[1]
|
||||
# Architecture is the last entry (.deb)
|
||||
@@ -736,7 +736,7 @@ class OnlPackageRepoUnlocked(object):
|
||||
|
||||
# Remove any existing versions of this package.
|
||||
for existing in glob.glob(os.path.join(dstdir, "%s_*.deb" % package)):
|
||||
logger.debug("Removing existing package %s" % existing)
|
||||
logger.info("Removing existing package %s" % existing)
|
||||
os.unlink(existing)
|
||||
|
||||
shutil.copy(p, dstdir)
|
||||
|
||||
Reference in New Issue
Block a user