<commit_before>#! /usr/bin/python

import os
import time

from datetime import datetime
from launchpadlib.launchpad import Launchpad

# basic data
arches = ['amd64', 'arm64', 'ppc64el']
series = 'xenial'

# basic paths
home = os.getenv("HOME")
workdir = os.path.join(home, "juju-daily-snap")

# we need to store credentials once for cronned builds
cachedir = os.path.join(workdir, "cache")
creds = os.path.join(workdir, "credentials")

# log in
launchpad = Launchpad.login_with('Juju Snap Builds',
                                 'production', cachedir,
                                 credentials_file=creds,
                                 version='devel')

# get team data and ppa
jujuqa = launchpad.people['jujuisquality']

# get snap
juju_snap = launchpad.snaps.getByName(name='juju-edge',
                                      owner=jujuqa)

# get distro info
ubuntu = launchpad.distributions['ubuntu']
release = ubuntu.getSeries(name_or_version=series)

# print a stamp
stamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print("Trying to trigger builds at: {}".format(stamp))

# loop over arches and trigger builds
mybuilds = []
for buildarch in arches:
    arch = release.getDistroArchSeries(archtag=buildarch)
    request = juju_snap.requestBuild(archive=release.main_archive,
                                     distro_arch_series=arch,
                                     pocket='Updates')<commit_msg>Switch snap builder to juju-qa-bot, add s390x, update instructions on initial credential creation<commit_after>#! /usr/bin/python

import os
import time

from datetime import datetime
from launchpadlib.launchpad import Launchpad

# basic data
arches = ['amd64', 'arm64', 'ppc64el', 's390x']
series = 'xenial'

# basic paths
home = os.getenv("HOME")
workdir = os.path.join(home, "juju-daily-snap")

# we need to store credentials once for cronned builds
# To get the initial credentials, run this script manually
# On a server, first install elinks
# This will enable you to complete the authorization process
# launchpad will require through the console browser
cachedir = os.path.join(workdir, "cache")
creds = os.path.join(workdir, "credentials")

# log in
launchpad = Launchpad.login_with('Juju Snap Builds',
                                 'production', cachedir,
                                 credentials_file=creds,
                                 version='devel')

# get team data and ppa
jujuqa = launchpad.people['juju-qa-bot']

# get snap
juju_snap = launchpad.snaps.getByName(name='juju-edge',
                                      owner=jujuqa)

# get distro info
ubuntu = launchpad.distributions['ubuntu']
release = ubuntu.getSeries(name_or_version=series)

# print a stamp
stamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print("Trying to trigger builds at: {}".format(stamp))

# loop over arches and trigger builds
mybuilds = []
for buildarch in arches:
    arch = release.getDistroArchSeries(archtag=buildarch)
    request = juju_snap.requestBuild(archive=release.main_archive,
                                     distro_arch_series=arch,
                                     pocket='Updates')
{'fraction_non_alphanumeric': 0.10548119821542384, 'fraction_numerical': 0.0057361376673040155, 'mean_word_length': 2.823386114494519, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7281239', 'n_tokens_mistral': 979, 'n_tokens_neox': 914, 'n_words': 247}