diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index c74d0b56..35c9c28b 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -108,6 +108,39 @@ jobs: target/*/release/sniffnet.exe if-no-files-found: error + deb-source: + runs-on: ubuntu-latest + container: + image: debian:latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + default: true + + - name: Install packaging tools + run: cargo install debcargo + + - name: Source Debian Package + shell: bash + run: | + mkdir artifacts + export DEBFULLNAME="Giuliano Bellini" + export DEBEMAIL="gyulyvgc99@gmail.com" + debcargo package --config resources/packaging/linux/deb-source/debcargo.toml sniffnet + mv rust-sniffnet-1.2.1 artifacts/ + + - name: Upload package artifacts + uses: actions/upload-artifact@v3 + with: + name: deb-source + path: artifacts/ + deb: runs-on: ubuntu-latest container: diff --git a/resources/packaging/linux/deb-source/debcargo.toml b/resources/packaging/linux/deb-source/debcargo.toml new file mode 100644 index 00000000..3a559c02 --- /dev/null +++ b/resources/packaging/linux/deb-source/debcargo.toml @@ -0,0 +1,242 @@ +# Whether to generate a package for the binary crate. If omitted, defaults to +# true unless semver_suffix (see below) is also true. +bin = true + +# Name for the binary crate. Defaults to "" which means the crate +# name, with no "rust-" prefix and with underscores replaced by hyphens. +bin_name = "sniffnet" + +# Add the semver to the package name, to allow co-installation with other +# versions of the same crate. This should only be true for crates older than +# the most up-to-date version in Debian, and only if they are needed as a +# (direct or indirect) build dependency of another binary crate. +# If you set this to true, you should either omit "bin" or set it to false, +# unless you are sure the old and new packages are co-installable. +#semver_suffix = false + +# Overlay directory to copy on top of the generated one, given relative to the +# directory that contains this config file. If any files conflict with the ones +# generated by debcargo, the latter are moved to .debcargo.hint instead. +# For the special case of debian/changelog, generated entries will be prepended +# to the top of the existing d/changelog (from the overlay), rather than stored +# in debian/changelog.debcargo.hint. A further exception: if the distribution +# of the top entry in the existing d/changelog is +# UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO then that whole entry will be +# *replaced* with the generated entry, not prepended. +# Normally, any "hints" generated are written back to the overlay directory, +# overwriting any hints that may have previously been stored there. For the +# special case of debian/changelog, that is written-back as-is. Therefore, it +# is strongly recommended that you keep the overlay directory tracked in +# version control. To disable this behaviour, give --no-overlay-write-back on +# the debcargo command line. +# +#overlay = "." + +# Local directory where crate can be found, instead of crates.io. Resolved +# relative to the directory that contains this config file. Note: this is +# currently experimental and only works for crates whose dependencies are all +# published on crates.io. For example, not rustup. This limitation will +# hopefully be fixed in the future. +# +#crate_src_path = "../.." + +# Paths from the crate tarball, to exclude from the orig tarball. +# See https://docs.rs/glob/latest/glob/struct.Pattern.html for syntax +#excludes = ["libgit2/**"] + +# Paths from the crate tarball, that have been manually reviewed to adhere to +# Debian policy. debcargo has a crude method for detecting files that might not +# fit within policy, and will give a fatal error if any are detected. In the +# exceptional cases where the method gives a false-positive, add them here. +#whitelist = ["libgit2/**"] + +# Whether to allow prerelease deps, by rewriting these to the released version. +# This should only be enabled for certain crates if really necessary, and first +# you should check that they can actually build when this is enabled. +#allow_prerelease_deps = false + +# This is the stem of the short description for each binary package. By default +# `debcargo` will try to auto-extract a description from `Cargo.toml` but +# sometimes this may lead to a meaningless, weird short description. +# The full short description of each binary package is constructed using this +# string plus an auto-generated suffix. The full string can be overridden by +# the [packages.KEY].summary config key, see below. +summary = "Application to comfortably monitor Internet traffic" + +# This is the stem of the long description for each binary package. By default +# this is empty. +# The full long description of each binary package is constructed using this +# string plus an auto-generated suffix. The full string can be overridden by +# the [packages.KEY].description config key, see below. +description = """ +Features: +- Choose a network adapter of your PC to inspect +- Select a set of filters to apply to the observed traffic; +- View overall statistics about your Internet traffic; +- View real-time charts about traffic intensity (bytes and packets per second, incoming and outgoing); +- Get details about domain names and network providers of the hosts you are exchanging traffic with; +- Identify connections in your local network; +- Get information about the country of the remote hosts (IP geolocation); +- Save your favorite network hosts; +- Set custom notifications to inform you when defined network events occur; +- Choose the style that fits you the most from 4 different available themes; +- Inspect each of your network connections in real time; +- Save complete textual report with detailed information for each network connection: + - Source and destination IP addresses, + - Source and destination ports, + - Carried protocols, + - Amount of exchanged packets and bytes, + - Initial and final timestamp of information exchange +""" + +# Maintainer +# Defaults to pkg-rust-team, should only be overriden with care. If overridden, +# vcs_* in [source] should also be overridden, otherwise they point the Rust +# Team's salsa project. +#maintainer = "PLACEHOLDER" + +# Uploaders. This affects the Uploaders: field in debian/control as well as the +# additional maintainers listed in debian/copyright. The naming is historical; +# in Debian today for team-maintained packages, this is generally taken to mean +# "the main individuals" responsible for the package - anyone on the team is +# "morally allowed" to perform the upload as long as they specify "Team upload" +# in debian/changelog; this is done automatically by debcargo. +uploaders = [ "Giuliano Bellini " ] + +# This is a temporary work-around in order to address situations where certain +# Debian infrastructure people claim (without supplying concrete evidence) that +# rust crate metadata is "too large". This flag addresses this, effectively by +# forcing all crate features together into a single feature. This increases the +# dependency footprint of the generated packages and therefore should not be +# enabled unless absolutely necessary. It can also cause cyclic dependencies in +# some cases, and in these cases it simply cannot be enabled, as packages in +# the cycle become uninstallable. Most crates should not need this, and you +# should not enable this just because "somebody told you so". +#collapse_features = false + +# Set the Rules-Requires-Root field in debian/control; by default, this is set +# to "no" +#requires_root = "yes" + +[source] + +# Debian Standards-Version to use. By default debcargo uses latest policy version. +#policy = "4.0.0" + +# Override or provide missing homepage for crate +homepage = "https://www.sniffnet.net/" + +# Override the VCS entries. +# By default this points to a relevant subdirectory underneath the main +# repository for debcargo config files, owned by the Debian Rust Maintainers: +# https://salsa.debian.org/rust-team/debcargo-conf/ +# Please only override this if your package is truly special, e.g. it combines +# lots of languages and/or there is not a crate at the top-level directory. In +# most cases you should prefer packaging as part of the Debian Rust Team, see +# https://wiki.debian.org/Teams/RustPackaging/Policy +#vcs_git = "https://salsa.debian.org/special_package/rust-special-0.1.git" +#vcs_browser = "https://salsa.debian.org/special_package/rust-special-0.1" + +# Section override for the source package. Unless overridden here, library +# crates get "rust" and non-library crates get a "FIXME". +section = "net" + +# Extra Build-Depends on top of those generated by debcargo. +# If you defined a custom d/rules that does extra stuff on top of dh-cargo, +# then you may need to use this. +# OTOH, if your crate needs external development headers to build, these should +# probably instead go in the [packages.lib] depends key rather than this key. +# debcargo will then automatically add those into the package Build-Depends if +# needed by dh-cargo; you don't have to add them here as well. +build_depends = ["libasound2-dev, libpcap0.8-dev, libfontconfig1-dev"] + +# Build-Depends to subtract from those generated by debcargo. This should be +# used when our default generated Build-Depends results in a cycle. For +# example, this might happen if: +# - crate A's default-feature depends on crate B's no-default-features (which has no dependencies) +# - crate B's default-feature depends on crate A's no-default-features (which has no dependencies) +# In these cases, you'll need to (for example) add "librustA+B-dev " +# to build_depends_excludes in A's debcargo.toml to break the cycle, and also +# add override_dh_auto_test to A's d/rules to avoid selecting the B feature +# when running the test build. Depending on the exact situation, it should be +# sufficient to do this override only for one of the packages in the cycle. +# Note that binary package Depends must be left alone in order to correctly +# express the dependencies; these ought not to have cycles in anyway, even in +# a case like the above example. +# This field should *not* be used to exclude arch-specific dependencies. We +# want to include them to support cross-compiling, and they should cause no +# problems since they are just source code. If our test "cargo build" fails for +# one of those dependencies, it should be handled in that package by disabling +# the failing test on the architectures that they are expected to fail on. +#build_depends_excludes = ["PLACEHOLDER", "PLACEHOLDER"] + +# Binary package overrides. +# Different values for KEY selects different binary packages: +# lib - the package for the library crate +# "lib+FEATURE" - the metapackage for feature FEATURE +# bin - the package for the binary crate +# +[packages.KEY] + +# Section override for the binary package. Use this if your crate is both a +# library and a binary crate; in this case, omit source.section which will +# default to "rust" and override this value for your binary package. +#section = "PLACEHOLDER" + +# Short description for the package. If omitted, debcargo autogenerates this +# using the top-level "summary" key plus a suffix describing the feature. +#summary = "PLACEHOLDER" + +# Long description for the package. If omitted, debcargo autogenerates this +# using the top-level "description" key plus a suffix describing the feature. +#description = """ +#PLACEHOLDER +#""" + +# Additional Depends on top of the ones generated by debcargo. This should be +# used to pull in system libraries for crates that need them to build. You'll +# want the -dev versions of the library packages, since our crate packages are +# development packages and not runtime packages. +depends = ["libasound2-dev, libpcap0.8-dev, libfontconfig1-dev"] + +# We generate an autopkgtest (post-install test) for every feature, and also +# run `cargo test` for the default feature set during build-time if there are +# no additional dev-dependencies. +# However sometimes this may not work, e.g. if the crate is part of a larger +# workspace and its tests require files from the workspace directory. Or if +# the crate author is simply negligent and didn't ensure the test passes for +# all features. In these cases, you can use this setting to mark the test as +# "flaky" to ignore failures. Special cases for packages.KEY: +# packages."lib+@" - disables the test for the --all-features autopkgtest +# The effect is transitive to its reverse-dependencies, so e.g. if you specify +# this for feature A, and feature B depends on feature A, then feature B also +# implicitly has this set. To unset it on feature B (and its transitive rdeps), +# explicit set this to false for feature B as well. +# So for example if the test breaks for the bare library (when running with +# --no-default-features) but works when the std feature is enabled, set this to +# true for [packages.lib] and false for [packages."lib+std"]. +# Note: debcargo will error if you set these in an inconsistent way. For +# example if feature A depends on {B, C}, B says true and C says false, of +# course we cannot determine what A should be. You can suppress the error by +# explicitly giving A a value, either true or false. +#test_is_broken = false + +# Some tests depend on extra system tools or libraries, which need to be given +# to autopkgtest. Like test_is_broken, the effect is transitive to its rdeps. +#test_depends = [] +# +# Note: we do not (currently) support unsetting of this in indirect rdeps. This +# would result in similar conflict issues as documented for test_is_broken. It +# is possible to work around it similarly, by requiring manual resolution - but +# cancelling dependencies is harder to implement than true/false so we avoid it +# for now. Please file an issue if you have a real use-case for it. + +# More additional fields. This is mostly useful for binary packages that might +# relate to other external programs, e.g. debcargo Recommends cargo. +recommends = ["libasound2-dev, libpcap0.8-dev, libfontconfig1-dev"] +#suggests = ["PLACEHOLDER", "PLACEHOLDER"] +#provides = ["PLACEHOLDER", "PLACEHOLDER"] + +# Extra lines to include in the stanza, freeform. Use this to include things +# that debcargo doesn't handle, such as Breaks, Conflicts, Replaces. +#extra_lines = ["PLACEHOLDER", "PLACEHOLDER"]