Commit 9e55ff1f authored by Florian Pritz's avatar Florian Pritz
Browse files

Support passing multiple package directories via command line args


Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent cdbc1dc5
......@@ -15,6 +15,10 @@ To upload *all* packages or at least a large subset, combine `find` and `paralle
find /srv/archive/packages -mindepth 2 -maxdepth 2 -type d | parallel --bar -j16 ~/upload_pkg_internetarchive.py > result.txt
Or use:
find /srv/archive/packages -mindepth 2 -maxdepth 2 -type d -exec "/home/archive/archive-uploader/upload_pkg_internetarchive.py" {} +
The script outputs to stdout any package name it couldn't completely upload.
This may be due to archive.org load issues or rate limiting. It also maintains
a database so that you can run it again against all files. Files that have
......
......@@ -90,20 +90,21 @@ class ArchiveUploader:
raise
def main(self, pkg_dir):
"""Upload all versions of a single package"""
pkgname = os.path.basename(pkg_dir)
identifier = self.clean_name('archlinux_pkg_' + pkgname)
metadata = {
'collection': ['archlinuxarchive'],
'mediatype': 'software',
'publisher': 'Arch Linux',
'creator': 'Arch Linux',
'subject': ['archlinux', 'archlinux package'],
}
metadata['title'] = pkgname + " package archive from Arch Linux"
metadata['subject'].append(pkgname)
self.upload_pkg(identifier, pkgname, metadata, pkg_dir)
def main(self, pkg_dirs):
"""Upload all versions of each package"""
for pkg_dir in pkg_dirs:
pkgname = os.path.basename(pkg_dir)
identifier = self.clean_name('archlinux_pkg_' + pkgname)
metadata = {
'collection': ['archlinuxarchive'],
'mediatype': 'software',
'publisher': 'Arch Linux',
'creator': 'Arch Linux',
'subject': ['archlinux', 'archlinux package'],
}
metadata['title'] = pkgname + " package archive from Arch Linux"
metadata['subject'].append(pkgname)
self.upload_pkg(identifier, pkgname, metadata, pkg_dir)
if __name__ == '__main__':
ArchiveUploader().main(sys.argv[1])
ArchiveUploader().main(sys.argv[1:])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment