这是indexloc提供的服务,不要输入任何密码
Skip to content

Rewrite termux-create-package #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 8, 2022

Conversation

agnostic-apollo
Copy link
Member

@agnostic-apollo agnostic-apollo commented Dec 10, 2021

Check README.md for further details. It seems to be working fine for both ubuntu and termux (android 7) as per my tests. Let me know if there are any issues. I'll wait a while for feedback before bumping version and merging. A single commit was done since pretty much everything has been replaced or deleted from previous versions and this is more like an initial commit.

Release workflow and manual install instructions do need to be tested. Looks fine, final tests would need to be done after merging anyways.

Added

  • Add support for YAML format for manifests.
  • Add support for custom permissions and ownership of data files.
  • Add support to automatically set permissions and ownership to control tar files.
  • Add support to automatically add Installed-Size field to control file.
  • Add support to automatically generate md5sums file.
  • Add support to automatically add other controls files config, conffiles, templates, shlibs to control tar.
  • Add support to add custom control file fields.
  • Add support for control and data tar compression type and format.
  • Add support for --control-files-dir, --deb-dir, --deb-name, --files-dir, --pkg-arch, --pkg-version and --yaml comamnd line options.
  • Add support of installation_prefix, files_dir, tar_compression, tar_format, deb_dir, deb_name, deb_architecture_tag, control_files_dir, maintainer_scripts_shebang, conffiles_prefix_to_replace, fix_perms, allow_bad_user_names_and_ids, ignore_android_specific_rules create info fields in manifest.
  • Add support of source, perm, fix_perm, source_ownership, owner_uid, owner_uname, owner_gid, owner_gname, is_conffile attribute fields for data_files dictionary in manifest.
  • Add support of ignore, ignore_if_no_exist, source_readlink, source_recurse, set_parent_perm, symlink_destinations, set_shebang action fields for data_files dictionary in manifest.
  • Add support to automatically add termux-create-package script and sha256sums.txt to releases.

Changed

  • The manifest format has been completely changed, but backward compatibility still maintained. Check README.md for details. The files dictionary has been replaced with data_files. The control file fields are to be added to the control dictionary.
  • Extended manifest validation so that debs comply with debian and dpkg rules.
  • The manifest Depends, Provides, Conflicts and other package relationship fields should be of type string now instead of a list.
  • The manifest Description and other multi-line field values should be of type list now instead of a string.
  • The --prefix must now be an absolute path.

Install instructions

You can run following commands to install the updated script.

Termux

pkg install python && \
pip install ruamel.yaml && \
pkg install curl && \
export install_path="/data/data/com.termux/files/usr/bin" && \
mkdir -p "$install_path" && \
curl -L 'https://github.com/agnostic-apollo/termux-create-package/raw/rewrite/src/termux-create-package' -o "$install_path/termux-create-package" && \
export owner="$(stat -c "%u" "$install_path")"; chown "$owner:$owner" "$install_path/termux-create-package" && \
chmod 700 "$install_path/termux-create-package";

Linux Distros

sudo apt install python3 python3-pip  && \
sudo pip3 install ruamel.yaml && \
sudo apt install curl && \
export install_path="/usr/local/bin" && \
sudo mkdir -p "$install_path" && \
sudo curl -L 'https://github.com/agnostic-apollo/termux-create-package/raw/rewrite/src/termux-create-package' -o "$install_path/termux-create-package" && \
sudo chmod 755 "$install_path/termux-create-package";

