Skip to content

Commit

Permalink
Added preliminary support for proposed channel components.
Browse files Browse the repository at this point in the history
Proposed channels component won't influence the "channel disabled" state and don't get
enabled automatically.

Proposed components permit to provide updates strictly related to a channel without the need
of creating a new one.

Signed-off-by: Eugenio Paolantonio (g7) <[email protected]>
  • Loading branch information
g7 committed May 16, 2015
1 parent 179db8a commit 4376af5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
2 changes: 2 additions & 0 deletions dryrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
print("semplice-current", not (False in resolver.relations["semplice-current"]))
print(resolver.is_channel_enableable("semplice-jessie"))

print("semplice-current enabled: %s" % discovery.cache["semplice-current"].enabled)

# Print blockers for some channels
for channel in ["semplice-current", "semplice-jessie"]:
print("%s blockers: %s" % (channel, resolver.get_channel_blockers(channel)))
Expand Down
32 changes: 26 additions & 6 deletions libchannels/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def disable(self):
print("Disabling %s channel..." % self.channel_name)

for repository, source_entry in self.repositories.items():
source_entry.set_enabled(False)
if source_entry: source_entry.set_enabled(False)

libchannels.common.sourceslist.save()

Expand All @@ -96,6 +96,10 @@ def enable(self):
print("Enabling %s channel..." % self.channel_name)

for repository, source_entry in self.repositories.items():
if self.is_proposed(repository):
# Proposed components should be enabled manually
continue

if type(source_entry) == SourceEntry:
source_entry.set_enabled(True)
else:
Expand Down Expand Up @@ -167,15 +171,31 @@ def check(self, uri, origin, label, codename, source_entry):
# Good!
self.repositories[repository] = source_entry

def is_sourceentry_enabled(self, repository):
def is_proposed(self, name):
"""
Returns True if the repository name is proposed, False if not.
"""

return (
"proposed" in self[name] and
self[name].getboolean("proposed")
)

def is_sourceentry_enabled(self, name, repository, skip_proposed=False):
"""
Returns True if the sourceentry is enabled, False if not.
"""

return (
type(repository) == SourceEntry and
not repository.disabled
)
(
type(repository) == SourceEntry and
not repository.disabled
) or
(
skip_proposed and
self.is_proposed(name)
)
)

@property
def enabled(self):
Expand All @@ -184,4 +204,4 @@ def enabled(self):
"""

#return (not (None in self.repositories.values()))
return (not (False in [self.is_sourceentry_enabled(x) for x in self.repositories.values()]))
return (not (False in [self.is_sourceentry_enabled(x, y, skip_proposed=True) for x, y in self.repositories.items()]))
7 changes: 7 additions & 0 deletions semplice-current.channel
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ default_mirror = http://archive.semplice-linux.org/semplice/archive/
origin = Semplice Project
codename = changes-unstable
components = main contrib non-free

[proposed]
default_mirror = http://archive.semplice-linux.org/semplice/archive/
origin = Semplice Project
codename = proposed-unstable
components = main contrib non-free
proposed = yes

0 comments on commit 4376af5

Please sign in to comment.