GithubHelp home page GithubHelp logo

desultory / pycpio Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 151 KB

Python library for CPIO manipulation

License: GNU General Public License v2.0

Python 100.00%
cpio cpio-archives data initramfs pypi-package python python-3 python3

pycpio's Introduction

Tests

PyCPIO

A library for creating CPIO files in Python.

Currently, the library only supports the New ASCII format, and xz compression

This library is primary designed for use in ugrd to create CPIO archives for use in initramfs.

Usage

  -h, --help            show this help message and exit
  -d, --debug           enable debug mode (level 10)
  -dd, --trace          enable trace debug mode (level 5)
  -v, --version         print the version and exit
  --log-file LOG_FILE   set the path to the log file
  --log-level LOG_LEVEL
                        set the log level
  --log-time            enable log timestamps
  --no-log-color        disable log color
  -i INPUT, --input INPUT
                        input file
  -a APPEND, --append APPEND
                        append to archive
  --recursive RECURSIVE
                        append to archive recursively
  --relative RELATIVE   append to archive relative to this path
  --absolute            allow absolute paths
  --reproducible        Set mtime to 0, start inodes at 0
  --rm RM, --delete RM  delete from archive
  -n NAME, --name NAME  Name/path override for append
  -s SYMLINK, --symlink SYMLINK
                        create symlink
  -c CHARDEV, --chardev CHARDEV
                        create character device
  --major MAJOR         major number for character/block device
  --minor MINOR         minor number for character/block device
  -u UID, --set-owner UID
                        set UID on all files
  -g GID, --set-group GID
                        set GID on all files
  -m MODE, --set-mode MODE
                        set mode on all files
  -z COMPRESS, --compress COMPRESS
                        compression type
  -o OUTPUT, --output OUTPUT
                        output file
  -l, --list            list CPIO contents
  -p, --print           print CPIO contents

Structure

  • pycpio.header.cpioheader: The class which represents a CPIO header
    • Can be initialized from args for header fields, or bytes representing a header
    • header types are defined in pycpio.header.headers (only the new ascii format is supported)
  • pycpio.cpio.data: The class which represents a CPIO data block
    • Each CPIO object must have a header.
    • Currently the follwing subtypes are supported:
      • file : A regular file, or hardlink.
      • dir : A directory
      • symlink : A symbolic link
      • chardev : A character device
    • CPIO objects are collected in a pycpio.cpio.archive object
      • The archive handles duplication, inode generation, name normalization, and other collection related tasks
    • All CPIO object types can be initialized from args, bytes, or a file path

pycpio's People

Contributors

desultory avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

jose-pr

pycpio's Issues

Awsome library not all deps are on pypi

Found this library while looking for a way to create a cpio file in pypi. But found out it depends on zenlib which doesnt look to be avaliable from pypi.
Any chance to also release/update zenlib on pypi?

Limited hardlink support

Currently, if there is an inode read match in the CPIOArchive, and the data matches, the data is removed from the second data object and the nlinks is incremeted on both.

I believe this is what is required for hardlinks in CPIOs. There is no support to add them using the PyCPIO class or any other way, they can simply be read. Support could be added.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.