Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch repository-backend Excluding Merge-Ins
This is equivalent to a diff from 3414a848d0 to ce40806183
2021-04-26
| ||
08:39 | Merge branch 'repository-backend' to 'trunk' check-in: 1f4476fd14 user: merakor tags: trunk | |
08:33 | docs: update Closed-Leaf check-in: ce40806183 user: merakor tags: repository-backend | |
08:33 | cpt-lib: add and use new backends for fetching repositories check-in: 2ded60ede3 user: merakor tags: repository-backend | |
2021-04-05
| ||
13:38 | www: update check-in: 04dcf89a60 user: merakor tags: trunk | |
13:27 | Create new branch named "repository-backend" check-in: ef22e1d25d user: merakor tags: repository-backend | |
13:24 | Use fossil backend for creating distribution tarballs check-in: 3414a848d0 user: merakor tags: trunk | |
13:02 | tests: add dummy package that exits with error check-in: 5f0caffb9d user: merakor tags: trunk | |
Changes to docs/cpt.org.
︙ | ︙ | |||
175 176 177 178 179 180 181 182 183 184 185 186 187 188 | Absolute path to the package manager hook file. - ~CPT_KEEPLOG~ :: If set to 1, =cpt= will keep logs regardless of operation success. - ~CPT_PID~ :: Set the temporary build directory name. - ~CPT_PROMPT~ :: If set to 0, =cpt= will not prompt you for anything. - ~CPT_ROOT~ :: If this variable is set, =cpt= will assume the given path as the system root. - ~CPT_TEST~ :: If set to 1, ~cpt-build~ will run tests whenever available. - ~CPT_TMPDIR~ :: The directory to create the temporary directories. | > > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | Absolute path to the package manager hook file. - ~CPT_KEEPLOG~ :: If set to 1, =cpt= will keep logs regardless of operation success. - ~CPT_PID~ :: Set the temporary build directory name. - ~CPT_PROMPT~ :: If set to 0, =cpt= will not prompt you for anything. - ~CPT_REPO_CACHE~ :: If set to 0, =cpt= will not use or write repository information cache. - ~CPT_ROOT~ :: If this variable is set, =cpt= will assume the given path as the system root. - ~CPT_TEST~ :: If set to 1, ~cpt-build~ will run tests whenever available. - ~CPT_TMPDIR~ :: The directory to create the temporary directories. |
︙ | ︙ |
Changes to docs/cpt.texi.
︙ | ︙ | |||
289 290 291 292 293 294 295 296 297 298 299 300 301 302 | Absolute path to the package manager hook file. @item @code{CPT_KEEPLOG} If set to 1, @samp{cpt} will keep logs regardless of operation success. @item @code{CPT_PID} Set the temporary build directory name. @item @code{CPT_PROMPT} If set to 0, @samp{cpt} will not prompt you for anything. @item @code{CPT_ROOT} If this variable is set, @samp{cpt} will assume the given path as the system root. @item @code{CPT_TEST} If set to 1, @code{cpt-build} will run tests whenever available. @item @code{CPT_TMPDIR} The directory to create the temporary directories. @end table | > > | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | Absolute path to the package manager hook file. @item @code{CPT_KEEPLOG} If set to 1, @samp{cpt} will keep logs regardless of operation success. @item @code{CPT_PID} Set the temporary build directory name. @item @code{CPT_PROMPT} If set to 0, @samp{cpt} will not prompt you for anything. @item @code{CPT_REPO_CACHE} If set to 0, @samp{cpt} will not use or write repository information cache. @item @code{CPT_ROOT} If this variable is set, @samp{cpt} will assume the given path as the system root. @item @code{CPT_TEST} If set to 1, @code{cpt-build} will run tests whenever available. @item @code{CPT_TMPDIR} The directory to create the temporary directories. @end table |
︙ | ︙ |
Changes to docs/cpt.txt.
︙ | ︙ | |||
245 246 247 248 249 250 251 252 253 254 255 256 257 258 | `CPT_KEEPLOG' If set to 1, `cpt' will keep logs regardless of operation success. `CPT_PID' Set the temporary build directory name. `CPT_PROMPT' If set to 0, `cpt' will not prompt you for anything. `CPT_ROOT' If this variable is set, `cpt' will assume the given path as the system root. `CPT_TEST' If set to 1, `cpt-build' will run tests whenever available. `CPT_TMPDIR' The directory to create the temporary directories. | > > > | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | `CPT_KEEPLOG' If set to 1, `cpt' will keep logs regardless of operation success. `CPT_PID' Set the temporary build directory name. `CPT_PROMPT' If set to 0, `cpt' will not prompt you for anything. `CPT_REPO_CACHE' If set to 0, `cpt' will not use or write repository information cache. `CPT_ROOT' If this variable is set, `cpt' will assume the given path as the system root. `CPT_TEST' If set to 1, `cpt-build' will run tests whenever available. `CPT_TMPDIR' The directory to create the temporary directories. |
︙ | ︙ |
Changes to src/cpt-lib.in.
︙ | ︙ | |||
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 | "$sys_db/$pkg_name/post-install" ||: fi run_hook post-install "$pkg_name" "$sys_db/$pkg_name" root log "$pkg_name" "Installed successfully" } pkg_fetch() { log "Updating repositories" run_hook pre-fetch # Create a list of all repositories. # See [1] at top of script. # shellcheck disable=2046,2086 { IFS=:; set -- $CPT_PATH; IFS=$old_ifs ;} # Update each repository in '$CPT_PATH'. It is assumed that # each repository is 'git' tracked. for repo; do | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < | < | < < < < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 | "$sys_db/$pkg_name/post-install" ||: fi run_hook post-install "$pkg_name" "$sys_db/$pkg_name" root log "$pkg_name" "Installed successfully" } pkg_repository_pull_fossil() { # Pull function for Fossil. [ "$(fossil remote 2>/dev/null)" != off ] || { log "$repo" " " printf '%s\n' "No remote, skipping." return 0 } # Ensure we have proper permissions to do the pull operation. if [ -w "$PWD" ] && [ "$uid" != 0 ]; then fossil update else pkg_repository_as_root "fossil update" fi } pkg_repository_pull_git() { # Pull function for Git. [ "$(git remote 2>/dev/null)" ] || { log "$repo" " " printf '%s\n' "No remote, skipping." return 0 } # Display a message if signing is enabled for this repository. case $(git config merge.verifySignatures) in true) log "$PWD" "[signed] " ;; *) log "$PWD" " " ;; esac # Ensure we have proper permissions to do the pull operation. if [ -w "$PWD" ] && [ "$uid" != 0 ]; then git fetch git merge git submodule update --remote --init -f else pkg_repository_as_root \ "git fetch && git merge && git submodule update --remote --init -f" fi } pkg_repository_pull_hg() { # Pull function for Mercurial. [ "$(hg showconfig paths 2>/dev/null)" ] || { log "$repo" " " printf '%s\n' "No remote, skipping." return 0 } if [ -w "$PWD" ] && [ "$uid" != 0 ]; then hg pull hg update else pkg_repository_as_root "hg pull && hg update" fi } pkg_repository_pull_rsync() { # Pull function for rsync repositories. The details of our rsync # repositories are explained in the user manual. # Read remote repository address from the '.rsync' file. read -r remote < .rsync if [ -w "$PWD" ] && [ "$uid" != 0 ]; then rsync -acvzzC --include=core --delete "$remote/" "$PWD" else pkg_repository_as_root "rsync -acvzzC --include=core --delete \"$remote/\" \"$PWD\"" fi } pkg_repository_pull_local() { # Local repository. We don't do a "pull" here, we just notify the user that # this is the case. log "$repo" " " printf '%s\n' "Not a remote repository, skipping." } pkg_repository_as_root() ( # Helper function for pkg_repository_pull* functions used for proper # privilege escalation. [ "$uid" = 0 ] || log "$PWD" "Need root to update" # Find out the owner of the repository and spawn the operation as the user # below. # # This prevents the VCS from changing the original ownership of files and # directories in the rare case that the repository is owned by a third user. user=$(_stat "$PWD") [ "$user" = root ] || log "Dropping permissions to $user for pull" case ${su##*/} in su) set -- "'$1'"; esac # Spawn a subhsell to run multiple commands as root at once. This makes # things easier on users who aren't using persist/timestamps for auth # caching. as_root sh -c "$@" ) pkg_repository_info() { # Finds and returns repository information for the current directory. It # will return current directory, repository root, and the type of repository # in a colon separated format. : "${repo_file:=$cac_dir/repository-cache}" set -- if [ "$CPT_REPO_CACHE" != 0 ] && information=$(grep "^$PWD:" "$repo_file" 2>/dev/null); then # Repository information is already cached. printf '%s\n' "$information" | sed 1q return elif rootdir=$(git rev-parse --show-toplevel 2>/dev/null); then # Git repository backend=git elif rootdir=$(hg root 2>/dev/null); then # Mercurial repository backend=hg elif rootdir=$(fossil info 2>/dev/null | grep ^local-root:); then # Fossil repository backend=fossil # We want to remove the initial spacing before the root directory, and # the leading dash on the root directory. rootdir=$(printf '%s\n' "$rootdir" | cut -d ' ' -f2-) rootdir=${rootdir%/} elif [ -f .rsync ]; then backend=rsync rootdir=$PWD # If an .rsync_root file exists, we check that the repository root # exists. If it does, we change to that directory to do the fetch. # This way, we allow for partial repositories while making sure that # we can fetch the repository in a single operation. [ -f .rsync_root ] && { read -r rsync_root < .rsync_root [ -f "$rsync_root/.rsync" ] && rootdir=$(_readlinkf "$rsync_root") } else # Local repository backend=local rootdir=$PWD fi # We cache all these information, so that we don't have to spend much time # looking these up the next time we are doing it. If CPT_REPO_CACHE is set # to 0, we will not write this cache. [ "$CPT_REPO_CACHE" = 0 ] || set -- "$repo_file" printf '%s:%s:%s\n' "$PWD" "$rootdir" "$backend" | tee -a "$@" } pkg_fetch() { log "Updating repositories" run_hook pre-fetch # Create a list of all repositories. # See [1] at top of script. # shellcheck disable=2046,2086 { IFS=:; set -- $CPT_PATH; IFS=$old_ifs ;} # Update each repository in '$CPT_PATH'. It is assumed that # each repository is 'git' tracked. for repo; do # Go to the root of the repository. cd "$repo" repo_type=$(pkg_repository_info) repo_root=${repo_type#$PWD:} repo_type=${repo_type##*:} repo_root=${repo_root%:*} contains "$repos" "$repo_root" || { repos="$repos $repo_root " cd "$repo_root" "pkg_repository_pull_$repo_type" } done run_hook post-fetch } pkg_updates(){ # Check all installed packages for updates. So long as the installed |
︙ | ︙ |