aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build.yml11
-rw-r--r--.fossil-settings/ignore-glob1
-rw-r--r--CHANGELOG.md147
-rw-r--r--Makefile36
-rw-r--r--README.md (renamed from README)24
-rw-r--r--config.mk18
-rwxr-xr-xconfigure112
-rwxr-xr-xcontrib/cpt-chroot92
-rwxr-xr-xcontrib/cpt-size65
-rw-r--r--docs/Makefile10
-rw-r--r--docs/cpt.org28
-rw-r--r--docs/cpt.texi55
-rw-r--r--docs/cpt.txt30
-rw-r--r--man/cpt-checksum.116
-rw-r--r--spec/01_lib_spec.sh2
-rw-r--r--spec/02_src_spec.sh2
-rwxr-xr-xsrc/cpt-build2
-rwxr-xr-xsrc/cpt-checksum28
-rw-r--r--src/cpt-lib.in81
-rwxr-xr-xtools/mkdist.sh3
-rw-r--r--www/index.md2
21 files changed, 583 insertions, 182 deletions
diff --git a/.build.yml b/.build.yml
index 536f9e7..b8cf514 100644
--- a/.build.yml
+++ b/.build.yml
@@ -9,15 +9,20 @@ packages:
- texinfo
- gzip
tasks:
- - build: |
- cd cpt
- make
- install-pax: |
git clone --quiet https://github.com/carbslinux/otools
cd otools
./configure
make pax
sudo install -Dm755 pax /usr/bin/pax
+ - install-blake3: |
+ git clone --quiet https://git.sr.ht/~mcf/b3sum
+ cd b3sum
+ sudo make PREFIX=/usr install
+ - build: |
+ cd cpt
+ ./configure
+ make
- test: |
cd cpt
curl -fsSL https://git.io/shellspec | sudo sh -s -- -y -p /usr
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob
index d4cc917..98cdf27 100644
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -17,3 +17,4 @@ tests/etc/cpt-hook
.shellspec-quick.log
report
coverage
+config.mk
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7854cfe..5719efd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,39 @@ this project _somewhat_ adheres to [Semantic Versioning].
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
+[Unreleased]
+--------------------------------------------------------------------------------
+
+### BLAKE3 checksums
+
+The package manager now uses `b3sum` for creating digests. The change is
+backwards compatible, which means that BLAKE3 will slowly replace the SHA256
+algorithm in packages. The `cpt` package in the repository will continue to use
+the sha256 until the end of 2021.
+
+The `checksums` files generated with BLAKE3 has the header `%BLAKE3` which is
+used to distinguish digest algorithms. If the file does not include such a
+header, it is assumed to be a file created using the SHA256 algorithm. This is
+especially handy for keeping the /etc checksums intact. If the package being
+built is already installed on the system `cpt` makes sure that the generated
+etcsums are also backwards compatible.
+
+
+### Added
+- `cpt-checksum` now has the `-s` flag to generate checksums using the SHA256
+ digest algorithm.
+- Added `CPT_DOWNLOADER` variable to change the download program. Available
+ options are: `curl`, `wget`, `wget2`, `aria2c`, and `axel`.
+- `cpt-chroot` now has the flag `-m` to disable mounting/unmounting pseudo
+ filesystems.
+- This changelog is now installed by the `Makefile`.
+
+### Changed
+- `cpt-size` has been rewritten to support POSIX `du`, and to support packages
+ with a file count of over 50,000.
+- Installation now requires to run `./configure`.
+
+
6.1.1 - 2021-08-04
--------------------------------------------------------------------------------
@@ -17,7 +50,7 @@ this project _somewhat_ adheres to [Semantic Versioning].
the package manifest.
-6.1.0 - 2021-07-22
+[6.1.0] - 2021-07-22
--------------------------------------------------------------------------------
### IMPORTANT
@@ -44,14 +77,14 @@ the next pull. The usage of the repository cache can be disabled by setting
- Reworked the package repository backend.
-6.0.4 - 2021-05-12
+[6.0.4] - 2021-05-12
--------------------------------------------------------------------------------
### Fixed
- Fixed the declaration place of the `$pid` variable
-6.0.3 - 2021-05-10
+[6.0.3] - 2021-05-10
--------------------------------------------------------------------------------
### Fixed
@@ -59,21 +92,21 @@ the next pull. The usage of the repository cache can be disabled by setting
- Fixed `cpt --help` output when inside a directory prefixed with `cpt-`
-6.0.2 - 2021-04-05
+[6.0.2] - 2021-04-05
--------------------------------------------------------------------------------
### Fixed
- Fixed `make dist` target.
-6.0.1 - 2021-04-05
+[6.0.1] - 2021-04-05
--------------------------------------------------------------------------------
### Fixed
- Fixed inconsistencies of the `Ctrl+C` interrupt behaviour
-6.0.0 - 2021-04-03
+[6.0.0] - 2021-04-03
--------------------------------------------------------------------------------
### Added
@@ -103,7 +136,7 @@ the next pull. The usage of the repository cache can be disabled by setting
[ssu]: https://github.com/illiliti/ssu
-5.1.2 - 2021-01-04
+[5.1.2] - 2021-01-04
--------------------------------------------------------------------------------
### Fixed
@@ -112,7 +145,7 @@ the next pull. The usage of the repository cache can be disabled by setting
file locations on the manifest as well.
-5.1.1 - 2020-12-20
+[5.1.1] - 2020-12-20
--------------------------------------------------------------------------------
### Fixed
@@ -120,7 +153,7 @@ the next pull. The usage of the repository cache can be disabled by setting
`$CPT_DEBUG` was set
-5.1.0 - 2020-11-25
+[5.1.0] - 2020-11-25
--------------------------------------------------------------------------------
### IMPORTANT
@@ -142,7 +175,7 @@ the next pull. The usage of the repository cache can be disabled by setting
defined.
-5.0.0 - 2020-10-06
+[5.0.0] - 2020-10-06
--------------------------------------------------------------------------------
### IMPORTANT
@@ -170,7 +203,7 @@ the next pull. The usage of the repository cache can be disabled by setting
done in a `test` script can be done from the build itself.
-4.1.1 - 2020-09-25
+[4.1.1] - 2020-09-25
--------------------------------------------------------------------------------
### Changed
@@ -184,7 +217,7 @@ the next pull. The usage of the repository cache can be disabled by setting
- Fixed the `as_root()` function when using `su`.
-4.1.0 - 2020-09-11
+[4.1.0] - 2020-09-11
--------------------------------------------------------------------------------
### Added
@@ -194,14 +227,14 @@ the next pull. The usage of the repository cache can be disabled by setting
- Fixed `as_root()` call on `cpt-chbuild`.
-4.0.1 - 2020-09-10
+[4.0.1] - 2020-09-10
--------------------------------------------------------------------------------
### Fixed
- Fixed flags starting with `--no-`
-4.0.0 - 2020-09-09
+[4.0.0] - 2020-09-09
--------------------------------------------------------------------------------
With this update, all the documentation was moved to the `docs` repository,
@@ -229,14 +262,14 @@ which can be accessed from the following sources:
- Fixed `getoptions` parsers while declaring initial variables.
- Fixed build `cpt-stat` on the Makefile.
-3.3.1 - 2020-08-31
+[3.3.1] - 2020-08-31
--------------------------------------------------------------------------------
### Changed
- Reverted `sh256()` to the previous way.
-3.3.0 - 2020-08-31
+[3.3.0] - 2020-08-31
--------------------------------------------------------------------------------
### Added
@@ -251,7 +284,7 @@ which can be accessed from the following sources:
- Made `cpt` checksum method compatible with the KISS Community repository.
-3.2.0 - 2020-08-22
+[3.2.0] - 2020-08-22
--------------------------------------------------------------------------------
### Added
@@ -268,14 +301,14 @@ which can be accessed from the following sources:
- `cpt` programs no longer exit if `$CPT_PATH` is unset.
-3.1.1 - 2020-08-11
+[3.1.1] - 2020-08-11
--------------------------------------------------------------------------------
### Changed
- `as_root()` now sets package manager variables with env.
-3.1.0 - 2020-08-07
+[3.1.0] - 2020-08-07
--------------------------------------------------------------------------------
### Changed
@@ -285,7 +318,7 @@ which can be accessed from the following sources:
- Dropping libtool's `*.la` library files from packages.
-3.0.0 - 2020-07-24
+[3.0.0] - 2020-07-24
--------------------------------------------------------------------------------
This is the 3.0.0 release. This will make `kiss` (now renamed as `cpt`) a
@@ -323,7 +356,7 @@ comes with nice benefits such as:
- Removed `kiss-outdated` and `kiss-which`.
-2.3.0 - 2020-07-16
+[2.3.0] - 2020-07-16
--------------------------------------------------------------------------------
### Added
@@ -345,14 +378,14 @@ comes with nice benefits such as:
package ownership.
-2.2.1 - 2020-06-11
+[2.2.1] - 2020-06-11
--------------------------------------------------------------------------------
### Fixed
- Fixed directory checking on package removal
-2.2.0 - 2020-06-10
+[2.2.0] - 2020-06-10
--------------------------------------------------------------------------------
### Added
@@ -372,7 +405,7 @@ comes with nice benefits such as:
characters (such as `/usr/bin/[`) would result in a manifest deletion.
-2.1.2 - 2020-06-03
+[2.1.2] - 2020-06-03
--------------------------------------------------------------------------------
### Fixed
@@ -380,7 +413,7 @@ comes with nice benefits such as:
the `passwd` database.
-2.1.1 - 2020-06-03
+[2.1.1] - 2020-06-03
--------------------------------------------------------------------------------
### Fixed
@@ -389,7 +422,7 @@ comes with nice benefits such as:
- Fixed setting binary packages as dependencies.
-2.1.0 - 2020-05-29
+[2.1.0] - 2020-05-29
--------------------------------------------------------------------------------
### Added
@@ -404,7 +437,7 @@ comes with nice benefits such as:
- Removed strip messages
-2.0.0 - 2020-05-28
+[2.0.0] - 2020-05-28
--------------------------------------------------------------------------------
### Added
@@ -428,7 +461,7 @@ comes with nice benefits such as:
[kiss-extra]: https://github.com/carbslinux/kiss-extra
-1.22.4 - 2020-05-26
+[1.22.4] - 2020-05-26
--------------------------------------------------------------------------------
**NOTE:** `1.22.x` is the last minor version before `2.0.0`, meaning I will not
@@ -445,7 +478,7 @@ before release, as binary repositories will need user feedback.
- Enabled the usage of glob characters for `kiss-bin`.
-1.22.3 - 2020-05-18
+[1.22.3] - 2020-05-18
--------------------------------------------------------------------------------
### SECURITY
@@ -457,7 +490,7 @@ before release, as binary repositories will need user feedback.
[related proof-of-concept]: https://github.com/kisslinux/kiss/pull/157#issuecomment-629880775
-1.22.2 - 2020-05-16
+[1.22.2] - 2020-05-16
--------------------------------------------------------------------------------
### Fixed
@@ -466,7 +499,7 @@ before release, as binary repositories will need user feedback.
-1.22.1 - 2020-05-15
+[1.22.1] - 2020-05-15
--------------------------------------------------------------------------------
### REMOVED
@@ -492,7 +525,7 @@ before release, as binary repositories will need user feedback.
[kiss-extra]: https://github.com/carbslinux/kiss-extra
-1.22.0 - 2020-05-14
+[1.22.0] - 2020-05-14
--------------------------------------------------------------------------------
### Added
@@ -511,7 +544,7 @@ before release, as binary repositories will need user feedback.
full file.
-1.21.1 - 2020-05-14
+[1.21.1] - 2020-05-14
--------------------------------------------------------------------------------
### Changed
@@ -523,7 +556,7 @@ before release, as binary repositories will need user feedback.
- Fixed a non-POSIX `find` call. Thanks to @illiliti.
-1.21.0 - 2020-05-12
+[1.21.0] - 2020-05-12
--------------------------------------------------------------------------------
### Added
@@ -547,7 +580,7 @@ before release, as binary repositories will need user feedback.
external utilities.
-1.20.3 - 2020-05-09
+[1.20.3] - 2020-05-09
--------------------------------------------------------------------------------
### Fixed
@@ -555,14 +588,14 @@ before release, as binary repositories will need user feedback.
moving to `/var/db/kiss/choices` would take the name of the preferred package.
-1.20.2 - 2020-05-09
+[1.20.2] - 2020-05-09
--------------------------------------------------------------------------------
### Fixed
- Fixed an issue regarding manifest format when using pkg_swap (alternatives).
-1.20.1 - 2020-05-08
+[1.20.1] - 2020-05-08
--------------------------------------------------------------------------------
### Changed
@@ -570,14 +603,14 @@ before release, as binary repositories will need user feedback.
- Standardised `kiss-readlink` usage output.
-1.20.0 - 2020-05-07
+[1.20.0] - 2020-05-07
--------------------------------------------------------------------------------
### Added
- `KISS_NOPROMPT` can be specified in order to skip prompts.
-1.19.1 - 2020-05-07
+[1.19.1] - 2020-05-07
--------------------------------------------------------------------------------
### Added
@@ -593,7 +626,7 @@ before release, as binary repositories will need user feedback.
globally.
-1.19.0 - 2020-05-06
+[1.19.0] - 2020-05-06
--------------------------------------------------------------------------------
### Added
@@ -613,7 +646,7 @@ before release, as binary repositories will need user feedback.
`kiss extensions`.
-1.18.0 - 2020-05-04
+[1.18.0] - 2020-05-04
--------------------------------------------------------------------------------
### Added
@@ -631,7 +664,7 @@ before release, as binary repositories will need user feedback.
- Dropped the usage of `readlink` in `kiss`.
-1.17.0 - 2020-05-03
+[1.17.0] - 2020-05-03
--------------------------------------------------------------------------------
### Added
@@ -652,14 +685,14 @@ before release, as binary repositories will need user feedback.
`ksh` compatibility.
-1.16.3 - 2020-05-03
+[1.16.3] - 2020-05-03
--------------------------------------------------------------------------------
### Fixed
- Fixed etcsum location.
-1.16.2 - 2020-05-03
+[1.16.2] - 2020-05-03
--------------------------------------------------------------------------------
### Added
@@ -676,14 +709,14 @@ before release, as binary repositories will need user feedback.
system.
-1.16.1 - 2020-05-01
+[1.16.1] - 2020-05-01
--------------------------------------------------------------------------------
### Fixed
- Fixed `ksh` Ctrl+C interrupt signals.
-1.16.0 - 2020-05-01
+[1.16.0] - 2020-05-01
--------------------------------------------------------------------------------
### Added
@@ -699,7 +732,7 @@ before release, as binary repositories will need user feedback.
`$KISS_ROOT` variable
-1.15.0 - 2020-04-30
+[1.15.0] - 2020-04-30
--------------------------------------------------------------------------------
I have decided to revert to rsync installation method as it is faster and safer.
@@ -715,14 +748,14 @@ at the trade-off.
- `kiss` now accepts decompressed tar archives for package installation as well.
-1.14.2/1.14.3 - 2020-04-27
+[1.14.2/1.14.3] - 2020-04-27
--------------------------------------------------------------------------------
### Fixed
- The new installation method now complies to the `$KISS_ROOT` value.
-1.14.1 - 2020-04-27
+[1.14.1] - 2020-04-27
--------------------------------------------------------------------------------
### Removed
@@ -736,7 +769,7 @@ at the trade-off.
- Whitespace cleanup.
-1.14.0 - 2020-04-25
+[1.14.0] - 2020-04-25
--------------------------------------------------------------------------------
This release removes `rsync` from `kiss` and implements its own installation
@@ -754,14 +787,14 @@ method.
- usage of `old_ifs`
-1.13.1 - 2020-04-19
+[1.13.1] - 2020-04-19
--------------------------------------------------------------------------------
### Removed
- Reverted and removed `kiss ss` changes.
-1.13.0 - 2020-04-19
+[1.13.0] - 2020-04-19
--------------------------------------------------------------------------------
### Added
@@ -776,7 +809,7 @@ method.
- Fixed a shellcheck error.
-1.12.3 - 2020-04-17
+[1.12.3] - 2020-04-17
--------------------------------------------------------------------------------
### Changed
@@ -787,7 +820,7 @@ method.
- `kiss-repodepends` now outputs the proper depends file.
-1.12.2 - 2020-04-15
+[1.12.2] - 2020-04-15
--------------------------------------------------------------------------------
### Added
@@ -802,14 +835,14 @@ method.
- `kiss-export` now honours your `KISS_COMPRESS` value
-1.12.1 - 2020-04-12
+[1.12.1] - 2020-04-12
--------------------------------------------------------------------------------
### Fixed
- Fixed printing empty arguments in `kiss-outdated`.
-1.12.0 - 2020-04-05
+[1.12.0] - 2020-04-05
--------------------------------------------------------------------------------
### Added
@@ -829,7 +862,7 @@ method.
it could lead to wrong url generation.
-1.9.0 - 1.11.2 - 2020-04-04
+[1.9.0 - 1.11.2] - 2020-04-04
--------------------------------------------------------------------------------
### Added
diff --git a/Makefile b/Makefile
index eceb18d..b2c7a5f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,45 @@
# Carbs Packaging Tools
-include config.mk
+-include config.mk
INSTALL_SH = ./tools/install.sh
CONTRIB = `find contrib -name 'cpt*' ! -name '*.*'`
SRC = `find src -name 'cpt*' ! -name '*.*'`
BIN = ${SRC} ${CONTRIB}
-LIB = src/cpt-lib
-LIB_IN = ${LIB:=.in}
all: src/cpt-lib
- test "${DOCS}" != yes || ${MAKE} -C docs all
+ @if ! [ -e config.mk ]; then echo "Please run './configure'"; exit 1; fi
+ @test "${DOCS}" != yes || ${MAKE} -C docs all
src/cpt-lib: src/cpt-lib.in
- sed -e "s|@VERSION@|${VERSION}|g" \
- -e "s|@DOCSTRING@|Call functions from the library|g" < src/cpt-lib.in > $@
+ sed -n '/^Copyright/{s,^, ",;s,$$," \\,;p}' LICENSE | \
+ sed -e '/@LICENSE@/r /dev/stdin' \
+ -e '/@LICENSE@/d' \
+ -e "s|@VERSION@|${VERSION}|g" \
+ -e "s|@DOCSTRING@|Call functions from the library|g" src/cpt-lib.in > $@
chmod 755 $@
-test: all tests/etc/cpt-hook
+shellspec: all tests/etc/cpt-hook
shellspec
+
+shellcheck: all
cd src; find . ../contrib -name 'cpt*' ! -name '*.*' -exec shellcheck -e 2119 -x -f gcc {} +
+test: shellspec shellcheck
+
tests/etc/cpt-hook:
ln -s ../hook-file $@
dist: docs/cpt.info
+ @if ! [ -e config.mk ]; then echo "Please run './configure'"; exit 1; fi
./tools/mkdist.sh "${VERSION}"
install: all
test "${DOCS}" != yes || ${MAKE} -C docs install
+ [ -f docs/cpt.info ] && \
+ ${INSTALL_SH} -Dm644 docs/cpt.info ${DESTDIR}${INFODIR}/cpt.info
+ [ -f docs/cpt.txt ] && \
+ ${INSTALL_SH} -Dm644 docs/cpt.txt ${DESTDIR}${DOCDIR}/cpt.txt
+ ${INSTALL_SH} -Dm644 CHANGELOG.md ${DESTDIR}${DOCDIR}/CHANGELOG
${INSTALL_SH} -Dm755 -t ${DESTDIR}${BINDIR} ${BIN}
${INSTALL_SH} -Dm644 -t ${DESTDIR}${MAN1} man/*.1
for man in ${CONTRIB}; do \
@@ -36,15 +48,19 @@ install: all
done
uninstall:
- test "${DOCS}" != yes || ${MAKE} -C docs uninstall
for bin in ${BIN}; do \
rm -f ${DESTDIR}${BINDIR}/$${bin##*/}; done
for man in man/*.1; do rm -f ${DESTDIR}${MAN1}/$${man##*/}; done
for man in ${CONTRIB}; do rm -f ${DESTDIR}${MAN1}/$${man##*/}.1; done
+ rm -rf ${DESTDIR}${DOCDIR}
+ rm -f ${DESTDIR}${INFODIR}/cpt.info
clean:
- test "${DOCS}" != yes || ${MAKE} -C docs clean
+ ${MAKE} -C docs clean
rm -rf src/cpt-lib "cpt-${VERSION}.tar.xz" coverage report
rm -f tests/etc/cpt-hook
-.PHONY: all dist clean install uninstall
+allclean: clean
+ rm -f config.mk
+
+.PHONY: all dist allclean clean install uninstall shellspec shellcheck test
diff --git a/README b/README.md
index 6e78b2a..e5a5580 100644
--- a/README
+++ b/README.md
@@ -1,8 +1,15 @@
Carbs Packaging Tools
=====================
-Package management toolset for Carbs Linux. Forked from KISS[1]. All usage
-information can be obtained from the manual page. Refer to the ChangeLog[2] to
+ ##### #### #####
+ # # # # #
+ # #### #
+ # # # #
+ ##### # #
+
+
+Package management toolset for Carbs Linux. Forked from [KISS]. All usage
+information can be obtained from the manual page. Refer to the [ChangeLog] to
learn what's new.
@@ -36,10 +43,11 @@ either passing `DOCS=no` to `make` or editing `config.mk` to disable it.
Installation
------------
-In order to install CPT, you can run the following with `make`:
+In order to install CPT, you can run the following:
+ ./configure
make
- make PREFIX=/usr install
+ make install
Documentation
@@ -47,12 +55,12 @@ Documentation
The documentation for each tool along with some examples can be found on
manpages installed with the package manager. User manual of CPT can be found
-online[3], or installed as both plain-text and as info pages. Without any
+[online], or installed as both plain-text and as info pages. Without any
changes to the Makefile configuration those files can be found at:
- /usr/local/share/docs/cpt/cpt.txt
- /usr/local/share/info/cpt.info
-[1]: https://github.com/kisslinux/kiss
-[2]: https://fossil.carbslinux.org/cpt/log
-[3]: https://carbslinux.org/docs/cpt
+[KISS]: https://github.com/kisslinux/kiss
+[ChangeLog]: https://fossil.carbslinux.org/cpt/doc/trunk/CHANGELOG.md
+[online]: https://carbslinux.org/docs/cpt
diff --git a/config.mk b/config.mk
deleted file mode 100644
index a165463..0000000
--- a/config.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Carbs Packaging Tools
-VERSION = 6.1.1
-
-# Installation paths
-PREFIX = /usr/local
-BINDIR = ${PREFIX}/bin
-SHAREDIR = ${PREFIX}/share
-INFODIR = ${SHAREDIR}/info
-DOCDIR = ${SHAREDIR}/doc
-CPTDOC = ${DOCDIR}/cpt
-MANPREFIX = ${SHAREDIR}/man
-MAN1 = ${MANPREFIX}/man1
-
-EMACS = emacs
-MAKEINFO = makeinfo
-
-# Comment or change if you don't want to build/install the documentation
-DOCS = yes
diff --git a/configure b/configure
new file mode 100755
index 0000000..a2d0bba
--- /dev/null
+++ b/configure
@@ -0,0 +1,112 @@
+#!/bin/sh -e
+
+version=Fossil
+
+die() {
+ printf '%s: %s\n' "${0##*/}" "$*" >&2
+ exit 1
+}
+
+out() { printf '%s\n' "$@" ;}
+
+_check() {
+ for arg; do
+ printf 'checking for %s... ' "$arg"
+ command -v "$arg" || { out no; die "'$arg' not found" ;}
+ done
+}
+
+_check_multi() {
+ c=$1; shift
+ printf 'checking for %s... ' "$c"
+ for arg; do command -v "$arg" && return 0; done
+ out no; die "no $c was found"
+}
+
+usage() {
+ out "usage: $0 [options]" \
+ "Options:" \
+ " --prefix=dir Set prefix directory" \
+ " --bindir=dir User executables [PREFIX/bin]" \
+ " --datarootdir=dir Data root directory [PREFIX/share]" \
+ " --mandir=dir Manual pages [DATAROOTDIR/man]" \
+ " --infodir=dir info documentation [DATAROOTDIR/info]" \
+ " --docdir=dir Documentation directory [DATAROOTDIR/doc/cpt]" \
+ " --with-docs=opt Whether to build the texinfo documentation [auto]" "" \
+ " MAKEINFO Name of the 'makeinfo' executable" \
+ " EMACS Name of the 'emacs' executable" "" \
+ "Use these variables to override the behaviour of '$0'."
+ exit 1
+}
+
+prefix=/usr/local
+# We don't want expansion
+# shellcheck disable=2016
+{
+bindir='$(PREFIX)/bin'
+datarootdir='$(PREFIX)/share'
+mandir='$(DATAROOTDIR)/man'
+infodir='$(DATAROOTDIR)/info'
+docdir='$(DATAROOTDIR)/doc/cpt'
+}
+docs=auto
+
+for arg; do
+ case $arg in
+ -h|--help) usage ;;
+ --prefix=*) prefix=${arg#*=} ;;
+ --bindir=*) bindir=${arg#*=} ;;
+ --mandir=*) mandir=${arg#*=} ;;
+ --infodir=*) infodir=${arg#*=} ;;
+ --docdir=*) docdir=${arg#*=} ;;
+ --without-docs) docs=no ;;
+ --with-docs) docs=yes ;;
+ --with-docs=*) docs=${arg#*=} ;;
+ *-*) die "Unknown option: '$arg'" ;;
+ *=*) export "${arg:?}" ;;
+ *) die "Unknown argument: '$arg'"
+ esac
+done
+
+trap 'rm -f config.mk' EXIT
+trap 'rm -f config.mk; exit 1' INT
+
+: "${EMACS:=emacs}" "${MAKEINFO:=makeinfo}"
+
+out "starting configuration..."
+
+cat <<EOF > config.mk
+PREFIX = $prefix
+BINDIR = $bindir
+DATAROOTDIR = $datarootdir
+MANDIR = $mandir
+INFODIR = $infodir
+DOCDIR = $docdir
+MAN1 = \$(MANDIR)/man1
+
+VERSION = $version
+EMACS = $EMACS
+EOF
+
+case $docs in
+ auto|yes)
+ printf 'checking for makeinfo... '
+ if makeinfo=$(command -v "$MAKEINFO"); then
+ out "$makeinfo"
+ docs=yes
+ out "MAKEINFO = $makeinfo" >>config.mk
+ else
+ out no
+ [ "$docs" = yes ] && die "'$MAKEINFO' not found"
+ docs=no
+ fi
+esac
+[ "$docs" = no ] && out "not building documentation"
+out "DOCS = $docs" >>config.mk
+
+out "checking runtime dependencies"
+_check pax rsync sed awk grep b3sum
+_check_multi "sha256 provider" sha256sum sha256 openssl
+
+trap - EXIT INT
+out "written config.mk" "Run 'make' to build cpt"
diff --git a/contrib/cpt-chroot b/contrib/cpt-chroot
index 2f7eee7..a2ea151 100755
--- a/contrib/cpt-chroot
+++ b/contrib/cpt-chroot
@@ -1,22 +1,88 @@
#!/bin/sh -e
# Enter a chroot
+# shellcheck disable=2004
## SYNOPSIS:
## .Nm cpt-chroot
+## .Op Fl m
## .Op Ar dir
## DESCRIPTION:
## .Nm
## is a wrapper script to chroot inside other root filesystems. It automatically
## mounts important filesystems in to the chroot directory, and unmounts them
-## when the user exits the chroot and cleans up leftover host files.
+## when the user exits the chroot and cleans up leftover host files. If the flag
+## .Fl m
+## is given,
+## .Nm
+## does not try to mount or unmount any filesystems.
+
+# We generate the parser into the script, because we don't want this script to
+# depend on cpt-lib.
+nomount=''
+REST=''
+parse() {
+ OPTIND=$(($#+1))
+ while OPTARG= && [ $# -gt 0 ]; do
+ case $1 in
+ --?*=*) OPTARG=$1; shift
+ eval 'set -- "${OPTARG%%\=*}" "${OPTARG#*\=}"' ${1+'"$@"'}
+ ;;
+ --no-*) unset OPTARG ;;
+ -[mh]?*) OPTARG=$1; shift
+ eval 'set -- "${OPTARG%"${OPTARG#??}"}" -"${OPTARG#??}"' ${1+'"$@"'}
+ OPTARG= ;;
+ esac
+ case $1 in
+ '-m')
+ [ "${OPTARG:-}" ] && OPTARG=${OPTARG#*\=} && set "noarg" "$1" && break
+ eval '[ ${OPTARG+x} ] &&:' && OPTARG='1' || OPTARG=''
+ nomount="$OPTARG"
+ ;;
+ '-h'|'--help')
+ usage
+ exit 0 ;;
+ --)
+ shift
+ while [ $# -gt 0 ]; do
+ REST="${REST} \"\${$(($OPTIND-$#))}\""
+ shift
+ done
+ break ;;
+ [-]?*)
+ set "unknown" "$1"; break ;;
+ *)
+ REST="${REST} \"\${$(($OPTIND-$#))}\""
+ esac
+ shift
+ done
+ [ $# -eq 0 ] && { OPTIND=1; unset OPTARG; return 0; }
+ case $1 in
+ unknown) set "Unrecognized option: $2" "$@" ;;
+ noarg) set "Does not allow an argument: $2" "$@" ;;
+ required) set "Requires an argument: $2" "$@" ;;
+ pattern:*) set "Does not match the pattern (${1#*:}): $2" "$@" ;;
+ notcmd) set "Not a command: $2" "$@" ;;
+ *) set "Validation error ($1): $2" "$@"
+ esac
+ echo "$1" >&2
+ exit 1
+}
+usage() { printf '%s\n' "usage: ${0##*/} [-m] [dir]" "" "Options:" \
+ " -m Don't mount or unmount directories"
+}
+
+parser_definition() {
+ setup REST help:usage -- "usage: ${0##*/} [-m] [dir]"
+ msg -- '' 'Options:'
+ flag nomount -m -- "Don't mount or unmount directories"
+ disp :usage -h --help hidden:1
+}
log() {
printf '\033[32m->\033[m %s.\n' "$*"
}
-usage() { printf '%s [dir]\n' "${0##*/}"; exit 0;}
-
die() {
log "$*" >&2
exit 1
@@ -35,7 +101,7 @@ clean() {
}
main() {
- case "$1" in ''|--help|-h) usage; esac
+ parse "$@" && eval set -- "$REST"
[ -d "$1" ] || die Given path does not exist
[ "$(id -u)" = 0 ] || die Script needs to be run as root
@@ -48,17 +114,19 @@ main() {
esac
}
- trap 'clean "$1"' EXIT INT
+ [ -z "$nomount" ] && {
+ trap 'clean "$1"' EXIT INT
- log Mounting /dev, /proc and /sys from host; {
- mountpoint -q "$1/dev" || mount -o bind /dev "$1/dev"
- mountpoint -q "$1/proc" || mount -t proc proc "$1/proc"
- mountpoint -q "$1/sys" || mount -t sysfs sys "$1/sys"
+ log Mounting /dev, /proc and /sys from host; {
+ mountpoint -q "$1/dev" || mount -o bind /dev "$1/dev"
+ mountpoint -q "$1/proc" || mount -t proc proc "$1/proc"
+ mountpoint -q "$1/sys" || mount -t sysfs sys "$1/sys"
- }
+ }
- log Copying /etc/resolv.conf from host; {
- [ -f "$1/etc/resolv.conf" ] || cp /etc/resolv.conf "$1/etc"
+ log Copying /etc/resolv.conf from host; {
+ [ -f "$1/etc/resolv.conf" ] || cp /etc/resolv.conf "$1/etc"
+ }
}
log Entering chroot; {
diff --git a/contrib/cpt-size b/contrib/cpt-size
index 2812d56..4b983a1 100755
--- a/contrib/cpt-size
+++ b/contrib/cpt-size
@@ -11,40 +11,41 @@
## .Ar packages
## using the files from the package manifest and outputs a total size of the
## packages along with all the files associated with them.
+parser_definition() {
+ setup REST help:usage -- "usage: ${0##*/} [pkg...]"
+ disp :usage -h --help hidden:1
+}
-## CAVEATS:
-## .Nm
-## uses the non-POSIX
-## .Fl h
-## and
-## .Fl c
-## flags for
-## .Xr du 1 ,
-## which will not work with
-## .Em sbase ,
-## but it is a major performance improvement compared to calculating
-## total and human-readable sizes by hand.
+# shellcheck source=../src/cpt-lib
+# shellcheck disable=1091
+. cpt-lib
-case "$1" in
- --help|-h)
- printf '%s\n' "usage: ${0##*/} [pkg...]"
- exit 0
- ;;
- '') set -- "${PWD##*/}"
-esac
+# Ensure that all the packages given as arguments are installed.
+pkg_list "$@" >/dev/null
-for pkg; do cpt-list "$pkg" >/dev/null; done
+mkdir -p "$tmp_dir"
-files=
-for pkg; do
- while read -r file; do
- # Filter directories from manifest and leave only files.
- # Directories in the manifest end in a trailing '/'.
- case $file in */) continue; esac
- files="$files '$file'"
- done < "$CPT_ROOT/var/db/cpt/installed/$pkg/manifest"
-done
-eval "set -- $files"
+# We don't immediately pipe into awk as we want to exit in an error.
+for pkg; do sed '/\/$/d;s/./\\&/g' "$sys_db/$pkg/manifest"; done |
+ xargs du -k > "$tmp_dir/size"
-# Send the file list to 'du'.
-du -shc -- "$@" 2>/dev/null
+# This awk function formats the `du` output similar to the '-hc' flags. We
+# could have used a shell `while read` loop to do the exact same thing, but that
+# would be much much slower.
+awk 'function fmtsize(s) {
+ if (s==0) f=""
+ else if (s<1024) f="K"
+ else if (s<(1048576)){f="M";s=s/1024;}
+ else if (s<(1073741824)){f="G";s=s/1048576;}
+ else f=""
+ return int(s) f
+ }
+ {
+ sc = $1
+ size += $1
+ sub(sprintf("^%s\s*", $1), "")
+ printf("%-6s %s\n", fmtsize(sc), $0)
+ }
+ END {
+ printf("%-6s total\n", fmtsize(size))
+ }' "$tmp_dir/size"
diff --git a/docs/Makefile b/docs/Makefile
index 344bd70..3a7dbf0 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,5 +1,5 @@
# Carbs Packaging Tools Documentation
-include ../config.mk
+-include ../config.mk
INSTALL_SH = ../tools/install.sh
all: cpt.txt cpt.texi cpt.info
@@ -22,12 +22,4 @@ clean:
all-clean: clean
rm -f cpt.texi cpt.txt
-install: all
- ${INSTALL_SH} -Dm644 cpt.txt ${DESTDIR}${CPTDOC}/cpt.txt
- ${INSTALL_SH} -Dm644 cpt.info ${DESTDIR}${INFODIR}/cpt.info
-
-uninstall:
- rm -rf ${DESTDIR}${CPTDOC}
- rm -f ${DESTDIR}${INFODIR}/cpt.info
-
.PHONY: all clean all-clean install uninstall
diff --git a/docs/cpt.org b/docs/cpt.org
index 7496ec9..263c547 100644
--- a/docs/cpt.org
+++ b/docs/cpt.org
@@ -184,6 +184,11 @@ to provide detailed information.
#+VINDEX: CPT_DEBUG
If set to 1, temporary directories will not be removed after the operation.
+- ~CPT_DOWNLOADER~ ::
+
+ The tool to be used to download package sources. One of =curl=, =wget=,
+ =wget2=, =axel=, =aria2c=. Defaults to the first one found in that order.
+
- ~CPT_FETCH~ ::
#+VINDEX: CPT_FETCH
@@ -433,6 +438,21 @@ of the package maintainer. Everything in the package directory will also be
added to the package database that is located on =/var/db/cpt/installed=. These
can be patches, configuration files, etc.
+Below is a table that provides a small summary for each file, see the relevant
+section to learn detailed information on each of them.
+
+| File | Language | Executable | Mandatory |
+|--------------+------------------------------------+------------+-----------|
+| build | any | yes | yes |
+| checksums | generated by =cpt-checksum= | no | no |
+| meta | key-value pairs as in RFC822[fn:1] | no | no[fn:2] |
+| depends | custom format | no | no |
+| sources | custom format | no | no |
+| version | custom format | no | yes |
+| message | plaintext | no | no |
+| post-install | any | yes | no |
+| test | any | yes | no |
+
** build
:PROPERTIES:
:DESCRIPTION: The build script
@@ -506,7 +526,7 @@ the sha256 algorithm.
** version
:PROPERTIES:
-:DESCRIPTION: The file containing the version and the release numbers of a package
+:DESCRIPTION: The file containing version information for a package
:END:
The version file includes the version of the software and the release number of
@@ -1233,3 +1253,9 @@ MIT
* {{{index(Concept, cp)}}}
* {{{index(Variable,vr)}}}
+
+* Footnotes
+
+[fn:1] https://datatracker.ietf.org/doc/html/rfc822#section-3.2
+[fn:2] Not mandatory for the packaging system, but mandatory for inclusion in
+the repositories
diff --git a/docs/cpt.texi b/docs/cpt.texi
index 8bdcd99..7487209 100644
--- a/docs/cpt.texi
+++ b/docs/cpt.texi
@@ -77,7 +77,7 @@ Packaging System
* build:: The build script
* sources:: The file containing package sources
* checksums:: The file containing sha256sum of the sources
-* version:: The file containing the version and the release numbers of a package
+* version:: The file containing version information for a package
* depends:: The file containing the dependencies of a package
* meta:: File containing more information on packages
* post-install:: The post-installation script
@@ -299,6 +299,10 @@ set to 0, they will be forced to display them without colours. Otherwise,
@vindex CPT_DEBUG
If set to 1, temporary directories will not be removed after the operation.
+@item @code{CPT_DOWNLOADER}
+The tool to be used to download package sources. One of @samp{curl}, @samp{wget},
+@samp{wget2}, @samp{axel}, @samp{aria2c}. Defaults to the first one found in that order.
+
@item @code{CPT_FETCH}
@vindex CPT_FETCH
If set to 0, @code{cpt-update} will not fetch repositories.
@@ -559,11 +563,58 @@ of the package maintainer. Everything in the package directory will also be
added to the package database that is located on @samp{/var/db/cpt/installed}. These
can be patches, configuration files, etc.
+Below is a table that provides a small summary for each file, see the relevant
+section to learn detailed information on each of them.
+
+@multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaa} {aaaaaaaaa}
+@headitem File
+@tab Language
+@tab Executable
+@tab Mandatory
+@item build
+@tab any
+@tab yes
+@tab yes
+@item checksums
+@tab generated by @samp{cpt-checksum}
+@tab no
+@tab no
+@item meta
+@tab key-value pairs as in RFC822@footnote{@uref{https://datatracker.ietf.org/doc/html/rfc822#section-3.2}}
+@tab no
+@tab no@footnote{Not mandatory for the packaging system, but mandatory for inclusion in
+the repositories}
+@item depends
+@tab custom format
+@tab no
+@tab no
+@item sources
+@tab custom format
+@tab no
+@tab no
+@item version
+@tab custom format
+@tab no
+@tab yes
+@item message
+@tab plaintext
+@tab no
+@tab no
+@item post-install
+@tab any
+@tab yes
+@tab no
+@item test
+@tab any
+@tab yes
+@tab no
+@end multitable
+
@menu
* build:: The build script
* sources:: The file containing package sources
* checksums:: The file containing sha256sum of the sources
-* version:: The file containing the version and the release numbers of a package
+* version:: The file containing version information for a package
* depends:: The file containing the dependencies of a package
* meta:: File containing more information on packages
* post-install:: The post-installation script
diff --git a/docs/cpt.txt b/docs/cpt.txt
index 550a6a3..8934c15 100644
--- a/docs/cpt.txt
+++ b/docs/cpt.txt
@@ -244,6 +244,11 @@ development manual for *Carbs Packaging Tools*. For development logs see
If set to 1, temporary directories will not be removed after the
operation.
+ `CPT_DOWNLOADER'
+ The tool to be used to download package sources. One of `curl',
+ `wget', `wget2', `axel', `aria2c'. Defaults to the first one
+ found in that order.
+
`CPT_FETCH'
If set to 0, `cpt-update' will not fetch repositories.
@@ -480,6 +485,21 @@ development manual for *Carbs Packaging Tools*. For development logs see
on `/var/db/cpt/installed'. These can be patches, configuration files,
etc.
+ Below is a table that provides a small summary for each file, see the
+ relevant section to learn detailed information on each of them.
+
+ File Language Executable Mandatory
+ ----------------------------------------------------------------------
+ build any yes yes
+ checksums generated by `cpt-checksum' no no
+ meta key-value pairs as in RFC822[1] no no[2]
+ depends custom format no no
+ sources custom format no no
+ version custom format no yes
+ message plaintext no no
+ post-install any yes no
+ test any yes no
+
5.1 build
~~~~~~~~~
@@ -1300,3 +1320,13 @@ development manual for *Carbs Packaging Tools*. For development logs see
[meta file] See section 5.6
+
+
+
+Footnotes
+_________
+
+[1] <https://datatracker.ietf.org/doc/html/rfc822#section-3.2>
+
+[2] Not mandatory for the packaging system, but mandatory for
+inclusion in the repositories
diff --git a/man/cpt-checksum.1 b/man/cpt-checksum.1
index 4c637eb..bfced46 100644
--- a/man/cpt-checksum.1
+++ b/man/cpt-checksum.1
@@ -5,15 +5,27 @@
.Nd generate checksums
.Sh SYNOPSIS
.Nm
+.Op Fl s
.Op Ar package...
.Sh DESCRIPTION
.Nm
-lints a package, downloads the sources, and creates a checksum file
-including the SHA256 digests of the sources. If no
+lints a package, downloads the sources, and creates a file named
+.Sq checksums
+which includes the
+.Em BLAKE3
+digests of the sources. If no
.Ar package
is specified,
.Nm
will generate checksums assuming the working directory as the package.
+.Pp
+If the
+.Fl s
+flag is given,
+.Nm
+will generate checksums using the
+.Em SHA256
+algorithm.
.Sh AUTHOR
.An Cem Keylan Aq Mt cem@ckyln.com
.Sh LICENSE
diff --git a/spec/01_lib_spec.sh b/spec/01_lib_spec.sh
index 113d517..b56ac32 100644
--- a/spec/01_lib_spec.sh
+++ b/spec/01_lib_spec.sh
@@ -14,7 +14,7 @@ Describe 'CPT Library'
VERSION=$(sed -n '/VERSION/s/.* //gp' config.mk)
It 'prints version information'
When run script src/cpt-lib version
- The stderr should eq "-> Carbs Packaging Tools $VERSION"
+ The line 1 of stdout should eq "Carbs Packaging Tools, version $VERSION"
End
End
Describe 'text functions'
diff --git a/spec/02_src_spec.sh b/spec/02_src_spec.sh
index 4685ec1..be81775 100644
--- a/spec/02_src_spec.sh
+++ b/spec/02_src_spec.sh
@@ -13,7 +13,7 @@ Describe 'Main toolchain'
VERSION=$(sed -n '/VERSION/s/.* //gp' config.mk)
It 'outputs cpt version'
When run script src/cpt --version
- The stderr should eq "-> Carbs Packaging Tools $VERSION"
+ The line 1 of stdout should eq "Carbs Packaging Tools, version $VERSION"
End
End
diff --git a/src/cpt-build b/src/cpt-build
index cb93949..4eccbd1 100755
--- a/src/cpt-build
+++ b/src/cpt-build
@@ -2,7 +2,7 @@
# Build a package
parser_definition() {
- setup REST help:usage -- "usage: ${0##*/} [pkg...]"
+ setup REST help:usage -- "usage: ${0##*/} [-tfy] [--root ROOT] [pkg...]"
msg -- '' 'Options:'
flag CPT_TEST -t --test export:1 init:@export -- "Run tests (if they exist)"
global_options
diff --git a/src/cpt-checksum b/src/cpt-checksum
index 5c6de52..488ab87 100755
--- a/src/cpt-checksum
+++ b/src/cpt-checksum
@@ -1,22 +1,32 @@
#!/bin/sh -ef
# Generate checksums
-if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
+parser_definition() {
+ setup REST help:usage -- "usage: ${0##*/} [-s] [pkg...]"
+ msg -- '' 'Options:'
+ flag sha -s -- "Generate checksums using the depracated sha256 algorithm"
+ global_options
+}
-case "$1" in
- --help|-h) out "usage: ${0##*/} [pkg...]"; exit 0 ;;
- --version|-v) version ;;
- '') set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;;
-esac
+if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
+[ "$1" ] || { set -- "${PWD##*/}"; CPT_PATH=${PWD%/*}:$CPT_PATH ;}
create_cache
for pkg; do pkg_lint "$pkg" c; done
for pkg; do pkg_sources "$pkg" c; done
-
for pkg; do
- pkg_checksums "$pkg" | {
- repo_dir=$(pkg_find "$pkg")
+ # Do not generate checksums if the 'sources' file is empty or it doesn't
+ # exist.
+ repo_dir=$(pkg_find "$pkg")
+ [ -s "$repo_dir/sources" ] || {
+ log "$pkg" "No 'sources' file, skipping checksums"
+ continue
+ }
+
+ # $sha is defined by the parser.
+ # shellcheck disable=2154
+ pkg_checksums "$pkg" "${sha:+sh256}" | {
if [ -w "$repo_dir" ]; then
tee "$repo_dir/checksums"
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 7514608..c055331 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -9,7 +9,9 @@
# Currently maintained by Cem Keylan.
version() {
- log "Carbs Packaging Tools" @VERSION@
+ out "Carbs Packaging Tools, version @VERSION@" \
+ @LICENSE@
+
exit 0
}
@@ -154,6 +156,22 @@ _readlinkf() (
return 1
)
+_get_digest() {
+ # Get digest algorithm from the given file. It looks for a header on the
+ # file declaring the digest algorithm. Currently only BLAKE3 is supported.
+ # If the file does not include a header, the function will assume that it is
+ # using sha256 as a digest algorithm. If the given file doesn't exist it will
+ # return 1.
+ [ -r "$1" ] || return 1
+ read -r chk < "$1"
+ case $chk in
+ %BLAKE3) chk=b3sum ;;
+ %*) die "Unknown digest algorithm: '${chk#\%}'" ;;
+ *) chk=sh256
+ esac
+ out "$chk"
+}
+
# This is the public domain getoptions shell library. It also forms a usage
# function.
# URL: https://github.com/ko1nksm/getoptions (v2.5.0)
@@ -419,6 +437,21 @@ regesc() {
sed 's|\\|\\\\|g;s|\[|\\[|g;s|\$|\\$|g;s|\.|\\.|g;s|\*|\\*|g;s|\^|\\^|g'
}
+pkg_download() {
+ # $1: URL
+ # $2: Output (Optional)
+ set -- "$1" "${2:-${1##*/}}"
+ case ${dl_prog##*/} in
+ aria2c|axel) set -- -o "$2" "$1" ;;
+ curl) set -- -fLo "$2" "$1" ;;
+ wget|wget2) set -- -O "$2" "$1" ;;
+ esac
+
+ "$dl_prog" "$@" || {
+ rm -f "$2"
+ return 1
+ }
+}
prompt() {
# If a CPT_NOPROMPT variable is set, continue.
@@ -688,10 +721,8 @@ pkg_sources() {
# interrupt, we handle this ourselves.
trap_set handle-int
- curl "$src" -fLo "${src##*/}" || {
- rm -f "${src##*/}"
- die "$1" "Failed to download $src"
- }
+ # Download the source
+ pkg_download "$src" || die "$1" "Failed to download $src"
# Restore original trap value.
trap_set cleanup
@@ -968,10 +999,16 @@ pkg_etcsums() (
# /etc/ directory for use in "smart" handling of these files.
log "$1" "Generating etcsums"
+ # Try to get the digest algorithm from the installed etcsums file. This
+ # makes sure that old packages continue to have the same digest algorithm
+ # and not a bunch of '.new' files are installed. It's not foolproof at all,
+ # but at least it keeps the /etc directory as clean as possible.
+ digest=$(_get_digest "$sys_db/$1/etcsums") || digest=b3sum
+ case $digest in b3sum) out "%BLAKE3"; esac > "$pkg_dir/$1/$pkg_db/$1/etcsums"
find etc -type f | while read -r file; do
- sh256 "$file"
- done > "$pkg_dir/$1/$pkg_db/$1/etcsums"
+ "$digest" "$file"
+ done >> "$pkg_dir/$1/$pkg_db/$1/etcsums"
)
pkg_tar() {
@@ -1192,6 +1229,8 @@ pkg_checksums() {
[ -f "$repo_dir/sources" ] || return 0
+ case ${2:-b3sum} in b3sum) out "%BLAKE3"; esac
+
while read -r src _ || [ "$src" ]; do
# Skip checksums if it's a comment, or a VCS repository.
@@ -1210,9 +1249,9 @@ pkg_checksums() {
die "$1" "Couldn't find source '$src'"
fi
- # An easy way to get 'sha256sum' to print with the 'basename'
+ # An easy way to get 'b3sum' to print with the 'basename'
# of files is to 'cd' to the file's directory beforehand.
- (cd "$src_path" && sh256 "${src##*/}") ||
+ (cd "$src_path" && "${2:-b3sum}" "${src##*/}") ||
die "$1" "Failed to generate checksums"
done < "$repo_dir/sources"
}
@@ -1220,13 +1259,18 @@ pkg_checksums() {
pkg_verify() {
# Verify all package checksums. This is achieved by generating a new set of
# checksums and then comparing those with the old set.
- verify_cmd="NR==FNR{a[\$1];next}/^git .*/{next}!((\$1)in a){exit 1}"
+ vcmd="NR==FNR{a[\$1];next}/^git .*/{next}!((\$1)in a){exit 1}"
for pkg; do
repo_dir=$(pkg_find "$pkg")
+
[ -f "$repo_dir/sources" ] || continue
- pkg_checksums "$pkg" | awk "$verify_cmd" - "$repo_dir/checksums" || {
+ # Determine the type of digest algorithm from the checksums file to do
+ # verification with.
+ digest="$(_get_digest "$repo_dir/checksums")"
+
+ pkg_checksums "$pkg" "$digest" | awk "$vcmd" - "$repo_dir/checksums" || {
log "$pkg" "Checksum mismatch"
# Instead of dying above, log it to the terminal. Also define a
@@ -1405,10 +1449,12 @@ pkg_etc() {
mkdir -p "$CPT_ROOT/$dir"
done
+ digest=$(_get_digest "$mak_dir/c") || digest=b3sum
+
# Handle files in /etc/ based on a 3-way checksum check.
find etc ! -type d | while read -r file; do
- { sum_new=$(sh256 "$file")
- sum_sys=$(cd "$CPT_ROOT/"; sh256 "$file")
+ { sum_new=$("$digest" "$file")
+ sum_sys=$(cd "$CPT_ROOT/"; "$digest" "$file")
sum_old=$("$grep" "$file$" "$mak_dir/c"); } 2>/dev/null ||:
logv "$pkg_name" "Doing 3-way handshake for $file"
@@ -2117,6 +2163,15 @@ create_cache() {
command -v llvm-readelf ||
command -v eu-readelf)"} || elf_prog=ldd
+ # Use one of the following programs to download package sources. Downloads
+ # are made using the `pkg_download()` function.
+ dl_prog=${CPT_DOWNLOADER:="$(
+ command -v curl ||
+ command -v wget ||
+ command -v wget2 ||
+ command -v axel ||
+ command -v aria2c)"} || dl_prog=curl
+
# Make note of the user's current ID to do root checks later on.
# This is used enough to warrant a place here.
uid=$(id -u)
diff --git a/tools/mkdist.sh b/tools/mkdist.sh
index bcf1caf..98f985c 100755
--- a/tools/mkdist.sh
+++ b/tools/mkdist.sh
@@ -27,6 +27,5 @@ done
cp docs/cpt.info "$basedir/docs/cpt.info"
-tar cf "$basedir.tar" "$basedir"
-xz -z "$basedir.tar"
+pax -w "$basedir" | xz -zT 0 > "$basedir.tar.xz"
rm -rf -- "$basedir"
diff --git a/www/index.md b/www/index.md
index 0c55e80..99ad599 100644
--- a/www/index.md
+++ b/www/index.md
@@ -32,7 +32,7 @@ complements the tools that come with it. It has the following features:
<hr>
-### Latest Release: 6.0.4 ([2021-05-12](/timeline?c=6.0.4))
+### Latest Release: 6.1.0 ([2021-07-22](/timeline?c=6.1.0))
- [Download](/uvlist?byage=1)
- [Changelog](/doc/trunk/CHANGELOG.md)