### Added
- Add support for `YAML` format for manifests.
- Add support for custom permissions and ownership of data files.
- Add support to automatically set permissions and ownership to control tar files.
- Add support to automatically add `Installed-Size` field to `control` file.
- Add support to automatically generate `md5sums` file.
- Add support to automatically add other controls files `config`, `conffiles`, `templates`, `shlibs` to control tar.
- Add support to add custom `control` file fields.
- Add support for control and data tar compression type and format.
- Add support for `--control-files-dir`, `--deb-dir`, `--deb-name`, `--files-dir`, `--pkg-arch`, `--pkg-version` and `--yaml` comamnd line options.
- Add support of `installation_prefix`, `files_dir`, `tar_compression`, `tar_format`, `deb_dir`, `deb_name`, `deb_architecture_tag`, `control_files_dir`, `maintainer_scripts_shebang`, `conffiles_prefix_to_replace`, `fix_perms`, `allow_bad_user_names_and_ids`, `ignore_android_specific_rules` create info fields in manifest.
- Add support of `source`, `perm`, `fix_perm`, `source_ownership`, `owner_uid`, `owner_uname`, `owner_gid`, `owner_gname`, `is_conffile` attribute fields for `data_files` dictionary in manifest.
- Add support of `ignore`, `ignore_if_no_exist`, `source_readlink`, `source_recurse`, `set_parent_perm`, `symlink_destinations`, `set_shebang` action fields for `data_files` dictionary in manifest.
- Add support to automatically add `termux-create-package` script and `sha256sums.txt` to releases.

### Changed
- The manifest format has been completely changed, but backward compatibility still maintained. Check `README.md` for details. The `files` dictionary has been replaced with `data_files`. The `control` file fields are to be added to the `control` dictionary.
- Extended manifest validation so that debs comply with debian and `dpkg` rules.
- The manifest `Depends`, `Provides`, `Conflicts` and other package relationship fields should be of type `string` now instead of a `list`.
- The manifest `Description` and other multi-line field values should be of type `list` now instead of a `string`.
- The `--prefix` must now be an absolute path.
setup.py Outdated
Comment on lines 15 to 17
version="0.11",
author="Fredrik Fornwall",
author_email="fredrik@fornwall.net",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of feels like a rewrite (with +5k lines) deserves a version bump and author change.. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess ;) I guess I can add my name to the field. Hopefully, python packaging policy hasn't changed since 2009 to allow multiple authors.

@JesusChapman
Copy link

excellent !, this will help a lot to the automation and creation of packages for termux, many people will find it useful and it will encourage the use of deb packages to package projects

@agnostic-apollo
Copy link
Member Author

agnostic-apollo commented Dec 11, 2021

excellent !, this will help a lot to the automation and creation of packages for termux, many people will find it useful and it will encourage the use of deb packages to package projects

Thanks. Automation was my goal too.

I have added install instructions in main comment above.

@JesusChapman
Copy link

JesusChapman commented Dec 11, 2021

I am already using your update.

but I need a favor, can you give me an example of how to add a postins / postrm to the package? I didn't see how to do that in the documentation and I need it.

@agnostic-apollo
Copy link
Member Author

It is documented at https://github.com/agnostic-apollo/termux-create-package/tree/rewrite#Other-Control-Files

The maintainer scripts preinst, postinst, prerm, postrm, config and other control files conffiles, templates, shlibs are automatically added to control.tar* if they exist in control_files_dir or files_dir.

@JesusChapman
Copy link

Do you mean that if there is a folder called "control_files_dir" in the place of the script, it will automatically add the scripts that are inside that folder?

@agnostic-apollo
Copy link
Member Author

No, those are keys where you supply the path. Check https://github.com/agnostic-apollo/termux-create-package/blob/rewrite/examples/goodbye-world/manifest-android-termux.yml#L16 and https://github.com/agnostic-apollo/termux-create-package/tree/rewrite/examples/goodbye-world/control of goodbye-world example.

@JesusChapman
Copy link

Oh, thanks!

@JesusChapman
Copy link

When will it be available?

@agnostic-apollo
Copy link
Member Author

When will it be available?

Well, like mostly always, nobody or not many are interested in testing (huge) changes, so will just merge after bumping versions and update package in termux-packages. I am not sure who has access for python package publishing, @xeffyr seems to have it.

@JesusChapman
Copy link

Oh, ok

@agnostic-apollo agnostic-apollo merged commit a7e20f9 into termux:master Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants