mirror of
https://github.com/containers/podman.git
synced 2025-09-19 23:03:16 +08:00
Merge pull request #26452 from Luap99/cleanup
repo cleanup: remove unused files
This commit is contained in:
24
.github/workflows/pr-title.yml
vendored
24
.github/workflows/pr-title.yml
vendored
@ -1,24 +0,0 @@
|
|||||||
# Upstream: github.com/tzkhan/pr-update-action
|
|
||||||
|
|
||||||
name: "PR title check"
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
branches:
|
|
||||||
- "!master" # causes errors; reason unknown
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update_pr:
|
|
||||||
permissions:
|
|
||||||
pull-requests: write # for tzkhan/pr-update-action to update PRs
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: tzkhan/pr-update-action@bbd4c9395df8a9c4ef075b8b7fe29f2ca76cdca9 # v2
|
|
||||||
with:
|
|
||||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
base-branch-regex: '^(?!master).*$'
|
|
||||||
title-template: '[%basebranch%]'
|
|
||||||
title-prefix-space: true
|
|
23
Makefile
23
Makefile
@ -52,7 +52,6 @@ ETCDIR ?= /etc
|
|||||||
LIBDIR ?= ${PREFIX}/lib
|
LIBDIR ?= ${PREFIX}/lib
|
||||||
TMPFILESDIR ?= ${LIBDIR}/tmpfiles.d
|
TMPFILESDIR ?= ${LIBDIR}/tmpfiles.d
|
||||||
USERTMPFILESDIR ?= ${PREFIX}/share/user-tmpfiles.d
|
USERTMPFILESDIR ?= ${PREFIX}/share/user-tmpfiles.d
|
||||||
MODULESLOADDIR ?= ${LIBDIR}/modules-load.d
|
|
||||||
SYSTEMDDIR ?= ${LIBDIR}/systemd/system
|
SYSTEMDDIR ?= ${LIBDIR}/systemd/system
|
||||||
USERSYSTEMDDIR ?= ${LIBDIR}/systemd/user
|
USERSYSTEMDDIR ?= ${LIBDIR}/systemd/user
|
||||||
SYSTEMDGENERATORSDIR ?= ${LIBDIR}/systemd/system-generators
|
SYSTEMDGENERATORSDIR ?= ${LIBDIR}/systemd/system-generators
|
||||||
@ -757,7 +756,7 @@ system.test-binary: .install.ginkgo
|
|||||||
$(GO) test -c ./test/system
|
$(GO) test -c ./test/system
|
||||||
|
|
||||||
.PHONY: test-binaries
|
.PHONY: test-binaries
|
||||||
test-binaries: test/checkseccomp/checkseccomp test/goecho/goecho install.catatonit test/version/version
|
test-binaries: test/checkseccomp/checkseccomp test/goecho/goecho test/version/version
|
||||||
@echo "Canonical source version: $(call err_if_empty,RELEASE_VERSION)"
|
@echo "Canonical source version: $(call err_if_empty,RELEASE_VERSION)"
|
||||||
|
|
||||||
.PHONY: tests-included
|
.PHONY: tests-included
|
||||||
@ -840,7 +839,6 @@ podman-remote-release-%.zip: test/version/version ## Build podman-remote for %=$
|
|||||||
$(MAKE) $(GOPLAT) podman-mac-helper;\
|
$(MAKE) $(GOPLAT) podman-mac-helper;\
|
||||||
fi
|
fi
|
||||||
cp -r ./docs/build/remote/$(GOOS) "$(tmpsubdir)/$(releasedir)/docs/"
|
cp -r ./docs/build/remote/$(GOOS) "$(tmpsubdir)/$(releasedir)/docs/"
|
||||||
cp ./contrib/remote/containers.conf "$(tmpsubdir)/$(releasedir)/"
|
|
||||||
$(MAKE) $(GOPLAT) $(_dstargs) SELINUXOPT="" install.remote
|
$(MAKE) $(GOPLAT) $(_dstargs) SELINUXOPT="" install.remote
|
||||||
cd "$(tmpsubdir)" && \
|
cd "$(tmpsubdir)" && \
|
||||||
zip --recurse-paths "$(CURDIR)/$@" "./$(releasedir)"
|
zip --recurse-paths "$(CURDIR)/$@" "./$(releasedir)"
|
||||||
@ -879,10 +877,6 @@ rpm-install: package ## Install rpm packages
|
|||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: install.bin install.remote install.man install.systemd ## Install binaries to system locations
|
install: install.bin install.remote install.man install.systemd ## Install binaries to system locations
|
||||||
|
|
||||||
.PHONY: install.catatonit
|
|
||||||
install.catatonit:
|
|
||||||
./hack/install_catatonit.sh
|
|
||||||
|
|
||||||
.PHONY: install.remote
|
.PHONY: install.remote
|
||||||
install.remote:
|
install.remote:
|
||||||
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
|
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
|
||||||
@ -922,11 +916,6 @@ install.testing:
|
|||||||
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
|
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
|
||||||
install ${SELINUXOPT} -m 755 bin/podman-testing $(DESTDIR)$(BINDIR)/podman-testing
|
install ${SELINUXOPT} -m 755 bin/podman-testing $(DESTDIR)$(BINDIR)/podman-testing
|
||||||
|
|
||||||
.PHONY: install.modules-load
|
|
||||||
install.modules-load: # This should only be used by distros which might use iptables-legacy, this is not needed on RHEL
|
|
||||||
install ${SELINUXOPT} -m 755 -d $(DESTDIR)${MODULESLOADDIR}
|
|
||||||
install ${SELINUXOPT} -m 644 contrib/modules-load.d/podman-iptables.conf $(DESTDIR)${MODULESLOADDIR}/podman-iptables.conf
|
|
||||||
|
|
||||||
.PHONY: install.man
|
.PHONY: install.man
|
||||||
install.man:
|
install.man:
|
||||||
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(MANDIR)/man1
|
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(MANDIR)/man1
|
||||||
@ -1071,11 +1060,7 @@ uninstall:
|
|||||||
rm -f $(DESTDIR)$(BINDIR)/podman
|
rm -f $(DESTDIR)$(BINDIR)/podman
|
||||||
rm -f $(DESTDIR)$(BINDIR)/podman-remote
|
rm -f $(DESTDIR)$(BINDIR)/podman-remote
|
||||||
# Remove related config files
|
# Remove related config files
|
||||||
rm -f $(DESTDIR)${ETCDIR}/cni/net.d/87-podman-bridge.conflist
|
|
||||||
rm -f $(DESTDIR)${TMPFILESDIR}/podman.conf
|
rm -f $(DESTDIR)${TMPFILESDIR}/podman.conf
|
||||||
rm -f $(DESTDIR)${SYSTEMDDIR}/io.podman.socket
|
|
||||||
rm -f $(DESTDIR)${USERSYSTEMDDIR}/io.podman.socket
|
|
||||||
rm -f $(DESTDIR)${SYSTEMDDIR}/io.podman.service
|
|
||||||
rm -f $(DESTDIR)${SYSTEMDDIR}/podman.service
|
rm -f $(DESTDIR)${SYSTEMDDIR}/podman.service
|
||||||
rm -f $(DESTDIR)${SYSTEMDDIR}/podman.socket
|
rm -f $(DESTDIR)${SYSTEMDDIR}/podman.socket
|
||||||
rm -f $(DESTDIR)${USERSYSTEMDDIR}/podman.socket
|
rm -f $(DESTDIR)${USERSYSTEMDDIR}/podman.socket
|
||||||
@ -1089,7 +1074,6 @@ clean-binaries: ## Remove platform/architecture specific binary files
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: clean-binaries ## Clean all make artifacts
|
clean: clean-binaries ## Clean all make artifacts
|
||||||
rm -rf \
|
rm -rf \
|
||||||
_output \
|
|
||||||
$(wildcard podman-*.msi) \
|
$(wildcard podman-*.msi) \
|
||||||
$(wildcard podman-remote*.zip) \
|
$(wildcard podman-remote*.zip) \
|
||||||
$(wildcard podman_tmp_*) \
|
$(wildcard podman_tmp_*) \
|
||||||
@ -1099,11 +1083,6 @@ clean: clean-binaries ## Clean all make artifacts
|
|||||||
test/goecho/goecho \
|
test/goecho/goecho \
|
||||||
test/version/version \
|
test/version/version \
|
||||||
test/__init__.py \
|
test/__init__.py \
|
||||||
test/testdata/redis-image \
|
|
||||||
libpod/container_ffjson.go \
|
|
||||||
libpod/pod_ffjson.go \
|
|
||||||
libpod/container_easyjson.go \
|
|
||||||
libpod/pod_easyjson.go \
|
|
||||||
docs/build \
|
docs/build \
|
||||||
.venv
|
.venv
|
||||||
make -C docs clean
|
make -C docs clean
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"cniVersion": "0.4.0",
|
|
||||||
"name": "podman",
|
|
||||||
"plugins": [
|
|
||||||
{
|
|
||||||
"type": "bridge",
|
|
||||||
"bridge": "cni-podman0",
|
|
||||||
"isGateway": true,
|
|
||||||
"ipMasq": true,
|
|
||||||
"hairpinMode": true,
|
|
||||||
"ipam": {
|
|
||||||
"type": "host-local",
|
|
||||||
"routes": [{ "dst": "0.0.0.0/0" }],
|
|
||||||
"ranges": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"subnet": "10.88.0.0/16",
|
|
||||||
"gateway": "10.88.0.1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "portmap",
|
|
||||||
"capabilities": {
|
|
||||||
"portMappings": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "firewall"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "tuning"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
## `cni` ##
|
|
||||||
|
|
||||||
**Note**: The CNI backend is deprecated and will be removed in the next major Podman version 5.0, in preference
|
|
||||||
of Netavark, see **[podman-network(1)](../docs/source/markdown/podman-network.1.md)** on how to change the backend.
|
|
||||||
|
|
||||||
There are a wide variety of different [CNI](https://github.com/containernetworking/cni) network configurations. This
|
|
||||||
directory just contains an example configuration that can be used as the
|
|
||||||
basis for your own configuration.
|
|
||||||
|
|
||||||
To use this configuration, place it in `/etc/cni/net.d` (or the directory
|
|
||||||
specified by `cni_config_dir` in your `containers.conf`).
|
|
||||||
|
|
||||||
For example a basic network configuration can be achieved with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo mkdir -p /etc/cni/net.d
|
|
||||||
curl -qsSL https://raw.githubusercontent.com/containers/podman/main/cni/87-podman-bridge.conflist | sudo tee /etc/cni/net.d/87-podman-bridge.conflist
|
|
||||||
```
|
|
||||||
|
|
||||||
Dependent upon your CNI configuration, you will need to install as a minimum the `port` and `bridge` [CNI plugins](https://github.com/containernetworking/plugins) into `/opt/cni/bin` (or the directory specified by `cni_plugin_dir` in containers.conf). Please refer to the [CNI](https://github.com/containernetworking) project page in GitHub for more information.
|
|
@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/bash -e
|
|
||||||
#
|
|
||||||
# Script used for downloading man pages and config files from
|
|
||||||
# github.com/containers libraries (storage, common, image)
|
|
||||||
#
|
|
||||||
# Must be run from directory containing input specfile
|
|
||||||
#
|
|
||||||
|
|
||||||
die() {
|
|
||||||
echo "$(basename $0): $*" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
branchversion() {
|
|
||||||
gomod=$(git rev-parse --show-toplevel)/go.mod
|
|
||||||
v=$(awk -v X=github.com/containers/$1 '$1 ~ X { print $2 }' <$gomod)
|
|
||||||
hash=$(expr "$v" : "v.*-[0-9.]\+-\([0-9a-f]\+\)")
|
|
||||||
if [[ -n "$hash" ]]; then
|
|
||||||
v="$hash"
|
|
||||||
fi
|
|
||||||
echo "$v"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SPECFILE=containers-common.spec
|
|
||||||
if [[ ! -e $SPECFILE.in ]]; then
|
|
||||||
die "Please run me from the same directory as $SPECFILE.in"
|
|
||||||
fi
|
|
||||||
|
|
||||||
declare -A moduleversion
|
|
||||||
for module in common image storage; do
|
|
||||||
v=$(branchversion $module)
|
|
||||||
if [[ -z "$v" ]]; then
|
|
||||||
die "Could not find version for module '$v'"
|
|
||||||
fi
|
|
||||||
moduleversion[$module]=$v
|
|
||||||
done
|
|
||||||
|
|
||||||
builddir=containers-common-${moduleversion[common]}
|
|
||||||
mkdir -p $builddir
|
|
||||||
|
|
||||||
sed -e "s/COMMON_BRANCH/${moduleversion[common]}/g" \
|
|
||||||
-e "s/IMAGE_BRANCH/${moduleversion[image]}/g" \
|
|
||||||
-e "s/STORAGE_BRANCH/${moduleversion[storage]}/g" \
|
|
||||||
<$SPECFILE.in >$builddir/$SPECFILE
|
|
||||||
|
|
||||||
cd $builddir
|
|
||||||
spectool -fg $SPECFILE
|
|
||||||
|
|
||||||
if [[ ! -e storage.conf ]]; then
|
|
||||||
die "spectool did not pull storage.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Changing storage.conf..."
|
|
||||||
sed -i -e 's/^driver.*=.*/driver = "overlay"/' -e 's/^mountopt.*=.*/mountopt = "nodev,metacopy=on"/' \
|
|
||||||
storage.conf
|
|
@ -1,175 +0,0 @@
|
|||||||
# Below definitions are used to deliver config files from a particular branch
|
|
||||||
# of c/image, c/common, c/storage vendored in all of Buildah, Podman and Skopeo.
|
|
||||||
# These vendored components must have the same version. If it is not the case,
|
|
||||||
# pick the oldest version on c/image, c/common, c/storage vendored in
|
|
||||||
# Buildah/Podman/Skopeo.
|
|
||||||
%global skopeo_branch main
|
|
||||||
%global image_branch IMAGE_BRANCH
|
|
||||||
%global common_branch COMMON_BRANCH
|
|
||||||
%global storage_branch STORAGE_BRANCH
|
|
||||||
%global shortnames_branch main
|
|
||||||
|
|
||||||
%global github_containers https://raw.githubusercontent.com/containers
|
|
||||||
|
|
||||||
Epoch: 4
|
|
||||||
Name: containers-common
|
|
||||||
Version: COMMON_BRANCH
|
|
||||||
Release: %autorelease
|
|
||||||
Summary: Common configuration and documentation for containers
|
|
||||||
License: ASL 2.0
|
|
||||||
BuildArch: noarch
|
|
||||||
BuildRequires: go-md2man
|
|
||||||
Provides: skopeo-containers = %{epoch}:%{version}-%{release}
|
|
||||||
Requires: (container-selinux >= 2:2.162.1 if selinux-policy)
|
|
||||||
Requires: oci-runtime
|
|
||||||
Requires: container-network-stack
|
|
||||||
Recommends: netavark
|
|
||||||
Recommends: fuse-overlayfs
|
|
||||||
Recommends: slirp4netns
|
|
||||||
Source1: %{github_containers}/common/%{common_branch}/docs/containers.conf.5.md
|
|
||||||
Source2: %{github_containers}/common/%{common_branch}/pkg/config/containers.conf
|
|
||||||
Source3: %{github_containers}/common/%{common_branch}/pkg/seccomp/seccomp.json
|
|
||||||
Source4: %{github_containers}/common/%{common_branch}/pkg/subscriptions/mounts.conf
|
|
||||||
Source5: %{github_containers}/image/%{image_branch}/docs/containers-auth.json.5.md
|
|
||||||
Source6: %{github_containers}/image/%{image_branch}/docs/containers-certs.d.5.md
|
|
||||||
Source7: %{github_containers}/image/%{image_branch}/docs/containers-policy.json.5.md
|
|
||||||
Source8: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.5.md
|
|
||||||
Source9: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.d.5.md
|
|
||||||
Source10: %{github_containers}/image/%{image_branch}/docs/containers-registries.d.5.md
|
|
||||||
Source11: %{github_containers}/image/%{image_branch}/docs/containers-signature.5.md
|
|
||||||
Source12: %{github_containers}/image/%{image_branch}/docs/containers-transports.5.md
|
|
||||||
Source13: %{github_containers}/image/%{image_branch}/registries.conf
|
|
||||||
Source14: %{github_containers}/common/%{common_branch}/docs/containers-mounts.conf.5.md
|
|
||||||
Source15: %{github_containers}/shortnames/%{shortnames_branch}/shortnames.conf
|
|
||||||
Source16: %{github_containers}/skopeo/%{skopeo_branch}/default.yaml
|
|
||||||
Source17: %{github_containers}/skopeo/%{skopeo_branch}/default-policy.json
|
|
||||||
Source18: %{github_containers}/storage/%{storage_branch}/docs/containers-storage.conf.5.md
|
|
||||||
Source19: %{github_containers}/storage/%{storage_branch}/storage.conf
|
|
||||||
Source20: RPM-GPG-KEY-redhat-release
|
|
||||||
Source21: registry.access.redhat.com.yaml
|
|
||||||
Source22: registry.redhat.io.yaml
|
|
||||||
Source23: %{github_containers}/common/%{common_branch}/docs/Containerfile.5.md
|
|
||||||
Source24: %{github_containers}/common/%{common_branch}/docs/containerignore.5.md
|
|
||||||
Source25: %{github_containers}/common/%{common_branch}/docs/links/.containerignore.5
|
|
||||||
|
|
||||||
%description
|
|
||||||
This package contains common configuration files and documentation for container
|
|
||||||
tools ecosystem, such as Podman, Buildah and Skopeo.
|
|
||||||
|
|
||||||
It is required because the most of configuration files and docs come from projects
|
|
||||||
which are vendored into Podman, Buildah, Skopeo, etc. but they are not packaged
|
|
||||||
separately.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
cp %{SOURCE1} .
|
|
||||||
cp %{SOURCE2} .
|
|
||||||
cp %{SOURCE3} .
|
|
||||||
cp %{SOURCE4} .
|
|
||||||
cp %{SOURCE5} .
|
|
||||||
cp %{SOURCE6} .
|
|
||||||
cp %{SOURCE7} .
|
|
||||||
cp %{SOURCE8} .
|
|
||||||
cp %{SOURCE9} .
|
|
||||||
cp %{SOURCE10} .
|
|
||||||
cp %{SOURCE11} .
|
|
||||||
cp %{SOURCE12} .
|
|
||||||
cp %{SOURCE13} .
|
|
||||||
cp %{SOURCE14} .
|
|
||||||
cp %{SOURCE15} 000-shortnames.conf
|
|
||||||
cp %{SOURCE16} .
|
|
||||||
cp %{SOURCE17} policy.json
|
|
||||||
cp %{SOURCE18} .
|
|
||||||
cp %{SOURCE19} .
|
|
||||||
cp %{SOURCE20} .
|
|
||||||
cp %{SOURCE21} .
|
|
||||||
cp %{SOURCE22} .
|
|
||||||
cp %{SOURCE23} .
|
|
||||||
cp %{SOURCE24} .
|
|
||||||
cp %{SOURCE25} .
|
|
||||||
|
|
||||||
%build
|
|
||||||
mkdir -p man5
|
|
||||||
for FILE in $(ls *.5.md); do
|
|
||||||
go-md2man -in $FILE -out man5/$(basename $FILE .md)
|
|
||||||
done
|
|
||||||
|
|
||||||
cp man5/containerignore.5 man5/.containerignore.5
|
|
||||||
|
|
||||||
%install
|
|
||||||
# install config and policy files for registries
|
|
||||||
install -dp %{buildroot}%{_sysconfdir}/containers/{certs.d,oci/hooks.d}
|
|
||||||
install -dp %{buildroot}%{_sharedstatedir}/containers/sigstore
|
|
||||||
install -Dp -m0644 default.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
|
|
||||||
install -Dp -m0644 storage.conf -t %{buildroot}%{_datadir}/containers
|
|
||||||
install -Dp -m0644 registries.conf -t %{buildroot}%{_sysconfdir}/containers
|
|
||||||
install -Dp -m0644 000-shortnames.conf -t %{buildroot}%{_sysconfdir}/containers/registries.conf.d
|
|
||||||
install -Dp -m0644 policy.json -t %{buildroot}%{_sysconfdir}/containers
|
|
||||||
install -Dp -m0644 RPM-GPG-KEY-redhat-release -t %{buildroot}%{_sysconfdir}/pki/rpm-gpg
|
|
||||||
install -Dp -m0644 registry.access.redhat.com.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
|
|
||||||
install -Dp -m0644 registry.redhat.io.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
|
|
||||||
|
|
||||||
# install manpages
|
|
||||||
for FILE in $(ls -a man5 | grep 5); do
|
|
||||||
install -Dp -m0644 man5/$FILE -t %{buildroot}%{_mandir}/man5
|
|
||||||
done
|
|
||||||
|
|
||||||
# install config files for mounts, containers and seccomp
|
|
||||||
install -m0644 mounts.conf %{buildroot}%{_datadir}/containers/mounts.conf
|
|
||||||
install -m0644 seccomp.json %{buildroot}%{_datadir}/containers/seccomp.json
|
|
||||||
install -m0644 containers.conf %{buildroot}%{_datadir}/containers/containers.conf
|
|
||||||
|
|
||||||
# install secrets patch directory
|
|
||||||
install -d -p -m 755 %{buildroot}/%{_datadir}/rhel/secrets
|
|
||||||
# rhbz#1110876 - update symlinks for subscription management
|
|
||||||
ln -s %{_sysconfdir}/pki/entitlement %{buildroot}%{_datadir}/rhel/secrets/etc-pki-entitlement
|
|
||||||
ln -s %{_sysconfdir}/rhsm %{buildroot}%{_datadir}/rhel/secrets/rhsm
|
|
||||||
ln -s %{_sysconfdir}/yum.repos.d/redhat.repo %{buildroot}%{_datadir}/rhel/secrets/redhat.repo
|
|
||||||
|
|
||||||
%post
|
|
||||||
if [[ ! -f %{_mandir}/man5/Dockerfile.5.gz ]]; then
|
|
||||||
echo .so %{_mandir}/man5/Containerfile.5 > %{_mandir}/man5/Dockerfile.5
|
|
||||||
gzip %{_mandir}/man5/Dockerfile.5
|
|
||||||
fi
|
|
||||||
if [[ ! -f %{_mandir}/man5/dockerignore.5.gz ]]; then
|
|
||||||
echo .so %{_mandir}/man5/containerignore.5 > %{_mandir}/man5/dockerignore.5
|
|
||||||
gzip %{_mandir}/man5/dockerignore.5
|
|
||||||
fi
|
|
||||||
if [[ ! -f %{_mandir}/man5/.dockerignore.5.gz ]]; then
|
|
||||||
echo .so %{_mandir}/man5/containerignore.5 > %{_mandir}/man5/.dockerignore.5
|
|
||||||
gzip %{_mandir}/man5/.dockerignore.5
|
|
||||||
fi
|
|
||||||
|
|
||||||
%files
|
|
||||||
%dir %{_sysconfdir}/containers
|
|
||||||
%dir %{_sysconfdir}/containers/certs.d
|
|
||||||
%dir %{_sysconfdir}/containers/oci
|
|
||||||
%dir %{_sysconfdir}/containers/oci/hooks.d
|
|
||||||
%dir %{_sysconfdir}/containers/registries.conf.d
|
|
||||||
%dir %{_sysconfdir}/containers/registries.d
|
|
||||||
%config(noreplace) %{_sysconfdir}/containers/policy.json
|
|
||||||
%config(noreplace) %{_sysconfdir}/containers/registries.conf
|
|
||||||
%config(noreplace) %{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
|
|
||||||
%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
|
|
||||||
%config(noreplace) %{_sysconfdir}/containers/registries.d/default.yaml
|
|
||||||
%{_sysconfdir}/containers/registries.d/registry.redhat.io.yaml
|
|
||||||
%{_sysconfdir}/containers/registries.d/registry.access.redhat.com.yaml
|
|
||||||
%ghost %{_sysconfdir}/containers/storage.conf
|
|
||||||
%ghost %{_sysconfdir}/containers/containers.conf
|
|
||||||
%dir %{_sharedstatedir}/containers/sigstore
|
|
||||||
%ghost %{_mandir}/man5/Dockerfile.5.gz
|
|
||||||
%ghost %{_mandir}/man5/dockerignore.5.gz
|
|
||||||
%ghost %{_mandir}/man5/.dockerignore.5.gz
|
|
||||||
%{_mandir}/man5/Containerfile.5.gz
|
|
||||||
%{_mandir}/man5/containerignore.5.gz
|
|
||||||
%{_mandir}/man5/.containerignore.5.gz
|
|
||||||
%{_mandir}/man5/containers*.5.gz
|
|
||||||
%dir %{_datadir}/containers
|
|
||||||
%{_datadir}/containers/storage.conf
|
|
||||||
%{_datadir}/containers/containers.conf
|
|
||||||
%{_datadir}/containers/mounts.conf
|
|
||||||
%{_datadir}/containers/seccomp.json
|
|
||||||
%dir %{_datadir}/rhel/secrets
|
|
||||||
%{_datadir}/rhel/secrets/*
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
%autochangelog
|
|
@ -1,114 +0,0 @@
|
|||||||
#! /usr/bin/env bash
|
|
||||||
#
|
|
||||||
# dependabot-dance - invoked to perform manual steps on podman dependabot PRs
|
|
||||||
#
|
|
||||||
# As best I can tell (please correct me if mistaken), dependabot's job is
|
|
||||||
# to submit PRs with a change only in 'go.mod' but without actually
|
|
||||||
# running 'make vendor' to update the source files under vendor. This
|
|
||||||
# requires a human to run those steps.
|
|
||||||
#
|
|
||||||
# This script automates that, with a few safety checks.
|
|
||||||
#
|
|
||||||
ME=$(basename $0)
|
|
||||||
missing=" argument is missing; see $ME --help for details"
|
|
||||||
usage="Usage: $ME [--help] [-v|--verbose]
|
|
||||||
|
|
||||||
$ME performs a series of magical steps to get dependabot PRs
|
|
||||||
ready for merge. The important one is 'make vendor-in-container',
|
|
||||||
everything else is scaffolding to check out the PR and push it back.
|
|
||||||
|
|
||||||
Flags:
|
|
||||||
--help display usage message
|
|
||||||
-v, --verbose verbose output
|
|
||||||
"
|
|
||||||
|
|
||||||
verbose=
|
|
||||||
for i
|
|
||||||
do
|
|
||||||
value=$(expr "$i" : '[^=]*=\(.*\)')
|
|
||||||
case "$i" in
|
|
||||||
-h*|--help) echo "$usage"; exit 0;;
|
|
||||||
-v|--verbose) verbose=$i; shift;;
|
|
||||||
-*) echo "$ME: unrecognized option $i" >&2
|
|
||||||
echo "$usage" >&2
|
|
||||||
exit 1;;
|
|
||||||
*) break;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo "$ME: $*" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function branch_dance() {
|
|
||||||
local branch="$1"
|
|
||||||
|
|
||||||
# User will appreciate seeing 'git' and 'make' commands, but nothing else
|
|
||||||
set -x
|
|
||||||
git checkout -t $branch
|
|
||||||
set +x
|
|
||||||
|
|
||||||
# Commit must be from dependabot
|
|
||||||
author=$(git show --no-patch --format='format:%an' HEAD)
|
|
||||||
if ! [[ $author =~ dependabot ]]; then
|
|
||||||
echo
|
|
||||||
echo "Commit author is '$author' (expected 'dependabot')"
|
|
||||||
echo -n "Continue? [y/N] "
|
|
||||||
read answer
|
|
||||||
case "$answer" in
|
|
||||||
[yY]*) ;;
|
|
||||||
*) exit 1;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This is what does all the work
|
|
||||||
set -x
|
|
||||||
make vendor-in-container
|
|
||||||
set +x
|
|
||||||
|
|
||||||
# Now make sure at least *something* changed under vendor
|
|
||||||
modified=$(git ls-files -m vendor)
|
|
||||||
if [[ -z "$modified" ]]; then
|
|
||||||
echo "No files changed under 'vendor' -- nothing to do!"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Okay, here we go
|
|
||||||
set -x
|
|
||||||
git add vendor
|
|
||||||
git commit -a --amend -s --no-edit
|
|
||||||
git push --force
|
|
||||||
set +x
|
|
||||||
|
|
||||||
# Try to leave things in relatively clean state; remove local branch copy
|
|
||||||
local tracking_branch=$(git branch --show-current)
|
|
||||||
git checkout main
|
|
||||||
git branch -d $tracking_branch
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure we're cd'ed to the top level of a podman repo
|
|
||||||
test -d .git || die "No .git subdirectory (please cd to top level)"
|
|
||||||
|
|
||||||
# Clear all dependabot remote branches
|
|
||||||
git branch -r | grep /dependabot/go_modules/ \
|
|
||||||
| xargs --no-run-if-empty git branch -r -d
|
|
||||||
|
|
||||||
# ...and pull new ones
|
|
||||||
git pull --all
|
|
||||||
|
|
||||||
# Abort on any error from here on
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# We cannot have any git-modified files
|
|
||||||
modified=$(git ls-files -m)
|
|
||||||
test -z "$modified" || die "Modified files exist: $modified"
|
|
||||||
|
|
||||||
for branch in $(git branch -r | grep /dependabot/go_modules/); do
|
|
||||||
echo
|
|
||||||
echo ">>>>> $branch"
|
|
||||||
branch_dance $branch
|
|
||||||
done
|
|
@ -1,32 +0,0 @@
|
|||||||
# Fedora dependencies for building podman
|
|
||||||
|
|
||||||
btrfs-progs-devel
|
|
||||||
bzip2
|
|
||||||
containernetworking-cni
|
|
||||||
device-mapper-devel
|
|
||||||
findutils
|
|
||||||
git
|
|
||||||
glib2-devel
|
|
||||||
glibc-static
|
|
||||||
golang
|
|
||||||
gpgme-devel
|
|
||||||
iptables
|
|
||||||
libassuan-devel
|
|
||||||
libseccomp-devel
|
|
||||||
libselinux-devel
|
|
||||||
lsof
|
|
||||||
make
|
|
||||||
nmap-ncat
|
|
||||||
procps-ng
|
|
||||||
python
|
|
||||||
python3-dateutil
|
|
||||||
python3-pip
|
|
||||||
python3-psutil
|
|
||||||
python3-pytoml
|
|
||||||
python3-pyyaml
|
|
||||||
rsync
|
|
||||||
slirp4netns
|
|
||||||
unzip
|
|
||||||
which
|
|
||||||
xz
|
|
||||||
zip
|
|
@ -1,5 +0,0 @@
|
|||||||
# On fedora 36 ip_tables is no longer auto loaded and rootless user have no permsissions to load it.
|
|
||||||
# When we have actual nftables support in the future we might want to revisit this.
|
|
||||||
# If you use iptables-nft this is not needed.
|
|
||||||
ip_tables
|
|
||||||
ip6_tables
|
|
@ -1,11 +0,0 @@
|
|||||||
# The container's configuration file specifies all of the available configuration
|
|
||||||
# command-line options/flags for container engine tools like Podman
|
|
||||||
# but in a TOML format that can be easily modified and versioned.
|
|
||||||
|
|
||||||
[engine]
|
|
||||||
|
|
||||||
# Default Remote URI to access the Podman service.
|
|
||||||
# Examples:
|
|
||||||
# remote rootless ssh://engineering.lab.company.com/run/user/1000/podman/podman.sock
|
|
||||||
# remote rootful ssh://root@10.10.1.136:22/run/podman/podman.sock
|
|
||||||
# remote_uri= ""
|
|
@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
: "${GOPATH?Need to set GOPATH}"
|
|
||||||
|
|
||||||
cd cmd/podman/ && eval `go build -work -a 2>&1` && find $WORK -type f -name "*.a" | xargs -I{} du -hxs "{}" | sort -rh | sed -e s:${WORK}/::g
|
|
@ -1,17 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
insert_final_newline = false
|
|
||||||
|
|
||||||
[*.yaml]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
12
contrib/snapcraft/.gitignore
vendored
12
contrib/snapcraft/.gitignore
vendored
@ -1,12 +0,0 @@
|
|||||||
#snapcraft specifics
|
|
||||||
/parts/
|
|
||||||
/stage/
|
|
||||||
/prime/
|
|
||||||
|
|
||||||
*.snap
|
|
||||||
|
|
||||||
.snapcraft
|
|
||||||
__pycache__
|
|
||||||
*.pyc
|
|
||||||
*_source.tar.bz2
|
|
||||||
snap/.snapcraft
|
|
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2017 Snapcrafters
|
|
||||||
|
|
||||||
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.
|
|
@ -1,82 +0,0 @@
|
|||||||
<h1 align="center">
|
|
||||||
<img src="https://raw.githubusercontent.com/containers/podman.io/main/images/podman.svg?sanitize=true" alt="podman">
|
|
||||||
<br />
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<p align="center"><b>This is the snap for <a href="https://podman.io/">podman</a></b>, <i>“Managing Pods, Containers, and Container Images in Multiple Formats (Docker, OCI, ...).”</i>. It works on Ubuntu, Fedora, Debian, RHEL, SUSE, and other major Linux
|
|
||||||
distributions.</p>
|
|
||||||
|
|
||||||
<!-- Uncomment and modify this when you are provided a build status badge
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://build.snapcraft.io/user/snapcrafters/fork-and-rename-me"><img src="https://build.snapcraft.io/badge/snapcrafters/fork-and-rename-me.svg" alt="Snap Status"></a>
|
|
||||||
</p>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Uncomment and modify this when you have a screenshot
|
|
||||||

|
|
||||||
-->
|
|
||||||
|
|
||||||
<p align="center">Published for <img src="https://raw.githubusercontent.com/anythingcodes/slack-emoji-for-techies/gh-pages/emoji/tux.png" align="top" width="24" /> with 💝 by Snapcrafters</p>
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
sudo snap install podman
|
|
||||||
|
|
||||||
([Don't have snapd installed?](https://snapcraft.io/docs/core/install))
|
|
||||||
|
|
||||||
## Remaining tasks
|
|
||||||
<!-- Uncomment and modify this when you have a screenshot
|
|
||||||

|
|
||||||
-->
|
|
||||||
|
|
||||||
Snapcrafters ([join us](https://forum.snapcraft.io/t/join-snapcrafters/1325))
|
|
||||||
are working to land snap install documentation and
|
|
||||||
the [snapcraft.yaml](https://github.com/snapcrafters/podman/blob/main/snap/snapcraft.yaml)
|
|
||||||
upstream so `podman` can authoritatively publish future releases.
|
|
||||||
|
|
||||||
- [x] Fork the [Snapcrafters template](https://github.com/snapcrafters/fork-and-rename-me) repository to your own GitHub account.
|
|
||||||
- If you have already forked the Snapcrafter template to your account and want to create another snap, you'll need to use GitHub's [Import repository](https://github.com/new/import) feature because you can only fork a repository once.
|
|
||||||
- [x] Rename the forked Snapcrafters template repository
|
|
||||||
- [x] Update the description of the repository
|
|
||||||
- [x] Update logos and references to `podman` and `[podman]`
|
|
||||||
- [ ] Create a snap that runs in `devmode`
|
|
||||||
- [x] Register the snap in the store, **using the preferred upstream name**
|
|
||||||
- [ ] Add a screenshot to this `README.md`
|
|
||||||
- [ ] Publish the `devmode` snap in the Snap store edge channel
|
|
||||||
- [ ] Add install instructions to this `README.md`
|
|
||||||
- [ ] Update snap store metadata, icons and screenshots
|
|
||||||
- [ ] Convert the snap to `strict` confinement, or `classic` confinement if it qualifies
|
|
||||||
- [ ] Publish the confined snap in the Snap store beta channel
|
|
||||||
- [ ] Update the install instructions in this `README.md`
|
|
||||||
- [ ] Post a call for testing on the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
|
|
||||||
- [ ] Make a post in the [Snapcraft Forum](https://forum.snapcraft.io) asking for a transfer of the snap name from you to snapcrafters - [link]()
|
|
||||||
- [ ] Ask a [Snapcrafters admin](https://github.com/orgs/snapcrafters/people?query=%20role%3Aowner) to fork your repo into github.com/snapcrafters, and configure the repo for automatic publishing into edge on commit
|
|
||||||
- [ ] Add the provided Snapcraft build badge to this `README.md`
|
|
||||||
- [ ] Publish the snap in the Snap store stable channel
|
|
||||||
- [ ] Update the install instructions in this `README.md`
|
|
||||||
- [ ] Post an announcement in the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
|
|
||||||
- [ ] Submit a pull request or patch upstream that adds snap install documentation - [link]()
|
|
||||||
- [ ] Submit a pull request or patch upstream that adds the `snapcraft.yaml` and any required assets/launchers - [link]()
|
|
||||||
- [ ] Add upstream contact information to the `README.md`
|
|
||||||
- If upstream accept the PR:
|
|
||||||
- [ ] Request upstream create a Snap store account
|
|
||||||
- [ ] Contact the Snap Advocacy team to request the snap be transferred to upstream
|
|
||||||
- [ ] Ask the Snap Advocacy team to celebrate the snap - [link]()
|
|
||||||
|
|
||||||
If you have any questions, [post in the Snapcraft forum](https://forum.snapcraft.io).
|
|
||||||
|
|
||||||
<!--
|
|
||||||
## The Snapcrafters
|
|
||||||
|
|
||||||
| [](https://github.com/yourname/) |
|
|
||||||
| :---: |
|
|
||||||
| [Your Name](https://github.com/yourname/) |
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Uncomment and modify this when you have upstream contacts
|
|
||||||
## Upstream
|
|
||||||
|
|
||||||
| [](https://github.com/upstreamname) |
|
|
||||||
| :---: |
|
|
||||||
| [Upstream Name](https://github.com/upstreamname) |
|
|
||||||
-->
|
|
@ -1,45 +0,0 @@
|
|||||||
name: podman # you probably want to 'snapcraft register <name>'
|
|
||||||
version: '0.11.1.1' # just for humans, typically '1.2+git' or '1.3.2'
|
|
||||||
summary: Manage pods, containers and container images
|
|
||||||
description: |
|
|
||||||
`podman` is a tool for managing Pods, Containers, and Container Images
|
|
||||||
in multiple formats including Docker/OSI images. It exposes the same
|
|
||||||
command line interface as Docker, but runs containers unprivileged by
|
|
||||||
default.
|
|
||||||
|
|
||||||
confinement: devmode # use 'strict' once you have the right plugs and slots
|
|
||||||
|
|
||||||
base: core18
|
|
||||||
|
|
||||||
parts:
|
|
||||||
podman:
|
|
||||||
plugin: go
|
|
||||||
source: https://github.com/containers/podman/archive/v0.11.1.1.tar.gz
|
|
||||||
go-importpath: github.com/containers/podman
|
|
||||||
build-packages:
|
|
||||||
# https://podman.io/getting-started/installation#build-and-run-dependencies
|
|
||||||
- btrfs-tools
|
|
||||||
- git
|
|
||||||
- golang-go
|
|
||||||
- go-md2man
|
|
||||||
- iptables
|
|
||||||
- libassuan-dev
|
|
||||||
- libdevmapper-dev
|
|
||||||
- libglib2.0-dev
|
|
||||||
- libc6-dev
|
|
||||||
- libgpgme11-dev
|
|
||||||
- libgpg-error-dev
|
|
||||||
- libostree-dev
|
|
||||||
- libprotobuf-dev
|
|
||||||
- libprotobuf-c0-dev
|
|
||||||
- libseccomp-dev
|
|
||||||
- libselinux1-dev
|
|
||||||
- pkg-config
|
|
||||||
stage-packages:
|
|
||||||
- libarchive13
|
|
||||||
- libassuan0
|
|
||||||
- libgpgme11
|
|
||||||
- libicu60
|
|
||||||
- libostree-1-1
|
|
||||||
- libsoup2.4-1
|
|
||||||
- libxml2
|
|
@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
BASE_PATH="/usr/libexec/podman"
|
|
||||||
CATATONIT_PATH="${BASE_PATH}/catatonit"
|
|
||||||
CATATONIT_VERSION="v0.1.7"
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -f $CATATONIT_PATH ] && [ -z "$1" ]; then
|
|
||||||
echo "skipping ... catatonit is already installed"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "installing catatonit to $CATATONIT_PATH"
|
|
||||||
buildDir=$(mktemp -d)
|
|
||||||
git clone https://github.com/openSUSE/catatonit.git $buildDir
|
|
||||||
|
|
||||||
pushd $buildDir
|
|
||||||
echo `pwd`
|
|
||||||
git reset --hard ${CATATONIT_VERSION}
|
|
||||||
autoreconf -fi
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
install ${SELINUXOPT} -d -m 755 $BASE_PATH
|
|
||||||
install ${SELINUXOPT} -m 755 catatonit $CATATONIT_PATH
|
|
||||||
popd
|
|
||||||
|
|
||||||
rm -rf $buildDir
|
|
@ -1,134 +0,0 @@
|
|||||||
package timetype
|
|
||||||
|
|
||||||
// code adapted from https://github.com/moby/moby/blob/master/api/types/time/timestamp.go
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"math"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// These are additional predefined layouts for use in Time.Format and Time.Parse
|
|
||||||
// with --since and --until parameters for `docker logs` and `docker events`
|
|
||||||
const (
|
|
||||||
rFC3339Local = "2006-01-02T15:04:05" // RFC3339 with local timezone
|
|
||||||
rFC3339NanoLocal = "2006-01-02T15:04:05.999999999" // RFC3339Nano with local timezone
|
|
||||||
dateWithZone = "2006-01-02Z07:00" // RFC3339 with time at 00:00:00
|
|
||||||
dateLocal = "2006-01-02" // RFC3339 with local timezone and time at 00:00:00
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetTimestamp tries to parse given string as golang duration,
|
|
||||||
// then RFC3339 time and finally as a Unix timestamp. If
|
|
||||||
// any of these were successful, it returns a Unix timestamp
|
|
||||||
// as string otherwise returns the given value back.
|
|
||||||
// In case of duration input, the returned timestamp is computed
|
|
||||||
// as the given reference time minus the amount of the duration.
|
|
||||||
func GetTimestamp(value string, reference time.Time) (string, error) {
|
|
||||||
if d, err := time.ParseDuration(value); value != "0" && err == nil {
|
|
||||||
return strconv.FormatInt(reference.Add(-d).Unix(), 10), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var format string
|
|
||||||
// if the string has a Z or a + or three dashes use parse otherwise use parseinlocation
|
|
||||||
parseInLocation := !strings.ContainsAny(value, "zZ+") && strings.Count(value, "-") != 3
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case strings.Contains(value, "."):
|
|
||||||
if parseInLocation {
|
|
||||||
format = rFC3339NanoLocal
|
|
||||||
} else {
|
|
||||||
format = time.RFC3339Nano
|
|
||||||
}
|
|
||||||
case strings.Contains(value, "T"):
|
|
||||||
// we want the number of colons in the T portion of the timestamp
|
|
||||||
tcolons := strings.Count(value, ":")
|
|
||||||
// if parseInLocation is off and we have a +/- zone offset (not Z) then
|
|
||||||
// there will be an extra colon in the input for the tz offset subtract that
|
|
||||||
// colon from the tcolons count
|
|
||||||
if !parseInLocation && !strings.ContainsAny(value, "zZ") && tcolons > 0 {
|
|
||||||
tcolons--
|
|
||||||
}
|
|
||||||
if parseInLocation {
|
|
||||||
switch tcolons {
|
|
||||||
case 0:
|
|
||||||
format = "2006-01-02T15"
|
|
||||||
case 1:
|
|
||||||
format = "2006-01-02T15:04"
|
|
||||||
default:
|
|
||||||
format = rFC3339Local
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch tcolons {
|
|
||||||
case 0:
|
|
||||||
format = "2006-01-02T15Z07:00"
|
|
||||||
case 1:
|
|
||||||
format = "2006-01-02T15:04Z07:00"
|
|
||||||
default:
|
|
||||||
format = time.RFC3339
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case parseInLocation:
|
|
||||||
format = dateLocal
|
|
||||||
default:
|
|
||||||
format = dateWithZone
|
|
||||||
}
|
|
||||||
|
|
||||||
var t time.Time
|
|
||||||
var err error
|
|
||||||
|
|
||||||
if parseInLocation {
|
|
||||||
t, err = time.ParseInLocation(format, value, time.FixedZone(reference.Zone()))
|
|
||||||
} else {
|
|
||||||
t, err = time.Parse(format, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
// if there is a `-` then it's an RFC3339 like timestamp
|
|
||||||
if strings.Contains(value, "-") {
|
|
||||||
return "", err // was probably an RFC3339 like timestamp but the parser failed with an error
|
|
||||||
}
|
|
||||||
if _, _, err := parseTimestamp(value); err != nil {
|
|
||||||
return "", fmt.Errorf("failed to parse value as time or duration: %q", value)
|
|
||||||
}
|
|
||||||
return value, nil // unix timestamp in and out case (meaning: the value passed at the command line is already in the right format for passing to the server)
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("%d.%09d", t.Unix(), int64(t.Nanosecond())), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ParseTimestamps returns seconds and nanoseconds from a timestamp that has the
|
|
||||||
// format "%d.%09d", time.Unix(), int64(time.Nanosecond()))
|
|
||||||
// if the incoming nanosecond portion is longer or shorter than 9 digits it is
|
|
||||||
// converted to nanoseconds. The expectation is that the seconds and
|
|
||||||
// seconds will be used to create a time variable. For example:
|
|
||||||
//
|
|
||||||
// seconds, nanoseconds, err := ParseTimestamp("1136073600.000000001",0)
|
|
||||||
// if err == nil since := time.Unix(seconds, nanoseconds)
|
|
||||||
//
|
|
||||||
// returns seconds as def(aultSeconds) if value == ""
|
|
||||||
func ParseTimestamps(value string, def int64) (int64, int64, error) {
|
|
||||||
if value == "" {
|
|
||||||
return def, 0, nil
|
|
||||||
}
|
|
||||||
return parseTimestamp(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseTimestamp(value string) (int64, int64, error) {
|
|
||||||
spart, npart, hasParts := strings.Cut(value, ".")
|
|
||||||
s, err := strconv.ParseInt(spart, 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
return s, 0, err
|
|
||||||
}
|
|
||||||
if !hasParts {
|
|
||||||
return s, 0, nil
|
|
||||||
}
|
|
||||||
n, err := strconv.ParseInt(npart, 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
return s, n, err
|
|
||||||
}
|
|
||||||
// should already be in nanoseconds but just in case convert n to nanoseconds
|
|
||||||
n = int64(float64(n) * math.Pow(float64(10), float64(9-len(npart))))
|
|
||||||
return s, n, nil
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
package timetype
|
|
||||||
|
|
||||||
// code adapted from https://github.com/moby/moby/blob/master/api/types/time/timestamp.go
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strconv"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestGetTimestamp(t *testing.T) {
|
|
||||||
now := time.Now().In(time.UTC)
|
|
||||||
cases := []struct {
|
|
||||||
in, expected string
|
|
||||||
expectedErr bool
|
|
||||||
}{
|
|
||||||
// Partial RFC3339 strings get parsed with second precision
|
|
||||||
{"2006-01-02T15:04:05.999999999+07:00", "1136189045.999999999", false},
|
|
||||||
{"2006-01-02T15:04:05.999999999Z", "1136214245.999999999", false},
|
|
||||||
{"2006-01-02T15:04:05.999999999", "1136214245.999999999", false},
|
|
||||||
{"2006-01-02T15:04:05Z", "1136214245.000000000", false},
|
|
||||||
{"2006-01-02T15:04:05", "1136214245.000000000", false},
|
|
||||||
{"2006-01-02T15:04:0Z", "", true},
|
|
||||||
{"2006-01-02T15:04:0", "", true},
|
|
||||||
{"2006-01-02T15:04Z", "1136214240.000000000", false},
|
|
||||||
{"2006-01-02T15:04+00:00", "1136214240.000000000", false},
|
|
||||||
{"2006-01-02T15:04-00:00", "1136214240.000000000", false},
|
|
||||||
{"2006-01-02T15:04", "1136214240.000000000", false},
|
|
||||||
{"2006-01-02T15:0Z", "", true},
|
|
||||||
{"2006-01-02T15:0", "", true},
|
|
||||||
{"2006-01-02T15Z", "1136214000.000000000", false},
|
|
||||||
{"2006-01-02T15+00:00", "1136214000.000000000", false},
|
|
||||||
{"2006-01-02T15-00:00", "1136214000.000000000", false},
|
|
||||||
{"2006-01-02T15", "1136214000.000000000", false},
|
|
||||||
{"2006-01-02T1Z", "1136163600.000000000", false},
|
|
||||||
{"2006-01-02T1", "1136163600.000000000", false},
|
|
||||||
{"2006-01-02TZ", "", true},
|
|
||||||
{"2006-01-02T", "", true},
|
|
||||||
{"2006-01-02+00:00", "1136160000.000000000", false},
|
|
||||||
{"2006-01-02-00:00", "1136160000.000000000", false},
|
|
||||||
{"2006-01-02-00:01", "1136160060.000000000", false},
|
|
||||||
{"2006-01-02Z", "1136160000.000000000", false},
|
|
||||||
{"2006-01-02", "1136160000.000000000", false},
|
|
||||||
{"2015-05-13T20:39:09Z", "1431549549.000000000", false},
|
|
||||||
|
|
||||||
// unix timestamps returned as is
|
|
||||||
{"1136073600", "1136073600", false},
|
|
||||||
{"1136073600.000000001", "1136073600.000000001", false},
|
|
||||||
// Durations
|
|
||||||
{"1m", strconv.FormatInt(now.Add(-1*time.Minute).Unix(), 10), false},
|
|
||||||
{"1.5h", strconv.FormatInt(now.Add(-90*time.Minute).Unix(), 10), false},
|
|
||||||
{"1h30m", strconv.FormatInt(now.Add(-90*time.Minute).Unix(), 10), false},
|
|
||||||
|
|
||||||
{"invalid", "", true},
|
|
||||||
{"", "", true},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, c := range cases {
|
|
||||||
o, err := GetTimestamp(c.in, now)
|
|
||||||
if o != c.expected ||
|
|
||||||
(err == nil && c.expectedErr) ||
|
|
||||||
(err != nil && !c.expectedErr) {
|
|
||||||
t.Errorf("wrong value for '%s'. expected:'%s' got:'%s' with error: `%s`", c.in, c.expected, o, err)
|
|
||||||
t.Fail()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestParseTimestamps(t *testing.T) {
|
|
||||||
cases := []struct {
|
|
||||||
in string
|
|
||||||
def, expectedS, expectedN int64
|
|
||||||
expectedErr bool
|
|
||||||
}{
|
|
||||||
// unix timestamps
|
|
||||||
{"1136073600", 0, 1136073600, 0, false},
|
|
||||||
{"1136073600.000000001", 0, 1136073600, 1, false},
|
|
||||||
{"1136073600.0000000010", 0, 1136073600, 1, false},
|
|
||||||
{"1136073600.00000001", 0, 1136073600, 10, false},
|
|
||||||
{"foo.bar", 0, 0, 0, true},
|
|
||||||
{"1136073600.bar", 0, 1136073600, 0, true},
|
|
||||||
{"", -1, -1, 0, false},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, c := range cases {
|
|
||||||
s, n, err := ParseTimestamps(c.in, c.def)
|
|
||||||
if s != c.expectedS ||
|
|
||||||
n != c.expectedN ||
|
|
||||||
(err == nil && c.expectedErr) ||
|
|
||||||
(err != nil && !c.expectedErr) {
|
|
||||||
t.Errorf("wrong values for input `%s` with default `%d` expected:'%d'seconds and `%d`nanosecond got:'%d'seconds and `%d`nanoseconds with error: `%s`", c.in, c.def, c.expectedS, c.expectedN, s, n, err)
|
|
||||||
t.Fail()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -296,11 +296,6 @@ PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} ETCDI
|
|||||||
install.remote \
|
install.remote \
|
||||||
install.testing
|
install.testing
|
||||||
|
|
||||||
# See above for the iptables.conf declaration
|
|
||||||
%if %{defined fedora} && 0%{?fedora} < 41
|
|
||||||
%{__make} DESTDIR=%{buildroot} MODULESLOADDIR=%{_modulesloaddir} install.modules-load
|
|
||||||
%endif
|
|
||||||
|
|
||||||
sed -i 's;%{buildroot};;g' %{buildroot}%{_bindir}/docker
|
sed -i 's;%{buildroot};;g' %{buildroot}%{_bindir}/docker
|
||||||
|
|
||||||
# do not include docker and podman-remote man pages in main package
|
# do not include docker and podman-remote man pages in main package
|
||||||
|
Reference in New Issue
Block a user