Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update debian files with workflows #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Security check - Bandit

on:
push:
branches: [ "*" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-22.04
permissions:
checks: write # for bandit-report-artifacts to publish the checks
contents: read # for actions/checkout to fetch code
security-events: write # for bandit-report-artifacts to upload results
actions: read # only on private (maybe?) required to get the Action run status

steps:
- uses: actions/checkout@v4

- name: Run bandit
uses: VCTLabs/bandit-report-artifacts@v2
with:
project_path: src
ignore_failure: false
config_file: pyproject.toml
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
name: Test bmaptool

on:
- push
- pull_request
push:
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:
test:
Expand All @@ -19,7 +21,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -40,5 +42,5 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: psf/black@stable
85 changes: 85 additions & 0 deletions .github/workflows/debs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Debian packages

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:
get_version:
name: Get version info
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
outputs:
version: ${{ steps.git_ver.outputs.version }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get package version
id: git_ver
run: |
version=$(git describe --tags | sed -e "s|v||" -e "s|-g|+g|")
echo "Version from git: ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT

build_debs:
name: ${{ matrix.name }}
runs-on: ubuntu-22.04
needs: [get_version]

strategy:
fail-fast: false
matrix:
name: [
x64_bookworm,
x64_trixie,
x64_sid,
]

include:
- name: x64_bookworm
dist: bookworm

- name: x64_trixie
dist: trixie

- name: x64_sid
dist: sid

steps:
- name: Check github variables
env:
VERSION: ${{ needs.get_version.outputs.version }}
run: |
echo "Package version from git: ${VERSION}"

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install deps and update debian changelog
run: |
sudo apt-get update
sudo apt-get install devscripts
debchange -v ${{ needs.get_version.outputs.version }}-${{ matrix.dist }} -b -M --distribution ${{ matrix.dist }} "ci build"

- name: Build deb packages
uses: jtdor/build-deb-action@v1
env:
DEB_BUILD_OPTIONS: noautodbgsym
with:
docker-image: "debian:${{ matrix.dist }}-slim"
buildpackage-opts: --build=binary --no-sign
extra-build-deps: git

- name: Upload deb files
uses: actions/upload-artifact@v4
with:
name: "bmaptool_${{ needs.get_version.outputs.version }}-${{ matrix.dist }}"
path: ./debian/artifacts/*.deb
1 change: 0 additions & 1 deletion debian/bmaptool.docs

This file was deleted.

1 change: 0 additions & 1 deletion debian/bmaptool.install

This file was deleted.

8 changes: 4 additions & 4 deletions debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bmaptool (3.8.0) unstable; urgency=low
variations
* switch to use an X.Y.Z versioning number scheme

-- Trevor Woerner <[email protected]> Mon, 18 Mar 2024 23:44:10 -0400
-- Trevor Woerner <[email protected]> Mon, 18 Mar 2024 23:44:10 -0400

bmap-tools (3.7) unstable; urgency=low

Expand All @@ -17,22 +17,22 @@ bmap-tools (3.7) unstable; urgency=low
* Add functionality for copying from standard input (#99)
* Switch from gpg to gpgme module (#103)

-- Artem Bityutskiy <[email protected]> Wed, 02 Aug 2023 15:11:26 +0300
-- Artem Bityutskiy <[email protected]> Wed, 02 Aug 2023 15:11:26 +0300

bmap-tools (3.6) unstable; urgency=low

* Improve ZFS compatibility.
* Added the 'zstd' compression type support.
* Add '--psplash-pipe' option for interacting with psplash.

-- Artem Bityutskiy <[email protected]> Tue, 02 Feb 2021 14:08:41 +0200
-- Artem Bityutskiy <[email protected]> Tue, 02 Feb 2021 14:08:41 +0200

bmap-tools (3.5) unstable; urgency=low

* Fixed copying of compressed files from URLs
* Python 3.x support fixes and improvements.

-- Artem Bityutskiy <[email protected]> Thu, 23 Aug 2018 10:34:31 +0300
-- Artem Bityutskiy <[email protected]> Thu, 23 Aug 2018 10:34:31 +0300

bmap-tools (3.4) unstable; urgency=low

Expand Down
1 change: 1 addition & 0 deletions debian/clean
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bmap_tools.egg-info/
1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

66 changes: 41 additions & 25 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,47 @@ Source: bmaptool
Maintainer: Trevor Woerner <[email protected]>
Section: utils
Priority: optional
Build-Depends: debhelper (>= 9),
python3 (>= 3.8),
python3-setuptools,
Standards-Version: 3.8.4
XS-Python-Version: >= 3.8
Build-Depends:
debhelper-compat (= 10),
dh-python,
python3-all,
python3-setuptools,
pybuild-plugin-pyproject,
python3-hatchling,
python3-gpg,
python3-six,
python3-defusedxml,
python3-all-dev,
python3-pytest,
Standards-Version: 4.5.0
Vcs-Git: https://github.com/yoctoproject/bmaptool.git
Vcs-Browser: https://github.com/yoctoproject/bmaptool
Homepage: https://github.com/yoctoproject/bmaptool
Rules-Requires-Root: no
X-Python3-Version: >= 3.8

Package: bmaptool
Architecture: all
Depends: python (>=3.8),
python-gpgme,
${misc:Depends},
${python:Depends},
bzip2,
pbzip2,
gzip,
pigz,
lzop,
liblz4-tool,
xz-utils,
tar,
unzip,
zstd
Description: Tools to generate block map (AKA bmap) and flash images using
bmap. bmaptool is a generic tool for creating the block map (bmap) for a file,
and copying files using the block map. The idea is that large file containing
unused blocks, like raw system image files, can be copied or flashed a lot
faster with bmaptool than with traditional tools like "dd" or "cp". See
source.tizen.org/documentation/reference/bmaptool for more information.
Depends:
python3,
python3-gpg,
python3-defusedxml,
${misc:Depends},
${python3:Depends},
Recommends:
bzip2,
lzop,
xz-utils,
Suggests:
lz4,
pbzip2,
pigz,
unzip,
Provides:
bmaptool (= ${binary:Version}),
Description: tool to flash image files to block devices using the block map
bmaptool is a generic tool for creating the block map (bmap) for a
file, and copying files using the block map. The idea is that large
file containing unused blocks, like raw system image files, can be
copied or flashed a lot faster with bmaptool than with traditional
tools like "dd" or "cp".
39 changes: 33 additions & 6 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-name: bmaptool
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: bmaptool
Upstream-Contact: Trevor Woerner <[email protected]>
Source: https://github.com/yoctoproject/bmaptool
.
Source: https://github.com/yoctoproject/bmaptool.git
Comment:
The initial package was put together by Ed Bartosh <[email protected]>
on Sun Oct 27 22:32:19 EEST 2012.

Files: *
Copyright: © 2012-2013 Intel, Inc.
Copyright: © 2012-2014 Intel, Inc.
License: GPL-2

Files: debian/*
Copyright: © 2012-2013 Intel, Inc.
Copyright:
© 2012-2013 Intel, Inc.
© 2014-2018 Simon McVittie
License: GPL-2

Files:
debian/tests/web-server.py
Copyright:
© 2017-2019 Red Hat Inc.
License: LGPL-2.1+
Comment: Copied from the Flatpak test suite

License: GPL-2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2,
Expand All @@ -26,3 +35,21 @@ License: GPL-2
Comment:
On Debian systems, the full text of the GPL v2 can be found
in /usr/share/common-licenses/GPL-2.

License: LGPL-2.1+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Comment:
On Debian systems, the full text of the GNU Lesser General Public License
version 2.1 can be found in the file '/usr/share/common-licenses/LGPL-2.1'.
6 changes: 6 additions & 0 deletions debian/gbp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[DEFAULT]
debian-branch = debian/latest
upstream-branch = upstream/latest
pristine-tar = True
upstream-vcs-tag = v%(version)s
patch-numbers = False
23 changes: 22 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#!/usr/bin/make -f

#export DH_VERBOSE = 1
export PYBUILD_NAME = bmaptool

PYTHON3S:=$(shell py3versions -vr)

%:
dh $@ --with=python3
dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_clean:
dh_auto_clean
dh_clean PKG-INFO
dh_clean .pytest_cache/ src/*.egg-info/

override_dh_auto_configure:
dh_auto_configure -- $(CONFIGURE_ARGS)
dh_auto_configure --buildsystem=pybuild

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
set -e ; for pyvers in $(PYTHON3S); do \
PYTHONPATH="./src" python$$pyvers -m pytest -k 'not TestCLI' tests ; \
done
endif
3 changes: 3 additions & 0 deletions debian/salsa-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
3 changes: 3 additions & 0 deletions debian/tests/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Tests: smoke
Depends: bmaptool, dosfstools, python3
Restrictions: allow-stderr
29 changes: 29 additions & 0 deletions debian/tests/smoke
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

set -eu

here="$(dirname "$0")"
here="$(readlink -f "$here")"

cd "${AUTOPKGTEST_TMP}"

mkdir webroot
rm -f httpd-pipe
mkfifo httpd-pipe
"$here/web-server.py" webroot 3> httpd-pipe &
httpd_pid="$!"
read ignored < httpd-pipe

truncate -s10M webroot/filesystem.img
/sbin/mkfs.vfat webroot/filesystem.img
bmaptool create webroot/filesystem.img > webroot/filesystem.img.bmap
cat webroot/filesystem.img.bmap

bmaptool copy webroot/filesystem.img filesystem.out
diff -s webroot/filesystem.img filesystem.out

gzip -9n webroot/filesystem.img
bmaptool copy "http://127.0.0.1:$(cat httpd-port)/filesystem.img.gz" filesystem.out2
diff -s filesystem.out filesystem.out2

kill "$httpd_pid"
Loading