diff options
-rw-r--r-- | .build.yml | 1 | ||||
-rw-r--r-- | CHANGELOG.md | 35 | ||||
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rwxr-xr-x | contrib/cpt-size | 27 | ||||
-rw-r--r-- | docs/cpt.org | 7 | ||||
-rw-r--r-- | docs/cpt.texi | 12 | ||||
-rw-r--r-- | docs/cpt.txt | 16 | ||||
-rw-r--r-- | man/cpt-build.1 | 12 | ||||
-rw-r--r-- | spec/01_lib_spec.sh | 59 | ||||
-rw-r--r-- | spec/02_src_spec.sh | 9 | ||||
-rw-r--r-- | spec/03_contrib_spec.sh | 9 | ||||
-rwxr-xr-x | src/cpt | 63 | ||||
-rwxr-xr-x | src/cpt-build | 7 | ||||
-rw-r--r-- | src/cpt-lib.in | 157 | ||||
-rw-r--r-- | www/index.md | 4 |
16 files changed, 338 insertions, 87 deletions
@@ -4,6 +4,7 @@ packages: - gcc - bison - curl + - fossil - rsync - emacs-nox - texinfo diff --git a/CHANGELOG.md b/CHANGELOG.md index e3ce638..e7ee439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,28 @@ this project _somewhat_ adheres to [Semantic Versioning]. [Semantic Versioning]: https://semver.org/spec/v2.0.0.html -[UNRELEASED] +[7.0.2] - 2023-02-05 +-------------------------------------------------------------------------------- + +### Fixed +- Fixed a bug that caused extra dependencies being added to the later packages + during multi-package build operations. +- Fixed file attribute issue with the `_tmp_cp()` function causing modified + dependency files to receive `600` permission bits. + + +[7.0.1] - 2023-02-05 +-------------------------------------------------------------------------------- + +### Fixed +- Made the `_tsort()` function compatible with POSIX +- Fixed dependency calculation issue in `pkg_depends()` where some packages + would be removed. +- Fixed `pkg_gentree()` not generating the dependency tree due to the dependency + calculation changes. + + +[7.0.0] - 2023-01-31 -------------------------------------------------------------------------------- ### Configuration Directory @@ -38,12 +59,24 @@ this project _somewhat_ adheres to [Semantic Versioning]. - Added new hooks: `end-install` and `end-remove` that are run when installation/removal is complete (not per-package). +### Added +- `cpt-size` can now sort files based on size. +- `$CPT_NOSTRIP` variable can now be set to 1 in order to disable package + stripping. Make sure to add `-g` to your CFLAGS in order to keep debugging + symbols. +- `cpt-build` now accepts `-d` and `-S` options to enable `$CPT_DEBUG` and + `$CPT_NOSTRIP` respectively. + ### Changed - `cpt-update` is now re-entrant, meaning that it is no longer needed to run the update twice, `cpt-update` will continue the updates with the new version of itself. - The package manager now can handle circular dependencies and exit gracefully. +### Fixed +- Fixed the behaviour of `cpt bi` and `cpt cbi` by merging the flag usage. +- Fixed the `aria2c` usage on `pkg_download()` function. + ### Library - In order to get the `$deps` variable, one now has to use the new `pkg_depends_commit()` function. @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020-2022 Cem Keylan +Copyright (c) 2020-2023 Cem Keylan Copyright (c) 2019-2020 Dylan Araps Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,7 +22,10 @@ shellspec: all tests/etc/cpt-hook shellspec shellcheck: all - cd src; find . ../contrib -name 'cpt*' ! -name '*.*' -exec shellcheck -e 2119 -x -f gcc {} + + @cd src; find . ../contrib -name 'cpt*' ! -name '*.*' | while read -r file; do \ + echo SHELLCHECK "$$file"; \ + shellcheck -e 2119 -x -f gcc "$$file"; \ + done test: shellspec shellcheck diff --git a/contrib/cpt-size b/contrib/cpt-size index 00508b8..22a77b7 100755 --- a/contrib/cpt-size +++ b/contrib/cpt-size @@ -3,6 +3,7 @@ ## SYNOPSIS: ## .Nm +## .Op Fl st ## .Op Ar pkg... ## DESCRIPTION: @@ -14,8 +15,17 @@ ## been given, ## .Nm ## will use the name of the current directory as an argument. +## .Pp +## The options are as follows: +## .Bl -tag -width 13n +## .It Fl s +## Sort the output by size. +## .It Fl t +## Output only the size of given packages and not individual files. parser_definition() { - setup REST help:usage -- "usage: ${0##*/} [pkg...]" + setup REST help:usage -- "usage: ${0##*/} [-st] [pkg...]" + flag sort -s hidden:1 + flag total -t hidden:1 disp :usage -h --help hidden:1 } @@ -32,8 +42,19 @@ pkg_list "$@" >/dev/null mkdir -p "$tmp_dir" # 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" +if [ "$total" ]; then + for pkg; do + sed '/\/$/d;s/./\\&/g' "$sys_db/$pkg/manifest" | + xargs du -k | + awk -v name="$pkg" '{size+=$1}END{printf("%s %s\n", size, name)}' >> "$tmp_dir/size" + done +else + for pkg; do sed '/\/$/d;s/./\\&/g' "$sys_db/$pkg/manifest"; done | + xargs du -k > "$tmp_dir/size" +fi + +# Do a numerical sort on the file if requested. +[ "$sort" ] && sort -no "$tmp_dir/size" "$tmp_dir/size" # 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 diff --git a/docs/cpt.org b/docs/cpt.org index 3896909..b3fc97b 100644 --- a/docs/cpt.org +++ b/docs/cpt.org @@ -235,6 +235,13 @@ to provide detailed information. #+VINDEX: CPT_KEEPLOG If set to 1, =cpt= will keep logs regardless of operation success. +- ~CPT_NOSTRIP~ :: + + #+VINDEX: CPT_NOSTRIP + If set to 1, =cpt= will not strip debug information from the binaries. Keep in + mind that your compiler already strips most debug information during + compilation, so you also need to add ~-g~ flag to your ~$C{XX}FLAGS~ + - ~CPT_PID~ :: #+VINDEX: CPT_PID diff --git a/docs/cpt.texi b/docs/cpt.texi index 5c792a9..e6b331c 100644 --- a/docs/cpt.texi +++ b/docs/cpt.texi @@ -357,6 +357,12 @@ Absolute path to the package manager hook file. @vindex CPT_KEEPLOG If set to 1, @samp{cpt} will keep logs regardless of operation success. +@item @code{CPT_NOSTRIP} +@vindex CPT_NOSTRIP +If set to 1, @samp{cpt} will not strip debug information from the binaries. Keep in +mind that your compiler already strips most debug information during +compilation, so you also need to add @code{-g} flag to your @code{$C@{XX@}FLAGS} + @item @code{CPT_PID} @vindex CPT_PID Set the temporary build directory name. @@ -416,7 +422,7 @@ This example brings us to the next section of this document. @enumerate @item -Repository preferences +@anchor{Repository preferences}Repository preferences @cindex package conflicts @@ -434,7 +440,7 @@ CPT_PATH=$HOME/repos/personal:$HOME/repos/carbs/extra @end example @item -Setting the @samp{CPT_PATH} +@anchor{Setting the @samp{CPT_PATH}}Setting the @samp{CPT_PATH} You can set the @samp{CPT_PATH} variable on your shell configuration or your @@ -1515,7 +1521,7 @@ Print all packages in a single line instead of a package per line. @enumerate @item -Examples +@anchor{Examples}Examples This example uses the @samp{cpt} package for Carbs Linux. The package itself is diff --git a/docs/cpt.txt b/docs/cpt.txt index c89f02a..08433e9 100644 --- a/docs/cpt.txt +++ b/docs/cpt.txt @@ -1,10 +1,10 @@ - _______________________ + _______________________ - CARBS PACKAGING TOOLS - User Manual + CARBS PACKAGING TOOLS + User Manual - Cem Keylan - _______________________ + Cem Keylan + _______________________ Table of Contents @@ -295,6 +295,12 @@ development logs see [the fossil repository]. If set to 1, `cpt' will keep logs regardless of operation success. + `CPT_NOSTRIP' + If set to 1, `cpt' will not strip debug information from the + binaries. Keep in mind that your compiler already strips most + debug information during compilation, so you also need to add + `-g' flag to your `$C{XX}FLAGS' + `CPT_PID' Set the temporary build directory name. diff --git a/man/cpt-build.1 b/man/cpt-build.1 index a897bbe..ec65eeb 100644 --- a/man/cpt-build.1 +++ b/man/cpt-build.1 @@ -5,7 +5,7 @@ .Nd build given packages .Sh SYNOPSIS .Nm cpt-build -.Op Fl tfy +.Op Fl dfSty .Op Fl -root Ar ROOT .Op Fl hv .Op Ar package... @@ -21,8 +21,18 @@ package. .Pp The options are as follows: .Bl -tag -width 13n +.It Fl d , -debug +Keep the build directories after operation .It Fl t , -test Run tests (if they exist) +.It Fl S , -nostrip +Don't strip debug information from the binaries +.Po +might want to add +.Fl g +to your +.Ev $CFLAGS +.Pc .It Fl f , -force Force operation .It Fl y , -no-prompt diff --git a/spec/01_lib_spec.sh b/spec/01_lib_spec.sh index 6612618..b7d83f3 100644 --- a/spec/01_lib_spec.sh +++ b/spec/01_lib_spec.sh @@ -112,16 +112,16 @@ Describe 'CPT Library' Describe '_readlinkf()' mklink() { :> tests/testfile; ln -s testfile tests/testfile2 ;} - rmlink() { rm -f tests/testfile tests/testfile2 ;} + rmlink() { rm tests/testfile tests/testfile2 ;} RPWD=$(cd -P .||:; printf %s "$PWD") - Before mklink - After rmlink + BeforeEach mklink + AfterEach rmlink Parameters "#1" . "$RPWD" - "#2" "$PWD/tests/testfile2" "$RPWD/tests/testfile" + "#2" "./tests/testfile2" "$RPWD/tests/testfile" End - It "outputs the real location of the given file ($1)" - When call _readlinkf "$2" + It "outputs the real location of the given file [$1] ($2 -> $3)" + When run _readlinkf "$2" The output should eq "$3" End End @@ -151,6 +151,53 @@ Describe 'CPT Library' End End + Describe 'version control functions' + check_internet_connection() { ! curl -L git.carbslinux.org >/dev/null 2>&1 ;} + Skip if "no internet connection" check_internet_connection + Describe 'pkg_vcs_clone_git()' + tmpfos=$$ + setup() { mkdir "/tmp/test_repository.$tmpfos" && cd "/tmp/test_repository.$tmpfos" || return ;} + cleanup() { cd /tmp && rm -rf "test_repository.$tmpfos" ;} + check_version() { [ "$1" = "$(sed -n '/^version=/s/.*=//p' configure)" ] ;} + BeforeEach setup + AfterEach cleanup + It "clones the given git repository to the current directory" + When call pkg_vcs_clone_git https://git.carbslinux.org/cpt + The output should not eq "" + The stderr should not eq "" + The status should be success + Assert [ ! -d test_repository ] + Assert [ -f README.md ] + Assert check_version Fossil + End + It "clones the given tag when asked for it" + When call pkg_vcs_clone_git https://git.carbslinux.org/cpt @6.2.4 + The output should not eq "" + The stderr should not eq "" + The status should be success + Assert [ ! -d test_repository ] + Assert [ -f README.md ] + Assert check_version 6.2.4 + End + End + Describe 'pkg_vcs_clone_fossil()' + tmpfos=$$ + setup() { mkdir "/tmp/test_repository.$tmpfos" && cd "/tmp/test_repository.$tmpfos" || return ;} + cleanup() { cd /tmp && rm -rf "test_repository.$tmpfos" ;} + check_version() { [ "$1" = "$(sed -n '/^version=/s/.*=//p' configure)" ] ;} + BeforeEach setup + AfterEach cleanup + It "clones the given fossil repository to the current directory" + When call pkg_vcs_clone_fossil https://fossil.carbslinux.org/cpt + The output should not eq "" + The stderr should eq "" + The status should be success + Assert [ ! -d test_repository ] + Assert [ -f README.md ] + Assert check_version Fossil + End + End + End Describe 'package functions' Describe 'run_hook()' CPT_HOOK=$PWD/tests/hook-file diff --git a/spec/02_src_spec.sh b/spec/02_src_spec.sh index 5286ab9..2c20849 100644 --- a/spec/02_src_spec.sh +++ b/spec/02_src_spec.sh @@ -1,7 +1,8 @@ Describe 'Main toolchain' - export PATH=$PWD/src:$PATH - export CPT_ROOT=$PWD/tests/02 - export CPT_PATH=$PWD/tests/repository + PATH=$PWD/src:$PATH + CPT_ROOT=$PWD/tests/02 + CPT_PATH=$PWD/tests/repository + export PATH CPT_ROOT CPT_PATH install_dummy() { CPT_HOOK='' ./src/cpt bi dummy-pkg >/dev/null 2>&1 ;} remove_dummy() { rm -rf "${CPT_ROOT:?}/var" ;} BeforeAll install_dummy @@ -52,7 +53,7 @@ Describe 'Main toolchain' It "expands the '$1' shortcut to '$2'" When run script src/cpt "$1" --help The status should be success - The word 2 of line 1 should eq "cpt-${2%% *}" + The word 3 of line 1 should eq "$1" End End End diff --git a/spec/03_contrib_spec.sh b/spec/03_contrib_spec.sh index d9fcd30..b3d6df4 100644 --- a/spec/03_contrib_spec.sh +++ b/spec/03_contrib_spec.sh @@ -1,8 +1,9 @@ Describe 'contrib scripts' - export PATH=$PWD/src:$PWD/contrib:$PATH - export CPT_ROOT=$PWD/tests/03 - export CPT_PATH=$PWD/tests/repository - export CPT_COMPRESS='' + PATH=$PWD/src:$PWD/contrib:$PATH + CPT_ROOT=$PWD/tests/03 + CPT_PATH=$PWD/tests/repository + CPT_COMPRESS='' + export PATH CPT_ROOT CPT_PATH CPT_COMPRESS install_tmp() { CPT_HOOK='' ./src/cpt b -y contrib-dummy-pkg >/dev/null 2>&1 CPT_HOOK='' ./src/cpt-install -y contrib-dummy-pkg >/dev/null 2>&1 @@ -1,5 +1,52 @@ #!/bin/sh -ef +bi() { + # Build and install function for cpt. + # + # shellcheck disable=2317 + parser_definition() { + setup REST help:usage -- "usage: ${0##*/} bi [-dfSty] [--root ROOT] [pkg...]" + msg -- '' 'Options:' + flag CPT_TEST -t --test export:1 init:@export -- "Run tests (if they exist)" + flag CPT_DEBUG -d --debug export:1 init:@export -- "Keep the build directories after operation" + flag CPT_NOSTRIP -S --nostrip export:1 init:@export -- "Don't strip debug information from the binaries" \ + "(might want to add '-g' to your '\$CFLAGS')" + global_options + } + + eval "$(getoptions parser_definition parse "$0")" + parse "$@" + eval set -- "$REST" + cpt-build "$@" + + # When building multiple packages, cpt will already ask to install + # the packages, so no need for this here. + [ "$2" ] || cpt-install "$@" +} + +cbi() { + # Checksum, build and install. + # + # shellcheck disable=2317 + parser_definition() { + setup REST help:usage -- "usage: ${0##*/} cbi [-dfSsty] [--root ROOT] [pkg...]" + msg -- '' 'Options:' + flag CPT_TEST -t --test export:1 init:@export -- "Run tests (if they exist)" + flag CPT_DEBUG -d --debug export:1 init:@export -- "Keep the build directories after operation" + flag CPT_NOSTRIP -S --nostrip export:1 init:@export -- "Don't strip debug information from the binaries" \ + "(might want to add '-g' to your '\$CFLAGS')" + flag sha -s -- "Generate checksums using the depracated sha256 algorithm" + global_options + } + + eval "$(getoptions parser_definition parse "$0")" + parse "$@" + eval set -- "$REST" + + cpt-checksum "$@"; cpt-build "$@" + [ "$2" ] || cpt-install "$@" +} + if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi # If none of the tools below are specified, we will reenable glob @@ -35,21 +82,7 @@ case "$arg" in r|remove) arg=remove ;; s|search) arg=search ;; u|update) arg=update ;; - bi) - # Build and install function for cpt. - cpt-build "$@" - - # When building multiple packages, cpt will already ask to install - # the packages, so no need for this here. - [ "$2" ] || cpt-install "$@" - exit - ;; - cbi) - # Checksum, build and install. - cpt-checksum "$@"; cpt-build "$@" - [ "$2" ] || cpt-install "$@" - exit - ;; + bi|cbi) "$arg" "$@"; exit "$?" ;; *) glob=1 ;; esac diff --git a/src/cpt-build b/src/cpt-build index 03a33b7..eaf8849 100755 --- a/src/cpt-build +++ b/src/cpt-build @@ -2,9 +2,12 @@ # Build a package parser_definition() { - setup REST help:usage -- "usage: ${0##*/} [-tfy] [--root ROOT] [pkg...]" + setup REST help:usage -- "usage: ${0##*/} [-dfSty] [--root ROOT] [pkg...]" msg -- '' 'Options:' - flag CPT_TEST -t --test export:1 init:@export -- "Run tests (if they exist)" + flag CPT_DEBUG -d --debug export:1 init:@export -- "Keep the build directories after operation" + flag CPT_TEST -t --test export:1 init:@export -- "Run tests (if they exist)" + flag CPT_NOSTRIP -S --nostrip export:1 init:@export -- "Don't strip debug information from the binaries" \ + "(might want to add '-g' to your '\$CFLAGS')" global_options } diff --git a/src/cpt-lib.in b/src/cpt-lib.in index 9b71eab..1896920 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -88,32 +88,100 @@ _tsort() { # but the specification is quite vague, it doesn't specify cycles as a # reason of error, and implementations differ on how it's handled. coreutils # tsort(1) exits with an error, while openbsd tsort(1) doesn't. Both - # implementations are correct according to the specification. This leaves us - # with the following awk script, because the POSIX shell is not up for the - # job without super ugly hacks. - awk 'function fv(s) { - for (sp in e) { - split (e[sp],t) - for (j in t) if (s == t[j]) return 0 - } return 1 + # implementations are correct according to the specification. + # + # The script below was taken from <https://gist.github.com/apainintheneck/1803fb91dde3ba048ec51d44fa6065a4> + # + # The MIT License (MIT) + # Copyright (c) 2023 Kevin Robell + # + # Permission is hereby granted, free of charge, to any person obtaining a + # copy of this software and associated documentation files (the “Software”), + # to deal in the Software without restriction, including without limitation + # the rights to use, copy, modify, merge, publish, distribute, sublicense, + # and/or sell copies of the Software, and to permit persons to whom the + # Software is furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included in + # all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + # DEALINGS IN THE SOFTWARE. + awk '{ + for (i = 1; i <= NF; ++i) { + # Store each node. + nodes[$i] = 1 + if (is_child) { + child = $i + # Skip nodes that point to themselves. + # This traditionally means that the node + # is disconnected from the rest of the graph. + if (parent != child) { + # Store from parent to child. + idx = ++child_count[parent] + child_graph[parent, idx] = child + # Store count from child to parent. + ++parent_count[child] + } + } else { + parent = $i + } + # Flip switch + is_child = !is_child + } } - function el(_l) {for(i in e){_l=_l" "i;}; return _l;} - function ce(t) {if (!(t in e)) e[t]="";} - function err(s) {print "Dependency cycle deteced between: " s; exit 1;} - {ce($1);$1!=$2&&e[$1]=e[$1]" "$2;} END { - do {p=el() - for (s in e) { - if (fv(s)) { - pr=s" "pr - split(e[s],t) - for(i in t){ce(t[i]);} - delete e[s] + # Print errors to the stderr + stderr = "/dev/stderr" + + # Sanity Check + if (is_child) { + print("Error: odd number of input values: expected pairs of values") > stderr + exit(1) + } + + ##### + # Topological Sort + ##### + + # Remove unconnected nodes first. + for (node in nodes) { + if (parent_count[node] == 0 && child_count[node] == 0) { + delete nodes[node] + print(node) + } + } + + # Remove the rest of the nodes starting with those without parents. + while (length(nodes) > 0) { + removed_node = 0 + for (node in nodes) { + # Delete and print nodes without any remaining parents. + if (parent_count[node] == 0) { + delete nodes[node] + removed_node = 1 + # Decrease child_count for each parent node. + for (i = child_count[node]; i > 0; --i) { + child = child_graph[node, i] + --parent_count[child] + } + print(node) } - } c=el() - } while (p != c) - if (length(p)!=0) err(p); - print pr + } + + # If we havent removed any nodes, it means that there + # are no nodes without any remaining parents so we have + # a cycle. + if (!removed_node) { + print("Error: Cycle found") > stderr + exit(1) + } + } }' } @@ -172,7 +240,7 @@ _stat() ( printf '%s' "$_user" ) -_readlinkf() ( +_readlinkf() { # Public domain POSIX sh readlink function by Koichi Nakashima [ "${1:-}" ] || return 1 max_symlinks=40 @@ -206,7 +274,7 @@ _readlinkf() ( target=${link#*" $target -> "} done return 1 -) +} _get_digest() { # Get digest algorithm from the given file. It looks for a header on the @@ -228,7 +296,7 @@ _get_digest() { # function. # URL: https://github.com/ko1nksm/getoptions (v2.5.0) # License: Creative Commons Zero v1.0 Universal -# shellcheck disable=2016,2086 +# shellcheck disable=2016,2086,2317 getoptions() { _error='' _on=1 _off='' _export='' _plus='' _mode='' _alt='' _rest='' _flags='' _nflags='' _opts='' _help='' _abbr='' _cmds='' _init=@empty IFS=' ' @@ -423,6 +491,7 @@ getoptions() { } # URL: https://github.com/ko1nksm/getoptions (v2.5.0) # License: Creative Commons Zero v1.0 Universal +# shellcheck disable=2317 getoptions_help() { _width='30,12' _plus='' _leading=' ' @@ -512,11 +581,12 @@ regesc() { pkg_download() { # $1: URL # $2: Output (Optional) - set -- "$1" "${2:-${1##*/}}" + set -- "$1" "$(_readlinkf "${2:-${1##*/}}")" case ${dl_prog##*/} in - aria2c|axel) set -- -o "$2" "$1" ;; - curl) set -- -fLo "$2" "$1" ;; - wget|wget2) set -- -O "$2" "$1" ;; + axel) set -- -o "$2" "$1" ;; + aria2c) set -- -d "${2%/*}" -o "${2##*/}" "$1" ;; + curl) set -- -fLo "$2" "$1" ;; + wget|wget2) set -- -O "$2" "$1" ;; esac "$dl_prog" "$@" || { @@ -859,6 +929,9 @@ pkg_extract() { backend=${src%%+*} url=${src##"${backend}"+} com=${url##*[@#]} com=${com#"${url%[@#]*}"} + # Add back @ to com + case $url in *@*) com=@$com; esac + log "$1" "Cloning ${url%[#@]*}" "pkg_vcs_clone_$backend" "${url%[#@]*}" "$com" ;; @@ -900,8 +973,9 @@ pkg_depends() { # Resolve all dependencies and generate an ordered list. # This does a depth-first search. The deepest dependencies are # listed first and then the parents in reverse order. - contains "$pkgs" "$1" || { - pkgs="$pkgs $1 " + # + # shellcheck disable=2015 + contains "$pkgs" "$1" && [ -z "$2" ] || { [ "$2" = raw ] && _dep_append "$1" "$1" while read -r dep type || [ "$dep" ]; do # Skip comments and empty lines. @@ -922,7 +996,7 @@ pkg_depends() { if [ "$2" = explicit ] || [ "$3" ]; then _dep_append "$dep" "$dep" else - _dep_append "$1" "$dep" + _dep_append "$dep" "$1" fi # Recurse through the dependencies of the child packages. Forward @@ -934,6 +1008,7 @@ pkg_depends() { fi done 2>/dev/null < "$(pkg_find "$1")/depends" ||: + pkgs="$pkgs $1 " } } @@ -970,7 +1045,7 @@ pkg_strip() { # system as well as on the tarballs we ship for installation. # Package has stripping disabled, stop here. - [ -f "$mak_dir/$pkg/nostrip" ] && return + [ "$CPT_NOSTRIP" ] || [ -f "$mak_dir/$pkg/nostrip" ] && return log "$1" "Stripping binaries and libraries" @@ -1841,7 +1916,7 @@ pkg_vcs_clone_git() { git init git remote add origin "${1%[#@]*}" case $2 in - @*) git fetch -t --depth=1 origin "${2#@}" || git fetch ;; + @*) git fetch -t --depth=1 origin "${2#@}" || git fetch; set -- "$1" "${2#@}" ;; *) git fetch --depth=1 origin "$2" || git fetch esac git checkout "${2:-FETCH_HEAD}" @@ -2177,6 +2252,7 @@ pkg_gentree() ( esac done pkg_depends "$1" tree "$make_deps" + pkg_depends_commit # Unless 'f' is given, pop the package from the list so that we don't list # the package (for example if it's part of the base package list). Normally @@ -2188,7 +2264,9 @@ pkg_gentree() ( # shellcheck disable=2086 [ -z "${2##*f*}" ] || deps=$(pop "$1" from $deps) - eval set -- "$deps" + # Word splitting is intentional. + # shellcheck disable=2086 + set -- $deps pkg_order "$@" if [ "$reverse" ]; then eval set -- "$redro"; else eval set -- "$order"; fi [ "$1" ] || return 0 @@ -2237,7 +2315,7 @@ _tmp_cp() { # second argument is not given, use the basename of the copied file. _ret=${2:-${1##*/}} _ret=$(_tmp_name "$_ret") - cp "$1" "$_ret" + cp -p "$1" "$_ret" out "$_ret" } @@ -2245,9 +2323,8 @@ _tmp_create() { # Create given file to the temporary directory and return its name create_tmp _ret=$(_tmp_name "$1") - # False positive, we are not reading from the file. - # shellcheck disable=2094 - out "$_ret" 3>> "$_ret" + :> "$_ret" || return 1 + out "$_ret" } create_tmp() { diff --git a/www/index.md b/www/index.md index 5738b9a..e518540 100644 --- a/www/index.md +++ b/www/index.md @@ -1,5 +1,7 @@ # Home +[](https://builds.sr.ht/~carbslinux/cpt?) + CPT is the package management toolset written for Carbs Linux. Its aim is to provide a stable, powerful, and easily used library for package management that complements the tools that come with it. It has the following features: @@ -32,7 +34,7 @@ complements the tools that come with it. It has the following features: <hr> -### Latest Release: 6.2.4 ([2022-02-07](/timeline?c=6.2.4)) +### Latest Release: 7.0.2 ([2023-02-05](/timeline?c=7.0.2)) - [Download](/uvlist?byage=1) - [Changelog](/doc/trunk/CHANGELOG.md) |