Skip to content

Commit

Permalink
0.14.0 release (#340)
Browse files Browse the repository at this point in the history
* move debian/ to pkg for compat with obs

* shuffle files around

* fix debian build

* fix rpmlint issues

* add uninstall target

* fix uninstall target

* disable cgo helper if build has cgo disabled

* fix debian changelog

* fix ci pipeline
  • Loading branch information
jstaf authored Jul 14, 2023
1 parent e2ef1e4 commit b91a989
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 58 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
go install github.com/rakyll/gotest@latest
# cannot run systemd tests here because github actions runners don't have dbus setup +
# if CGO is on, the UI tests will take foreverrrrr
bash cgo-helper.sh
CGO_ENABLED=0 gotest -v -covermode=count -coverpkg=./ui/... -coverprofile=ui.coverage ./ui
gotest -v -covermode=count -coverpkg=./cmd/common -coverprofile=common.coverage ./cmd/common
gotest -v -covermode=count -coverpkg=./fs/... -coverprofile=quickxorhash.coverage ./fs/graph/quickxorhash
Expand Down Expand Up @@ -89,7 +90,7 @@ jobs:
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1.0.5
if: always()

- name: Send test coverage to Coveralls
uses: coverallsapp/github-action@v1.1.2
with:
Expand All @@ -106,10 +107,10 @@ jobs:
if: always()
runs-on: ubuntu-20.04
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
# decreased coverage isn't a failure
continue-on-error: true
- name: Coveralls finished
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
# decreased coverage isn't a failure
continue-on-error: true
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg/debian/changelog
29 changes: 21 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all, test, srpm, rpm, changes, dsc, deb, clean, install
.PHONY: all, test, srpm, rpm, dsc, changes, deb, clean, install, uninstall

# autocalculate software/package versions
VERSION := $(shell grep Version onedriver.spec | sed 's/Version: *//g')
Expand All @@ -18,6 +18,7 @@ all: onedriver onedriver-launcher


onedriver: $(shell find fs/ -type f) cmd/onedriver/main.go
bash cgo-helper.sh
$(CGO_CFLAGS) go build -v \
-ldflags="-X github.com/jstaf/onedriver/cmd/common.commit=$(shell git rev-parse HEAD)" \
./cmd/onedriver
Expand All @@ -38,13 +39,24 @@ onedriver-launcher: $(shell find ui/ cmd/common/ -type f) cmd/onedriver-launcher
install: onedriver onedriver-launcher
cp onedriver /usr/bin/
cp onedriver-launcher /usr/bin/
mkdir /usr/share/icons/onedriver/
cp resources/onedriver.svg /usr/share/icons/onedriver/
cp resources/onedriver.png /usr/share/icons/onedriver/
cp resources/onedriver-128.png /usr/share/icons/onedriver/
cp resources/onedriver.desktop /usr/share/applications/
cp resources/onedriver@.service /etc/systemd/user/
gzip -c resources/onedriver.1 > /usr/share/man/man1/onedriver.1.gz
mkdir -p /usr/share/icons/onedriver/
cp pkg/resources/onedriver.svg /usr/share/icons/onedriver/
cp pkg/resources/onedriver.png /usr/share/icons/onedriver/
cp pkg/resources/onedriver-128.png /usr/share/icons/onedriver/
cp pkg/resources/onedriver.desktop /usr/share/applications/
cp pkg/resources/onedriver@.service /etc/systemd/user/
gzip -c pkg/resources/onedriver.1 > /usr/share/man/man1/onedriver.1.gz
mandb


uninstall:
rm -f \
/usr/bin/onedriver \
/usr/bin/onedriver-launcher \
/etc/systemd/user/onedriver@.service \
/usr/share/applications/onedriver.desktop \
/usr/share/man/man1/onedriver.1.gz
rm -rf /usr/share/icons/onedriver
mandb


Expand All @@ -56,6 +68,7 @@ v$(VERSION).tar.gz: $(shell git ls-files)
git rev-parse HEAD > .commit
echo .commit >> filelist.txt
rsync -a --files-from=filelist.txt . onedriver-$(VERSION)
mv onedriver-$(VERSION)/pkg/debian onedriver-$(VERSION)
go mod vendor
cp -R vendor/ onedriver-$(VERSION)
tar -czf $@ onedriver-$(VERSION)
Expand Down
15 changes: 15 additions & 0 deletions cgo-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# cgo cannot conditionally use different packages based on which system packages
# are installed so this script is here to autodetect which webkit2gtk c headers
# we have access to

if [ "$CGO_ENABLED" -eq 0 ]; then
exit 0
fi

if pkg-config webkit2gtk-4.0; then
sed -i 's/webkit2gtk-4.1/webkit2gtk-4.0/g' fs/graph/oauth2_gtk.go
elif ! pkg-config webkit2gtk-4.1; then
echo "webkit2gtk development headers must be installed"
exit 1
fi
8 changes: 5 additions & 3 deletions cmd/common/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import (
"github.com/stretchr/testify/assert"
)

const configTestDir = "pkg/resources/test"

// We should load config correctly.
func TestLoadConfig(t *testing.T) {
t.Parallel()

conf := LoadConfig("resources/test/config-test.yml")
conf := LoadConfig(filepath.Join(configTestDir, "config-test.yml"))

home, _ := os.UserHomeDir()
assert.Equal(t, filepath.Join(home, "somewhere/else"), conf.CacheDir)
Expand All @@ -22,7 +24,7 @@ func TestLoadConfig(t *testing.T) {
func TestConfigMerge(t *testing.T) {
t.Parallel()

conf := LoadConfig("resources/test/config-test-merge.yml")
conf := LoadConfig(filepath.Join(configTestDir, "config-test-merge.yml"))

assert.Equal(t, "debug", conf.LogLevel)
assert.Equal(t, "/some/directory", conf.CacheDir)
Expand All @@ -32,7 +34,7 @@ func TestConfigMerge(t *testing.T) {
func TestLoadNonexistentConfig(t *testing.T) {
t.Parallel()

conf := LoadConfig("resources/test/does-not-exist.yml")
conf := LoadConfig(filepath.Join(configTestDir, "does-not-exist.yml"))

home, _ := os.UserHomeDir()
assert.Equal(t, filepath.Join(home, ".cache/onedriver"), conf.CacheDir)
Expand Down
2 changes: 1 addition & 1 deletion fs/graph/oauth2_gtk.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package graph

/*
#cgo linux pkg-config: webkit2gtk-4.0
#cgo linux pkg-config: webkit2gtk-4.1
#include "stdlib.h"
#include "oauth2_gtk.h"
*/
Expand Down
42 changes: 16 additions & 26 deletions onedriver.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Version: 0.14.0
Release: 1%{?dist}
Summary: A native Linux filesystem for Microsoft Onedrive

License: GPLv3
License: GPL-3.0-or-later
URL: https://github.com/jstaf/onedriver
Source0: https://github.com/jstaf/onedriver/archive/refs/tags/v%{version}.tar.gz

Expand All @@ -16,21 +16,7 @@ BuildRequires: git
BuildRequires: gcc
BuildRequires: pkg-config
BuildRequires: webkit2gtk3-devel

%if 0%{?suse_version}
%if 0%{?suse_version} > 1500
# tumbleweed
Requires: libwebkit2gtk-4_1-0
%else
# leap 15.3
Requires: libwebkit2gtk-4_0-37
%endif
# other EL distros
%else
Requires: webkit2gtk3
%endif
Requires: fuse
Suggests: systemd

%description
Onedriver is a native Linux filesystem for Microsoft Onedrive. Files and
Expand All @@ -41,10 +27,7 @@ your local computer.
%autosetup

%build
%if 0%{?suse_version} > 1500
# done via sed because #cgo flags appear to ignore #ifdef
sed -i 's/webkit2gtk-4.0/webkit2gtk-4.1/g' fs/graph/oauth2_gtk.go
%endif
bash cgo-helper.sh
if rpm -q pango | grep -q 1.42; then
BUILD_TAGS=-tags=pango_1_42,gtk_3_22
fi
Expand All @@ -54,7 +37,7 @@ go build -v -mod=vendor $BUILD_TAGS \
go build -v -mod=vendor $BUILD_TAGS \
-ldflags="-X github.com/jstaf/onedriver/cmd/common.commit=$(cat .commit)" \
./cmd/onedriver-launcher
gzip resources/onedriver.1
gzip pkg/resources/onedriver.1

%install
rm -rf $RPM_BUILD_ROOT
Expand All @@ -65,19 +48,20 @@ mkdir -p %{buildroot}/usr/lib/systemd/user
mkdir -p %{buildroot}/usr/share/man/man1
cp %{name} %{buildroot}/%{_bindir}
cp %{name}-launcher %{buildroot}/%{_bindir}
cp resources/%{name}.png %{buildroot}/usr/share/icons/%{name}
cp resources/%{name}-128.png %{buildroot}/usr/share/icons/%{name}
cp resources/%{name}.svg %{buildroot}/usr/share/icons/%{name}
cp resources/%{name}.desktop %{buildroot}/usr/share/applications
cp resources/%{name}@.service %{buildroot}/usr/lib/systemd/user
cp resources/%{name}.1.gz %{buildroot}/usr/share/man/man1
cp pkg/resources/%{name}.png %{buildroot}/usr/share/icons/%{name}
cp pkg/resources/%{name}-128.png %{buildroot}/usr/share/icons/%{name}
cp pkg/resources/%{name}.svg %{buildroot}/usr/share/icons/%{name}
cp pkg/resources/%{name}.desktop %{buildroot}/usr/share/applications
cp pkg/resources/%{name}@.service %{buildroot}/usr/lib/systemd/user
cp pkg/resources/%{name}.1.gz %{buildroot}/usr/share/man/man1

# fix for el8 build in mock
%define _empty_manifest_terminate_build 0
%files
%defattr(-,root,root,-)
%attr(755, root, root) %{_bindir}/%{name}
%attr(755, root, root) %{_bindir}/%{name}-launcher
%dir /usr/share/icons/%{name}
%attr(644, root, root) /usr/share/icons/%{name}/%{name}.png
%attr(644, root, root) /usr/share/icons/%{name}/%{name}-128.png
%attr(644, root, root) /usr/share/icons/%{name}/%{name}.svg
Expand All @@ -87,6 +71,12 @@ cp resources/%{name}.1.gz %{buildroot}/usr/share/man/man1
%attr(644, root, root) /usr/share/man/man1/%{name}.1.gz

%changelog
* Fri Jul 14 2023 Jeff Stafford <jeff.stafford@protonmail.com> - 0.14.0
- We now use quickxorhash checksums for both personal and business accounts.
- The cache for file contents has been moved out of boltdb and onto the local filesystem.
This makes accessing, reading, and writing files faster than before.
- onedriver no longer allows you to create filenames that are not allowed by OneDrive.

* Tue Nov 1 2022 Jeff Stafford <jeff.stafford@protonmail.com> - 0.13.0
- The GUI has been rewritten in golang for ease of maintenance and code sharing with
the rest of the onedriver application.
Expand Down
9 changes: 9 additions & 0 deletions debian/changelog → pkg/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
onedriver (0.14.0-1) jammy; urgency=low

* We now use quickxorhash checksums for both personal and business accounts.
* The cache for file contents has been moved out of boltdb and onto the local filesystem.
This makes accessing, reading, and writing files faster than before.
* onedriver no longer allows you to create filenames that are not allowed by OneDrive.

-- Jeff Stafford <jeff.stafford@protonmail.com> Fri, 14 Jul 2023 01:00:00 -0400

onedriver (0.13.0-1) focal; urgency=low

* The GUI has been rewritten in golang for ease of maintenance and code sharing with
Expand Down
File renamed without changes.
11 changes: 6 additions & 5 deletions debian/control → pkg/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Source: onedriver
Section: utils
Priority: optional
Maintainer: Jeff Stafford <jeff.stafford@protonmail.com>
Build-Depends: golang (>= 1.15), gcc, pkg-config, libwebkit2gtk-4.0-dev, git, debhelper
Build-Depends:
golang (>= 1.15), gcc, pkg-config, libwebkit2gtk-4.0-dev, git, debhelper
Standards-Version: 4.4.1
Homepage: https://github.com/jstaf/onedriver
#Vcs-Browser: https://github.com/jstaf/onedriver
Expand All @@ -12,7 +13,7 @@ Package: onedriver
Architecture: any
Depends: libwebkit2gtk-4.0-37, fuse
Suggests: systemd
Description: A native Linux filesystem for Microsoft Onedrive
Onedriver is a native Linux filesystem for Microsoft Onedrive. Files and
metadata are downloaded on-demand instead of requiring you to sync your entire account
to disk.
Description:
A native Linux filesystem for Microsoft Onedrive Onedriver is a native Linux
filesystem for Microsoft Onedrive. Files and metadata are downloaded on-demand
instead of requiring you to sync your entire account to disk.
File renamed without changes.
15 changes: 8 additions & 7 deletions debian/rules → pkg/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ override_dh_auto_clean:


override_dh_auto_build:
bash cgo-helper.sh
# GOCACHE will be for a nonexistent user in pbuilder otherwise
GOCACHE=/tmp/go-cache go build -v -mod=vendor \
-ldflags="-X github.com/jstaf/onedriver/cmd/common.commit=$(shell cat .commit)" \
./cmd/onedriver
GOCACHE=/tmp/go-cache go build -v -mod=vendor \
-ldflags="-X github.com/jstaf/onedriver/cmd/common.commit=$(shell cat .commit)" \
./cmd/onedriver-launcher
gzip resources/onedriver.1
gzip pkg/resources/onedriver.1


override_dh_auto_install:
install -D -m 0755 onedriver $$(pwd)/debian/onedriver/usr/bin/onedriver
install -D -m 0755 onedriver-launcher $$(pwd)/debian/onedriver/usr/bin/onedriver-launcher
install -D -m 0644 resources/onedriver.png $$(pwd)/debian/onedriver/usr/share/icons/onedriver/onedriver.png
install -D -m 0644 resources/onedriver-128.png $$(pwd)/debian/onedriver/usr/share/icons/onedriver/onedriver-128.png
install -D -m 0644 resources/onedriver.svg $$(pwd)/debian/onedriver/usr/share/icons/onedriver/onedriver.svg
install -D -m 0644 resources/onedriver.desktop $$(pwd)/debian/onedriver/usr/share/applications/onedriver.desktop
install -D -m 0644 resources/onedriver@.service $$(pwd)/debian/onedriver/usr/lib/systemd/user/onedriver@.service
install -D -m 0644 resources/onedriver.1.gz $$(pwd)/debian/onedriver/usr/share/man/man1/onedriver.1.gz
install -D -m 0644 pkg/resources/onedriver.png $$(pwd)/debian/onedriver/usr/share/icons/onedriver/onedriver.png
install -D -m 0644 pkg/resources/onedriver-128.png $$(pwd)/debian/onedriver/usr/share/icons/onedriver/onedriver-128.png
install -D -m 0644 pkg/resources/onedriver.svg $$(pwd)/debian/onedriver/usr/share/icons/onedriver/onedriver.svg
install -D -m 0644 pkg/resources/onedriver.desktop $$(pwd)/debian/onedriver/usr/share/applications/onedriver.desktop
install -D -m 0644 pkg/resources/onedriver@.service $$(pwd)/debian/onedriver/usr/lib/systemd/user/onedriver@.service
install -D -m 0644 pkg/resources/onedriver.1.gz $$(pwd)/debian/onedriver/usr/share/man/man1/onedriver.1.gz

File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b91a989

Please sign in to comment.