Add new create-filelist call from https://pagure.io/quick-fedora-mirror to replace the rsync call to make fullfiletimelist file. This should allow quick-fedora-mirror script to work.
This commit is contained in:
parent
f50b6ed713
commit
d1b34d3fc7
6 changed files with 87 additions and 2 deletions
36
roles/bodhi2/backend/files/create-filelist
Normal file
36
roles/bodhi2/backend/files/create-filelist
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# A simple script to generate a file list in a format easily consumable by a
|
||||
# shell script.
|
||||
|
||||
# Originally written by Jason Tibbitts <tibbs@math.uh.edu> in 2016.
|
||||
# Donated to the public domain. If you require a statement of license, please
|
||||
# consider this work to be licensed as "CC0 Universal", any version you choose.
|
||||
|
||||
|
||||
from scandir import scandir
|
||||
|
||||
|
||||
def get_ftype(entry):
|
||||
"""Return a simple indicator of the file type."""
|
||||
if entry.is_symlink():
|
||||
return 'l'
|
||||
if entry.is_dir():
|
||||
return 'd'
|
||||
return 'f'
|
||||
|
||||
|
||||
def recursedir(path):
|
||||
"""Just like scandir, but recursively."""
|
||||
for entry in scandir(path):
|
||||
if entry.is_dir(follow_symlinks=False):
|
||||
for rentry in recursedir(entry.path):
|
||||
yield rentry
|
||||
yield entry
|
||||
|
||||
|
||||
for entry in recursedir('.'):
|
||||
info = entry.stat(follow_symlinks=False)
|
||||
modtime = max(info.st_mtime, info.st_ctime)
|
||||
ftype = get_ftype(entry)
|
||||
print('{} {} {}'.format(modtime, ftype, entry.path[2:]))
|
|
@ -25,7 +25,7 @@ popd > /dev/null
|
|||
|
||||
TMPFILE=$(mktemp -p /tmp/)
|
||||
pushd /pub/$MOD > /dev/null
|
||||
/usr/bin/rsync --no-h --list-only -r . > $TMPFILE
|
||||
/usr/local/bin/create-filelist . > $TMPFILE
|
||||
if diff $TMPFILE fullfiletimelist > /dev/null; then
|
||||
rm -f $TMPFILE
|
||||
else
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
- python-mock
|
||||
- sigul
|
||||
- python-alembic
|
||||
- python-scandir
|
||||
tags:
|
||||
- packages
|
||||
- bodhi
|
||||
|
@ -228,6 +229,14 @@
|
|||
- bodhi
|
||||
- cron
|
||||
|
||||
- name: add create-filelist script from quick-fedora-mirror
|
||||
copy: src=create-filelist dest=/usr/local/bin/create-filelist mode=0755
|
||||
when: inventory_hostname.startswith('bodhi-backend01') and env == "production"
|
||||
tags:
|
||||
- config
|
||||
- bodhi
|
||||
- cron
|
||||
|
||||
- name: Updates sync cron job.
|
||||
cron: name="updates-sync" minute="15,45" user="ftpsync"
|
||||
job="/usr/local/bin/lock-wrapper fedora-updates-push '/usr/local/bin/fedora-updates-push && /usr/local/bin/update-fullfilelist fedora'"
|
||||
|
|
36
roles/releng/files/create-filelist
Normal file
36
roles/releng/files/create-filelist
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# A simple script to generate a file list in a format easily consumable by a
|
||||
# shell script.
|
||||
|
||||
# Originally written by Jason Tibbitts <tibbs@math.uh.edu> in 2016.
|
||||
# Donated to the public domain. If you require a statement of license, please
|
||||
# consider this work to be licensed as "CC0 Universal", any version you choose.
|
||||
|
||||
|
||||
from scandir import scandir
|
||||
|
||||
|
||||
def get_ftype(entry):
|
||||
"""Return a simple indicator of the file type."""
|
||||
if entry.is_symlink():
|
||||
return 'l'
|
||||
if entry.is_dir():
|
||||
return 'd'
|
||||
return 'f'
|
||||
|
||||
|
||||
def recursedir(path):
|
||||
"""Just like scandir, but recursively."""
|
||||
for entry in scandir(path):
|
||||
if entry.is_dir(follow_symlinks=False):
|
||||
for rentry in recursedir(entry.path):
|
||||
yield rentry
|
||||
yield entry
|
||||
|
||||
|
||||
for entry in recursedir('.'):
|
||||
info = entry.stat(follow_symlinks=False)
|
||||
modtime = max(info.st_mtime, info.st_ctime)
|
||||
ftype = get_ftype(entry)
|
||||
print('{} {} {}'.format(modtime, ftype, entry.path[2:]))
|
|
@ -25,7 +25,7 @@ popd > /dev/null
|
|||
|
||||
TMPFILE=$(mktemp -p /tmp/)
|
||||
pushd /pub/$MOD > /dev/null
|
||||
/usr/bin/rsync --no-h --list-only -r . > $TMPFILE
|
||||
/usr/local/bin/create-filelist . > $TMPFILE
|
||||
if diff $TMPFILE fullfiletimelist > /dev/null; then
|
||||
rm -f $TMPFILE
|
||||
else
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
- name: add ftpsync user
|
||||
user: name=ftpsync uid=263 group=ftpsync createhome=yes system=yes state=present
|
||||
|
||||
- name: add create-filelist script from quick-fedora-mirror
|
||||
copy: src=create-filelist dest=/usr/local/bin/create-filelist mode=0755 owner=ftpsync group=ftpsync
|
||||
|
||||
- name: add the ftpsync update-fullfilelist script
|
||||
copy: src=update-fullfilelist dest=/usr/local/bin/update-fullfilelist owner=ftpsync group=ftpsync mode=555
|
||||
|
||||
|
@ -111,6 +114,7 @@
|
|||
- hardlink
|
||||
- pungi
|
||||
- compose-utils
|
||||
- python-scandir
|
||||
when: ansible_distribution_major_version|int > 21
|
||||
|
||||
# add sigul to secondary arch compose boxes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue