diff options
| -rw-r--r-- | .build.yml | 136 | ||||
| -rw-r--r-- | .github/dependabot.yml | 8 | ||||
| -rwxr-xr-x | .github/workflows/archlinux.sh | 48 | ||||
| -rw-r--r-- | .github/workflows/build.yml | 181 | ||||
| -rwxr-xr-x | .github/workflows/builds.sh | 64 | ||||
| -rw-r--r-- | .github/workflows/builds.yml | 77 | ||||
| -rwxr-xr-x | .github/workflows/debian.sh | 42 | ||||
| -rwxr-xr-x | .github/workflows/fedora.sh | 41 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 26 | ||||
| -rwxr-xr-x | .github/workflows/ubuntu.sh | 43 | ||||
| -rw-r--r-- | src/fr-command-lha.c | 2 |
11 files changed, 350 insertions, 318 deletions
diff --git a/.build.yml b/.build.yml deleted file mode 100644 index a883ee5..0000000 --- a/.build.yml +++ /dev/null @@ -1,136 +0,0 @@ -########################################################## -# THE FOLLOWING LINES IS USED BY docker-build -########################################################## -requires: - archlinux: - # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/engrampa - - autoconf-archive - - caja - - clang - - file - - gcc - - git - - gtk3 - - json-glib - - make - - mate-common - - which - - yelp-tools - - debian: - # Useful URL: https://github.com/mate-desktop/debian-packages - # Useful URL: https://salsa.debian.org/debian-mate-team/engrampa - - autoconf-archive - - autopoint - - clang - - clang-tools - - cppcheck - - gettext - - gcc - - git - - libcaja-extension-dev - - libglib2.0-dev - - libgtk-3-dev - - libjson-glib-dev - - libmagic-dev - - make - - mate-common - - yelp-tools - - fedora: - # Useful URL: https://src.fedoraproject.org/cgit/rpms/engrampa.git - - autoconf-archive - - caja-devel - - clang - - clang-analyzer - - cppcheck-htmlreport - - desktop-file-utils - - file-devel - - gcc - - git - - gtk3-devel - - json-glib-devel - - libSM-devel - - make - - mate-common - - redhat-rpm-config - - ubuntu: - - autoconf-archive - - autopoint - - clang - - clang-tools - - gcc - - gettext - - git - - libcaja-extension-dev - - libglib2.0-dev - - libgtk-3-dev - - libjson-glib-dev - - libmagic-dev - - make - - mate-common - - yelp-tools - -variables: - - 'CHECKERS=" - -enable-checker deadcode.DeadStores - -enable-checker alpha.deadcode.UnreachableCode - -enable-checker alpha.core.CastSize - -enable-checker alpha.core.CastToStruct - -enable-checker alpha.core.IdenticalExpr - -enable-checker alpha.core.SizeofPtr - -enable-checker alpha.security.ArrayBoundV2 - -enable-checker alpha.security.MallocOverflow - -enable-checker alpha.security.ReturnPtrRange - -enable-checker alpha.unix.SimpleStream - -enable-checker alpha.unix.cstring.BufferOverlap - -enable-checker alpha.unix.cstring.NotNullTerminated - -enable-checker alpha.unix.cstring.OutOfBounds - -enable-checker alpha.core.FixedAddr - -enable-checker security.insecureAPI.strcpy"' - -before_scripts: - -build_scripts: - - if [ ${DISTRO_NAME} == "debian" ];then - - export CFLAGS+=" -Wsign-compare -Wunused-macros" - - cppcheck --enable=warning,style,performance,portability,information,missingInclude . - - fi - - - NOCONFIGURE=1 ./autogen.sh - - scan-build $CHECKERS ./configure --enable-compile-warnings=maximum - - if [ $CPU_COUNT -gt 1 ]; then - - if [ ${DISTRO_NAME} == "debian" ];then - - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make -j $(( $CPU_COUNT + 1 )) - - make clean - - fi - - scan-build $CHECKERS --keep-cc -o html-report make -j $(( $CPU_COUNT + 1 )) - - else - - if [ ${DISTRO_NAME} == "debian" ];then - - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make - - make clean - - fi - - scan-build $CHECKERS --keep-cc -o html-report make - - fi - -after_scripts: - - if [ ${DISTRO_NAME} == "fedora" ];then - - cppcheck --xml --output-file=cppcheck.xml --enable=warning,style,performance,portability,information,missingInclude . - - cppcheck-htmlreport --title=${REPO_NAME} --file=cppcheck.xml --report-dir=cppcheck-htmlreport - - ./gen-index -l 20 -i https://github.com/mate-desktop/engrampa/raw/master/data/icons/16x16/apps/engrampa.png - - fi - - make distcheck - -releases: - draft: false - prerelease: false - checksum: true - file_glob: true - files: engrampa-*.tar.xz - github_release: - tags: true - overwrite: true - base_version: 1.20.0 - notify_servers: - - https://release.mate-desktop.org/release diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..80851cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +# Enable dependabot to keep our GHA pins automatically +# updated, so we don't fall too far behind in the future +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/archlinux.sh b/.github/workflows/archlinux.sh new file mode 100755 index 0000000..d558640 --- /dev/null +++ b/.github/workflows/archlinux.sh @@ -0,0 +1,48 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Archlinux +requires=( + ccache # Use ccache to speed up build + clang # Build with clang on Archlinux + meson # Used for meson build +) + +# https://gitlab.archlinux.org/archlinux/packaging/packages/engrampa +requires+=( + autoconf-archive + caja + gcc + gettext + git + glib2-devel + gtk3 + gzip + itstool + libarchive + make + mate-common + python + tar + unzip + which + yelp-tools + zip +) + +infobegin "Update system" +pacman --noconfirm -Syu +infoend + +infobegin "Install dependency packages" +pacman --noconfirm -S ${requires[@]} +infoend diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c4f5436..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,181 +0,0 @@ -name: CI Build - -on: - push: - branches: - - master - pull_request: - branches: - - master - workflow_dispatch: - -# cancel already running builds of the same branch or pull request -concurrency: - group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.sha }} - cancel-in-progress: true - -env: - MATE_PANEL_DEP: 1.27.1 - CONFIGURE_FLAGS: --enable-compile-warnings=maximum - CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration - JOBS: 2 - # Useful URL: https://github.com/mate-desktop/debian-packages - # Useful URL: https://salsa.debian.org/debian-mate-team/mate-panel - DEB_LIBRARY_DEPS: | - libcaja-extension-dev - libglib2.0-dev - libgtk-3-dev - libjson-glib-dev - libmagic-dev - DEB_BUILD_DEPS: | - ccache - autoconf-archive - autopoint - git - gettext - make - mate-common - yelp-tools - # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-panel - ARCH_BUILD_DEPS: | - ccache - autoconf-archive - caja - clang - file - gcc - git - glib2-devel - gtk3 - json-glib - make - mate-common - which - yelp-tools - -jobs: - build: - name: Build on ${{matrix.container}} (using ${{matrix.cc}}) - runs-on: ubuntu-latest - container: ${{matrix.container}} - - strategy: - fail-fast: false # don't cancel other jobs in the matrix if one fails - matrix: - container: ['debian:testing', 'ubuntu:rolling', 'archlinux:latest'] - cc: ['gcc'] - cxx: ['g++'] - include: - # test with clang on archlinux:latest - - container: 'archlinux:latest' - cc: 'clang' - cxx: 'clang++' - - env: - # Speed up build with ccache - CC: ccache ${{matrix.cc}} - CXX: ccache ${{matrix.cxx}} - - steps: - # For Debian and Ubuntu (apt-based with reasonably compatible packages) - - name: Install dependencies - if: ${{ startsWith(matrix.container, 'debian:') || startsWith(matrix.container, 'ubuntu:') }} - run: | - apt-get update -qq - apt-get install --assume-yes --no-install-recommends \ - ${DEB_BUILD_DEPS} ${DEB_LIBRARY_DEPS} - - # For ArchLinux - - name: Install dependencies - if: ${{ startsWith(matrix.container, 'archlinux:') }} - # don't upgrade, although told otherwise (see link below), because - # apparently in the container it doesn't quit work... - # https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported - run: | - pacman --noconfirm -Syu - pacman --noconfirm -S ${ARCH_BUILD_DEPS} - - # Checkout the repository - - uses: actions/checkout@v3 - with: - path: engrampa - submodules: true - - # Setup ccache cache - - name: ccache - uses: hendrikmuhs/[email protected] - with: - key: ${{ matrix.container }}-${{ matrix.cc }} - - # Follows regular build and test steps - - - name: Configure - run: | - cd engrampa - NOCONFIGURE=1 ./autogen.sh - { ./configure ${CONFIGURE_FLAGS} || { cat config.log; exit 1; } ; } - - - name: Build - run: make -C engrampa -j ${{ env.JOBS }} - - - name: Run Tests - run: make -C engrampa -j ${{ env.JOBS }} check - - - name: Run distcheck - # We only run distcheck on one container, because it takes time and - # doesn't seem so useful to repeat everywhere -- it mostly checks the - # build system itself, rather than the build. - if: ${{ startsWith(matrix.container, 'debian:') }} - run: make -C engrampa -j ${{ env.JOBS }} distcheck - - # Do we need the real build for cppcheck run? I don't think so - cppcheck: - name: Run cppcheck - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - # Install code dependencies so that cppcheck has more info - - name: Install dependencies - run: | - sudo apt-get update -qq - sudo apt-get install --assume-yes --no-install-recommends \ - cppcheck ${DEB_LIBRARY_DEPS} - - # - define relevant configuration I can think of - # - _Noreturn: this is to avoid false positive with functions that - # don't return, like g_assert(false). Here, we rely on G_NORETURN - # (GLib 2.68+) using _Noreturn C11 attribute if __STDC_VERSION__ is - # high enough (cppcheck sets it for us in newer versions, but not on - # here yet); but the version of cppcheck we run on don't know about - # the C11 attribute, so map it to the GCC one it does know. - # This is a tad over-specific, but it removes some spurious warnings, - # and defining e.g. __GNUC__=12 is simpler, but is a *lot* slower - # (more than 3 times slower), and doesn't seem to yield other - # benefits for the moment. - # - -I flags from pkg-config (grepped from configure.ac) - # - ignore non-source directories - - name: cppcheck - env: - checks: warning,style,performance,portability,information,missingInclude - defines: > - -DGETTEXT_PACKAGE="engrampa" - -D__STDC_VERSION__=201112 -D_Noreturn=__attribute__((__noreturn__)) - packages: > - gio-2.0 - gio-unix-2.0 - gtk+-3.0 - ice - json-glib-1.0 - libcaja-extension - sm - run: | - cppcheck --enable="$checks" \ - -j $JOBS \ - $defines \ - $(pkg-config --cflags-only-I $packages) \ - -i engrampa/mate-submodules/ \ - . diff --git a/.github/workflows/builds.sh b/.github/workflows/builds.sh new file mode 100755 index 0000000..20c1ad5 --- /dev/null +++ b/.github/workflows/builds.sh @@ -0,0 +1,64 @@ +#!/usr/bin/bash + +set -e +set -o pipefail + +CPUS=$(grep processor /proc/cpuinfo | wc -l) + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Run meson first, then run autotools +# Because meson dist requires a clean git workspace +# Autotools will modify some files (such as po, etc.), making them dirty. +if [ -f meson.build ]; then + + infobegin "Configure (meson)" + meson setup _build --prefix=/usr + infoend + + infobegin "Build (meson)" + meson compile -C _build + infoend + + infobegin "Test (meson)" + ninja -C _build test + infoend + + infobegin "Dist (meson)" + # Git safedirectory stop ninja dist + # https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9 + # https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory + git config --global --add safe.directory ${PWD} + ninja -C _build dist + infoend +fi + +if [ -f autogen.sh ]; then + infobegin "Configure (autotools)" + NOCONFIGURE=1 ./autogen.sh + ./configure --prefix=/usr --enable-compile-warnings=maximum || { + cat config.log + exit 1 + } + infoend + + infobegin "Build (autotools)" + make -j ${CPUS} + infoend + + infobegin "Check (autotools)" + make -j ${CPUS} check || { + true + } + infoend + + infobegin "Distcheck (autotools)" + make -j ${CPUS} distcheck + infoend +fi diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml new file mode 100644 index 0000000..8382478 --- /dev/null +++ b/.github/workflows/builds.yml @@ -0,0 +1,77 @@ +name: CI Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +# cancel already running builds of the same branch or pull request +concurrency: + group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.sha }} + cancel-in-progress: true + + +jobs: + build: + name: Build on ${{matrix.container}} (using ${{matrix.cc}}) + runs-on: ubuntu-latest + container: + image: ${{matrix.container}} + + strategy: + fail-fast: false # don't cancel other jobs in the matrix if one fails + matrix: + container: + [ + "debian:testing", + "fedora:latest", + "ubuntu:rolling", + "archlinux:latest", + ] + cc: ["gcc"] + cxx: ["g++"] + include: + - container: "archlinux:latest" + cc: "clang" + cxx: "clang++" + + env: + # Speed up build with ccache + CC: ccache ${{ matrix.cc }} + CXX: ccache ${{ matrix.cxx }} + CONTAINER: ${{ matrix.container }} + + steps: + - name: Setup environment variables + id: distro-name + shell: bash + run: | + split=(${CONTAINER//:/ }) + distro=${split[0]} + short_sha=${SHA:0:8} + echo "DISTRO=$distro" | tee -a $GITHUB_ENV + - name: Install git command + shell: bash + run: | + echo "::group::Install git ..." + apt-get update -qq && apt-get install --assume-yes git || true + dnf update -y && dnf install -y git || true + pacman --noconfirm -Sy git || true + echo "::endgroup::" + - name: Repository checkout + uses: actions/checkout@v6 + with: + submodules: "true" + - name: Install dependency packages + run: .github/workflows/${{ env.DISTRO }}.sh + - name: Enable ccache to speed up builds + uses: hendrikmuhs/[email protected] + with: + key: ${{ env.DISTRO }}-${{ matrix.cc }} + + - name: Build the source code + run: .github/workflows/builds.sh diff --git a/.github/workflows/debian.sh b/.github/workflows/debian.sh new file mode 100755 index 0000000..b2e4f64 --- /dev/null +++ b/.github/workflows/debian.sh @@ -0,0 +1,42 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Debian +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +# https://salsa.debian.org/debian-mate-team/engrampa +requires+=( + autoconf-archive + autopoint + gettext + libcaja-extension-dev + libglib2.0-dev + libgtk-3-dev + libjson-glib-dev + libmagic-dev + make + mate-common + yelp-tools +) + +infobegin "Update system" +apt-get update -qq +infoend + +infobegin "Install dependency packages" +env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes \ + ${requires[@]} +infoend diff --git a/.github/workflows/fedora.sh b/.github/workflows/fedora.sh new file mode 100755 index 0000000..6889e8a --- /dev/null +++ b/.github/workflows/fedora.sh @@ -0,0 +1,41 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Fedora +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +# https://src.fedoraproject.org/cgit/rpms/engrampa.git +requires+=( + autoconf-archive + caja-devel + desktop-file-utils + file-devel + gcc + git + gtk3-devel + json-glib-devel + libSM-devel + make + mate-common + redhat-rpm-config +) + +infobegin "Update system" +dnf update -y +infoend + +infobegin "Install dependency packages" +dnf install -y ${requires[@]} +infoend diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..15bcc92 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release Version +on: + push: + tags: + - "v*.*.*" + +jobs: + release: + name: Release New Version + runs-on: ubuntu-latest + steps: + - name: Repository checkout + uses: actions/checkout@v6 + with: + submodules: "true" + + - name: Install dependency packages + run: sudo .github/workflows/ubuntu.sh + + - name: Build the source code + run: .github/workflows/builds.sh + - name: Create github release + run: | + gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes engrampa-*.tar.xz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ubuntu.sh b/.github/workflows/ubuntu.sh new file mode 100755 index 0000000..80d0fef --- /dev/null +++ b/.github/workflows/ubuntu.sh @@ -0,0 +1,43 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Ubuntu +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +# https://git.launchpad.net/ubuntu/+source/engrampa/tree/debian/control +requires+=( + autoconf-archive + autopoint + gettext + git + libcaja-extension-dev + libglib2.0-dev + libgtk-3-dev + libjson-glib-dev + libmagic-dev + make + mate-common + yelp-tools +) + +infobegin "Update system" +apt-get update -y +infoend + +infobegin "Install dependency packages" +env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes \ + ${requires[@]} +infoend diff --git a/src/fr-command-lha.c b/src/fr-command-lha.c index 53df6c5..5371f91 100644 --- a/src/fr-command-lha.c +++ b/src/fr-command-lha.c @@ -149,7 +149,7 @@ split_line_lha (char *line) scan = eat_spaces (scan); for (; i < N_FIELDS; i++) { field_end = strchr (scan, ' '); - if (field_end == NULL) { + if (field_end == NULL || (i + 1) == N_FIELDS) { field_end = scan + strlen(scan); } |
