__package_apt to accept .dpk files directly #340
Open
fancsali
wants to merge 1 commit from
fancsali/cdist:package-apt-dpkg
into master
pull from: fancsali/cdist:package-apt-dpkg
merge into: ungleich-public:master
ungleich-public:master
ungleich-public:7.0
ungleich-public:6.9
ungleich-public:py3.10
ungleich-public:ander/__package_apt_update_index
ungleich-public:haproxy-dualstack
ungleich-public:ander/__sed
ungleich-public:beta
ungleich-public:ander/os_version_debian_sid
ungleich-public:evilham-compatibility-fixes
ungleich-public:ander/__rsync
ungleich-public:__snakeoil_cert
ungleich-public:ander/update_readme
ungleich-public:__download_improvements
ungleich-public:feature/onchange
ungleich-public:cleanup/string-formatting
ungleich-public:feature/type-relationship-graph
ungleich-public:cleanup/ssh-auth-keys-types
ungleich-public:__letsencrypt_cert-fix-hooks
ungleich-public:bugfix/preos-debug
ungleich-public:bugfix/in-script-import
ungleich-public:6.8
ungleich-public:bugfix/sphinx-docs-build
ungleich-public:6.7
ungleich-public:cherry-pick-2f433a14
ungleich-public:bugfix/make-code-consistent
ungleich-public:6.6
ungleich-public:regain-py3.2-support
ungleich-public:6.5
ungleich-public:bugfix/multiple-log-lines
ungleich-public:matterbridge
ungleich-public:coturn
ungleich-public:alpinefix
ungleich-public:matrix
ungleich-public:new-type/network-interface
ungleich-public:feature/process
ungleich-public:6.4
ungleich-public:feature/info-command
ungleich-public:feature/libexec
ungleich-public:6.3
ungleich-public:preos-plugins-dir-opt
ungleich-public:gitlab-ci
ungleich-public:6.2
ungleich-public:order-dep-fix
ungleich-public:6.1
ungleich-public:6.0
ungleich-public:build/support-pip-from-git
ungleich-public:feature/shell-lib
ungleich-public:5.1
ungleich-public:feature/support-type-deprecation
ungleich-public:5.0
ungleich-public:feature/python-types
ungleich-public:4.11
ungleich-public:4.10
ungleich-public:shellcheck
ungleich-public:4.9
ungleich-public:4.8
ungleich-public:freebsd-improvements
ungleich-public:new-prometheus
ungleich-public:key_value-onchange
ungleich-public:feature/output_streams
ungleich-public:AnotherKamila-patch-1
ungleich-public:__letsencrypt_cert-fixes
ungleich-public:letsencrypt-cron-fix
ungleich-public:4.7
ungleich-public:newtype-__letsencrypt_cert
ungleich-public:os_explorer_devuan_fix
ungleich-public:prometheus-exporter-fixes
ungleich-public:daemontools-for-fbsd
ungleich-public:type-prometheus-exporter-from-master
ungleich-public:prometheus-more-fixes
ungleich-public:4.6
ungleich-public:4.5
ungleich-public:fix-j
ungleich-public:steven-backport
ungleich-public:4.4
ungleich-public:prometheus-fixes
ungleich-public:grafana_dashboard
ungleich-public:prometheus
ungleich-public:daemontools
ungleich-public:consul_improvements
ungleich-public:feature/trigger
ungleich-public:4.3
ungleich-public:4.0-pre-not-stable
ungleich-public:4.2
ungleich-public:4.1
ungleich-public:4.0
ungleich-public:feature_install_and_preos
ungleich-public:3.1
ungleich-public:no-dot-cdist
ungleich-public:random_dot_cdist
ungleich-public:feature_yum_url
ungleich-public:feature_files_export
ungleich-public:3.0
ungleich-public:2.3
ungleich-public:2.2
ungleich-public:2.1
ungleich-public:ssh_callback
ungleich-public:2.0
ungleich-public:archive_shell_function_approach
ungleich-public:1.7
ungleich-public:1.6
ungleich-public:1.5
ungleich-public:1.4
ungleich-public:1.3
ungleich-public:1.2
ungleich-public:1.1
ungleich-public:1.0
No reviewers
Labels
No labels
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#340
Reference in a new issue
No description provided.
Delete branch "fancsali/cdist:package-apt-dpkg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
To install software that is either custom or not yet available in any official repos, one would go do something like this:
.dpkg
package__package_dpkg
.But this would not take care of the dependencies, so one would either need to install every dependency "by hand" or perhaps run
apt-get install --fix-missing
to make sure things work out.However, a perhaps less well-known feautre of
apt
is that it'd happily accept a package in a file and install that, satisfying the dependencies through the normal sources and repos. Unfortunately this is not exposed via__package_apt
at the moment.Solution approach
As both
__package_apt
and__package_dpkg
are wrappers there are two obvious ways to make this more convenient:__package_dpkg
to runapt-get install --fix-missing
after installing a package;__package_apt
with the capability to accept package files.As the first one seems to be somewhat of a hack and would also introduce a new dependency on
apt
into__package_dpkg
(if a machine hasapt
it is guaranteed to havedpkg
as well - but the reverse is not necessarily true), the second one seems to be favourable.This change exposes that already present functionality of apt to the users of
cdist
.NOTE: This PR would also seem to essentially deprecate
__package_dpkg
, but that's not the intent here: for completeness sake, for sake of backwards compatiblity and to keep allowing users full control I'd definitely keep that around too.WIP: __package_apt to accept .dpk files directlyto __package_apt to accept .dpk files directly@ -106,0 +114,4 @@
fi
$__remote_copy "$source_path" "${my_target_host}:$tempfile"
echo "$aptget $recommendsparam install $tempfile"
Interesting. And how is the tempfile removed eventually?
Well, I reckon, the OS will remove it eventually; wouldn't it?
No, why would it? It's a file we copied and in case we use this type a lot, we will have a lot of leftovers. I don't think this is a clean implementation, TBH.
Well, according to the FHS, it sortof does: "Programs must not assume that any files or directories in /tmp are preserved between invocations of the program." (https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#tmpTemporaryFiles)
Of course, the ones stored in
/var/tmp
are removed less frequently, as per "5.15. /var/tmp : Temporary files preserved between system reboots" (https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#vartmpTemporaryFilesPreservedBetwee).I do recall, there was lots of debate around how
cdist
should clean up after itself, but I can't remember the outcome of that discussion - if it's been decided that this is the official policy now, I am happy to add that. It's just, looking at the other types, it didn't seem so...I would like to see this feature added.
If all it takes for @nico to accept it is to rm the tmp file, @fancsali, shall I add that?
Go ahead, the pull request is already 2 years old. I'd also like to see a better comment than 'Fix IPv6' on line 108 - there's no bug, we just (re)format IPv6 addresses as needed.
I am somewhat snowed under atm, so feel free to adjust the code, ladies and gents...
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.