[Python-modules-commits] [python-aptly] 01/03: Import python-aptly_0.8.1.orig.tar.gz
Filip Pytloun
fpytloun-guest at moszumanska.debian.org
Tue Jan 17 10:24:29 UTC 2017
This is an automated email from the git hooks/post-receive script.
fpytloun-guest pushed a commit to branch master
in repository python-aptly.
commit f002484a46ede4fe72442983ded56d9d25bc122b
Author: Filip Pytloun <filip at pytloun.cz>
Date: Tue Jan 17 11:20:04 2017 +0100
Import python-aptly_0.8.1.orig.tar.gz
---
aptly/publisher/__init__.py | 31 ++++++++++++++++++-------------
aptly/publisher/__main__.py | 16 +++++++++++++---
setup.py | 2 +-
3 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/aptly/publisher/__init__.py b/aptly/publisher/__init__.py
index 29773bb..2140f43 100644
--- a/aptly/publisher/__init__.py
+++ b/aptly/publisher/__init__.py
@@ -346,22 +346,27 @@ class Publish(object):
}
)
- def create_publish(self, force_overwrite=False, publish_contents=False):
- lg.info("Creating new publish, distribution=%s snapshots=%s" %
- (self.name, self.publish_snapshots))
+ def create_publish(self, force_overwrite=False, publish_contents=False, architectures=None):
+ lg.info("Creating new publish, distribution=%s snapshots=%s, architectures=%s" %
+ (self.name, self.publish_snapshots, architectures))
if self.prefix:
prefix = '/%s' % self.prefix
+ opts = {
+ "SourceKind": "snapshot",
+ "Distribution": self.distribution,
+ "Sources": self.publish_snapshots,
+ "ForceOverwrite": force_overwrite,
+ 'SkipContents': not publish_contents,
+ }
+
+ if architectures:
+ opts['Architectures'] = architectures
+
self.client.do_post(
'/publish%s' % (prefix or ''),
- {
- "SourceKind": "snapshot",
- "Distribution": self.distribution,
- "Sources": self.publish_snapshots,
- "ForceOverwrite": force_overwrite,
- 'SkipContents': not publish_contents,
- },
+ opts
)
def get_publish(self):
@@ -381,13 +386,13 @@ class Publish(object):
return False
def do_publish(self, recreate=False, force_overwrite=False,
- publish_contents=False):
+ publish_contents=False, architectures=None):
self.merge_snapshots()
publish = self.get_publish()
if not publish:
# New publish
- self.create_publish(force_overwrite, publish_contents)
+ self.create_publish(force_overwrite, publish_contents, architectures)
else:
# Test if publish is up to date
to_publish = [x['Name'] for x in self.publish_snapshots]
@@ -399,7 +404,7 @@ class Publish(object):
if recreate:
lg.info("Recreating publish %s" % self.name)
self.drop_publish()
- self.create_publish(force_overwrite, publish_contents)
+ self.create_publish(force_overwrite, publish_contents, architectures)
elif to_publish == published:
lg.info("Publish %s is up to date" % self.name)
else:
diff --git a/aptly/publisher/__main__.py b/aptly/publisher/__main__.py
index 458769c..e889350 100644
--- a/aptly/publisher/__main__.py
+++ b/aptly/publisher/__main__.py
@@ -46,6 +46,7 @@ def main():
group_publish = parser.add_argument_group("Action 'publish'")
group_publish.add_argument('-c', '--config', default="/etc/aptly/publisher.yaml", help="Configuration YAML file")
group_publish.add_argument('--dists', nargs='+', help="Space-separated list of distribution to work with (including prefix), default all.")
+ group_publish.add_argument('--architectures', nargs='+', help="List of architectures to publish (also determined by config, defaults to amd64, i386)")
group_promote = parser.add_argument_group("Action 'promote'")
group_promote.add_argument('--source', help="Source publish to take snapshots from")
@@ -70,7 +71,8 @@ def main():
recreate=args.recreate,
force_overwrite=args.force_overwrite,
publish_contents=args.publish_contents,
- publish_names=args.dists)
+ publish_names=args.dists,
+ architectures=args.architectures)
elif args.action == 'promote':
if not args.source or not args.target:
parser.error("Action 'promote' requires both --source and --target arguments")
@@ -213,7 +215,9 @@ def action_diff(source, target, components=[], packages=True):
def action_publish(client, publishmgr, config_file, recreate=False,
force_overwrite=False, publish_contents=False,
- publish_names=None):
+ publish_names=None, architectures=None):
+ if not architectures:
+ architectures = []
snapshots = client.do_get('/snapshots', {'sort': 'time'})
config = load_config(config_file)
@@ -226,6 +230,9 @@ def action_publish(client, publishmgr, config_file, recreate=False,
distributions=repo['distributions'],
snapshot=snapshot
)
+ for arch in repo.get('architectures', []):
+ if arch not in architectures:
+ architectures.append(arch)
for name, repo in config.get('repo', {}).items():
snapshot = get_latest_snapshot(snapshots, name)
@@ -236,10 +243,13 @@ def action_publish(client, publishmgr, config_file, recreate=False,
distributions=repo['distributions'],
snapshot=snapshot
)
+ for arch in repo.get('architectures', []):
+ if arch not in architectures:
+ architectures.append(arch)
publishmgr.do_publish(recreate=recreate, force_overwrite=force_overwrite,
publish_contents=publish_contents,
- names=publish_names)
+ names=publish_names, architectures=architectures)
if __name__ == '__main__':
diff --git a/setup.py b/setup.py
index 6003dbc..9a1be58 100755
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ long_desc = open('README.rst').read()
setup(
name="python-aptly",
- version="0.8",
+ version="0.8.1",
description="Aptly REST API client and tooling",
long_description=long_desc,
author="Filip Pytloun",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-aptly.git
More information about the Python-modules-commits
mailing list