Skip to content

Commit

Permalink
Changes for building dpkg (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed May 4, 2024
1 parent fc42c45 commit 24659e3
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions l2tdevtools/build_helpers/dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ def _RemoveOlderDPKGPackages(self, project_name, project_version):
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)
try:
os.remove(filename)
except PermissionError as exception:
logging.info('Unable to remove: {0:s} with error: {1!s}'.format(
filename, exception))

# Remove files of previous versions in the format:
# <project>[-_][0-9]*-[1-9].*
Expand All @@ -364,7 +368,11 @@ def _RemoveOlderDPKGPackages(self, project_name, project_version):
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)
try:
os.remove(filename)
except PermissionError as exception:
logging.info('Unable to remove: {0:s} with error: {1!s}'.format(
filename, exception))

def _RemoveOlderOriginalSourcePackage(
self, project_name, project_version, version_suffix=None,
Expand Down Expand Up @@ -393,7 +401,11 @@ def _RemoveOlderOriginalSourcePackage(
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)
try:
os.remove(filename)
except PermissionError as exception:
logging.info('Unable to remove: {0:s} with error: {1!s}'.format(
filename, exception))

# Remove files of previous versions in the format:
# <project>_[0-9]*<suffix>~<distribution>.orig.tar.gz
Expand All @@ -405,7 +417,11 @@ def _RemoveOlderOriginalSourcePackage(
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)
try:
os.remove(filename)
except PermissionError as exception:
logging.info('Unable to remove: {0:s} with error: {1!s}'.format(
filename, exception))

def _RemoveOlderSourceDPKGPackages(self, project_name, project_version):
"""Removes previous versions of source dpkg packages.
Expand All @@ -430,7 +446,11 @@ def _RemoveOlderSourceDPKGPackages(self, project_name, project_version):
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)
try:
os.remove(filename)
except PermissionError as exception:
logging.info('Unable to remove: {0:s} with error: {1!s}'.format(
filename, exception))

# Remove files of previous versions in the format:
# <project>[-_][0-9]*-[1-9]i<suffix>~<distribution>.*
Expand All @@ -441,7 +461,11 @@ def _RemoveOlderSourceDPKGPackages(self, project_name, project_version):
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
os.remove(filename)
try:
os.remove(filename)
except PermissionError as exception:
logging.info('Unable to remove: {0:s} with error: {1!s}'.format(
filename, exception))

def _RunLSBReleaseCommand(self, option='-a'):
"""Runs the lsb-release command (/usr/bin/lsb_release).
Expand Down

0 comments on commit 24659e3

Please sign in to comment.