Skip to content

Commit

Permalink
Visit most files and adjust for 22.04 release
Browse files Browse the repository at this point in the history
This visits most of the batch files and ensures that they work with
what is available in the charms/ directory rather than relying on
charms.txt. This is to enable release tools to be used with releases on
sections. (Eventually, all the tools will work with lp-builder-config
directly).
  • Loading branch information
ajkavanagh committed Apr 15, 2022
1 parent 623cec6 commit 2096528
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 544 deletions.
35 changes: 0 additions & 35 deletions _do-batch-add-build-lock-file

This file was deleted.

29 changes: 0 additions & 29 deletions _do-batch-cp-stable-candidate

This file was deleted.

32 changes: 0 additions & 32 deletions _do-batch-flip-master-libs-to-stable

This file was deleted.

34 changes: 0 additions & 34 deletions _do-clean-reactive

This file was deleted.

7 changes: 6 additions & 1 deletion _do-reset-hard-branch
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/bin/bash -e
# Do a reset in all the charms; great for undoing damage and starting again.

charms="$(cat charms.txt)"
charms=$(cd charms && ls -d1 *)
branch=$1

if [ -z "$branch" ]; then
echo "Please provide the branch name as the param."
exit 1
fi

for charm in $charms; do
if [ ! -d "charms/$charm" ]; then
echo "Use ./get-charms master to clone the charm dirs first ($charm not found)"
Expand Down
8 changes: 7 additions & 1 deletion _do-single-charm-amend-review
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
topic=$1
script_dir="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)"

if [ -z "$topic" ]; then
echo "Please provide the topic as the only param."
echo "Usage $0 <topic>"
exit 1
fi

_dir=$(pwd)
# verify that the branch isn't master
branch=$(git branch --show-current | tr -d '\n')
Expand All @@ -20,7 +26,7 @@ if [[ -n "$git_status" ]]; then
echo "Updating, no-edit-amend and git review with topic for ${_dir}"
git add .
git commit --amend --no-edit
git review -t charmhub-migration-yoga
git review -t $topic
else
echo "Nothing to do as git repo is not dirty."
fi
87 changes: 0 additions & 87 deletions _ensure_master_libraries_all_charms

This file was deleted.

51 changes: 0 additions & 51 deletions _ensure_reactive_charms_master_libraries

This file was deleted.

25 changes: 14 additions & 11 deletions _update-metadata.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


def usage():
print("usage: {} [list | add | remove | ensure] [<series, ...]"
print("usage: {} <charm> [list | add | remove | ensure] [<series, ...]"
.format(sys.argv[0]))


Expand Down Expand Up @@ -61,27 +61,30 @@ def run_command(cmd, yml):
sys.exit(1)


def charm_dir(cmd):
def metadata_file(cmd):
"""Find the metadata.yaml file"""
charm_dir = os.path.join("charms", cmd.charm)
if not os.path.isdir(charm_dir):
print("dir: {} doesn't exist.".format(charm_dir))
sys.exit(1)
src_charm_dir = os.path.join(charm_dir, "src")
if os.path.isdir(src_charm_dir):
return src_charm_dir
else:
return charm_dir
metadata_in_root = os.path.join(charm_dir, 'metadata.yaml')
if (os.path.isfile(metadata_in_root) and
not os.path.islink(metadata_in_root)):
return metadata_in_root
metadata_in_src = os.path.join(charm_dir, 'src', 'metadata.yaml')
if os.path.isfile(metadata_in_src):
return metadata_in_src
print("Can't find metadata!")
sys.exit(1)


def load_yaml(cmd):
file = os.path.join(charm_dir(cmd), "metadata.yaml")
with open(file) as f:
with open(metadata_file(cmd)) as f:
return YAML.load(f, YAML.RoundTripLoader)


def write_yaml(cmd, yml):
file = os.path.join(charm_dir(cmd), "metadata.yaml")
with open(file, "w") as f:
with open(metadata_file(cmd), "w") as f:
YAML.dump(yml, f, Dumper=YAML.RoundTripDumper)


Expand Down
9 changes: 1 addition & 8 deletions _update-rebuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
# have already been performed. Does not commit, push, or submit/review.
# See `batch-example` for usage as a batch of charm updates.

charms="$(cat charms.txt)"

for charm in $charms; do
if [ ! -d "charms/$charm" ]; then
echo "Use ./get-charms master to clone the charm dirs first ($charm not found)"
exit 1
fi
done
charms=$(cd charms && ls -d1 *)

for charm in $charms; do
charm_type="$(./what-is charms/$charm)"
Expand Down
9 changes: 1 addition & 8 deletions _update-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
# been performed. Does not commit, push, or submit/review.
# See `batch-example` for usage as a batch of charm updates.

charms="$(cat charms.txt)"

for charm in $charms; do
if [ ! -d charms/$charm ]; then
echo "Use ./get-charms master to clone the charm dirs first ($charm not found)"
exit 1
fi
done
charms=$(cd charms && ls -d1 *)

for charm in $charms; do
charm_type="$(./what-is charms/$charm)"
Expand Down
Loading

0 comments on commit 2096528

Please sign in to comment.