Skip to content

Commit

Permalink
table: re-enable xattrs support
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Dec 19, 2024
1 parent 0ca3763 commit 1045642
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/ota_metadata/file_table/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
NOTE: xattrs is not supported by legacy OTA image spec! So comment out set_xattrs now.
"""


from __future__ import annotations

Expand Down Expand Up @@ -114,7 +112,7 @@ def prepare_target(
if prepare_method == "copy":
shutil.copy(_rs, _target_on_mnt)
self.set_perm(_target_on_mnt)
# self.set_xattr(_target_on_mnt)
self.set_xattr(_target_on_mnt)
return

if prepare_method == "hardlink":
Expand All @@ -124,13 +122,13 @@ def prepare_target(
# to file paths point to the same inode, for simplicity here we just
# do it everytime.
self.set_perm(_target_on_mnt)
# self.set_xattr(_target_on_mnt)
self.set_xattr(_target_on_mnt)
return

if prepare_method == "move":
shutil.move(str(_rs), _target_on_mnt)
self.set_perm(_target_on_mnt)
# self.set_xattr(_target_on_mnt)
self.set_xattr(_target_on_mnt)


class FileTableNonRegularFiles(TableSpec, FileTableBase):
Expand Down Expand Up @@ -181,14 +179,14 @@ def prepare_target(self, *, target_mnt: StrOrPath) -> None:
_symlink_target = _symlink_target_raw.decode()
_target_on_mnt.symlink_to(_symlink_target)
self.set_perm(_target_on_mnt)
# self.set_xattr(_target_on_mnt)
self.set_xattr(_target_on_mnt)
return

if stat.S_ISCHR(_mode):
_device_num = os.makedev(0, 0)
os.mknod(_target_on_mnt, mode=_mode, device=_device_num)
self.set_perm(_target_on_mnt)
# self.set_xattr(_target_on_mnt)
self.set_xattr(_target_on_mnt)
return

raise ValueError(f"invalid entry {self}")
Expand All @@ -201,4 +199,4 @@ def prepare_target(self, *, target_mnt: StrOrPath) -> None:
_target_on_mnt = self.fpath_on_target(target_mnt=target_mnt)
_target_on_mnt.mkdir(exist_ok=True, parents=True)
self.set_perm(_target_on_mnt)
# self.set_xattr(_target_on_mnt)
self.set_xattr(_target_on_mnt)

0 comments on commit 1045642

Please sign in to comment.