From 0df1c0e5aaf6aa131bc9cf0ccc7c760214eb25cd Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 11 Jun 2019 17:10:45 +0000 Subject: [PATCH] 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. --- tools/onlpm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/onlpm.py b/tools/onlpm.py index 93fd0c16..805b7162 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -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)