Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/scripts/install-hub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -eux

curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s v2.14.2
39 changes: 39 additions & 0 deletions .github/scripts/sync-with-master.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash -eux

#
# This variable must be passed into this script.
#
[[ -n "${BRANCH}" ]] || exit 1

#
# We need these config parameters set in order to do the git-merge.
#
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

#
# We need the full git repository history in order to do the git-merge.
#
git fetch --unshallow

#
# In order to open a pull request, we need to push to a remote branch.
# To avoid conflicting with existing remote branches, we use branches
# within the "sync-with-master" namespace.
#
git checkout -b "sync-with-master/${BRANCH}" "origin/${BRANCH}"
git merge -Xtheirs origin/master
git push -f origin "sync-with-master/${BRANCH}"

#
# Opening a pull request may fail if there already exists a pull request
# for the branch; e.g. if a previous pull request was previously made,
# but not yet merged by the time we run this "sync" script again. Thus,
# rather than causing the automation to report a failure in this case,
# we swallow the error and report success.
#
# Additionally, as along as the git branch was properly updated (via the
# "git push" above), the existing PR will have been updated as well, so
# the "hub" command is unnecessary (hence ignoring the error).
#
git log -1 --format=%B | hub pull-request -F - -b "${BRANCH}" || true
21 changes: 21 additions & 0 deletions .github/workflows/sync-with-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
branches:
- master
schedule:
- cron: '0 0 * * *'

jobs:
sync:
strategy:
matrix:
branch:
- 6.0/stage
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- run: ./.github/scripts/install-hub.sh
- run: ./.github/scripts/sync-with-master.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ matrix.branch }}
20 changes: 9 additions & 11 deletions sdb/commands/internal/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Table:
#
# pylint: disable=bad-continuation
def __init__(
self,
fields: List[str],
rjustfields: Optional[Set[str]] = None,
formatters: Optional[Dict[str, Callable[[Any], str]]] = None
) -> None:
self,
fields: List[str],
rjustfields: Optional[Set[str]] = None,
formatters: Optional[Dict[str, Callable[[Any],
str]]] = None) -> None:
self.fields = fields

if rjustfields is None:
Expand Down Expand Up @@ -93,13 +93,11 @@ def print_(self,
continue

line_fields = []
for fid in range(len(self.fields)):
if self.fields[fid] in self.rjustfields:
for fid, field in enumerate(self.fields):
if field in self.rjustfields:
line_fields.append(
f"{row_values[fid]:>{self.maxfieldlen[self.fields[fid]]}}"
)
f"{row_values[fid]:>{self.maxfieldlen[field]}}")
else:
line_fields.append(
f"{row_values[fid]:<{self.maxfieldlen[self.fields[fid]]}}"
)
f"{row_values[fid]:<{self.maxfieldlen[field]}}")
print(delimeter.join(line_fields))
2 changes: 1 addition & 1 deletion sdb/commands/linux/per_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ class LxPerCpuCounterSum(sdb.SingleInputCommand):
def _call_one(self, obj: drgn.Object) -> Iterable[drgn.Object]:
try:
sum_ = drgn_percpu.percpu_counter_sum(obj)
except AttributeError as err:
except AttributeError:
raise sdb.CommandError(self.name, "input is not a percpu_counter")
yield drgn.Object(sdb.get_prog(), type="s64", value=sum_)
4 changes: 2 additions & 2 deletions sdb/commands/linux/slabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def no_input(self) -> Iterable[drgn.Object]:
yield from sorted(
self.__no_input_iterator(),
key=Slabs.FIELDS[self.args.s],
reverse=(
self.args.s not in Slabs.DEFAULT_INCREASING_ORDER_FIELDS))
reverse=(self.args.s
not in Slabs.DEFAULT_INCREASING_ORDER_FIELDS))
else:
yield from self.__no_input_iterator()

Expand Down
4 changes: 2 additions & 2 deletions sdb/commands/spl/spl_kmem_caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def no_input(self) -> Iterable[drgn.Object]:
yield from sorted(
kmem.for_each_spl_kmem_cache(),
key=SplKmemCaches.FIELDS[self.args.s],
reverse=(self.args.s not in
SplKmemCaches.DEFAULT_INCREASING_ORDER_FIELDS))
reverse=(self.args.s
not in SplKmemCaches.DEFAULT_INCREASING_ORDER_FIELDS))
else:
yield from kmem.for_each_spl_kmem_cache()

Expand Down
1 change: 0 additions & 1 deletion sdb/commands/zfs/internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# pylint: disable=missing-docstring

import os
from typing import List

import drgn
import sdb
Expand Down
2 changes: 1 addition & 1 deletion sdb/commands/zfs/metaslab.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,6 @@ def from_vdev(self, vdev: drgn.Object) -> Iterable[drgn.Object]:
i, int(vdev.vdev_ms_count), int(vdev.vdev_id)))
yield vdev.vdev_ms[i]
else:
for i in range(0, int(vdev.vdev_ms_count)):
for i in range(int(vdev.vdev_ms_count)):
msp = vdev.vdev_ms[i]
yield msp
2 changes: 1 addition & 1 deletion sdb/commands/zfs/vdev.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ def from_vdev(self, vdev: drgn.Object) -> Iterable[drgn.Object]:
self.name, "when providing a vdev, "
"specific child vdevs can not be requested")
yield vdev
for cid in range(0, int(vdev.vdev_children)):
for cid in range(int(vdev.vdev_children)):
cvd = vdev.vdev_child[cid]
yield from self.from_vdev(cvd)
2 changes: 1 addition & 1 deletion sdb/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#o
#
# Copyright 2019 Delphix
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from setuptools import setup, find_packages
from setuptools import setup

setup(
name='sdb',
Expand Down