cgitize 5.0.4__tar.gz → 5.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. {cgitize-5.0.4 → cgitize-5.1.0}/LICENSE.txt +1 -1
  2. {cgitize-5.0.4/cgitize.egg-info → cgitize-5.1.0}/PKG-INFO +2 -2
  3. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/bitbucket.py +1 -1
  4. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/cgit.py +2 -8
  5. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/config.py +5 -1
  6. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/git.py +1 -1
  7. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/github.py +1 -1
  8. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/gitlab.py +1 -1
  9. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/main.py +28 -9
  10. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/repo.py +1 -1
  11. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/utils.py +1 -1
  12. {cgitize-5.0.4 → cgitize-5.1.0/cgitize.egg-info}/PKG-INFO +2 -2
  13. {cgitize-5.0.4 → cgitize-5.1.0}/docker/Dockerfile +1 -1
  14. {cgitize-5.0.4 → cgitize-5.1.0}/docker/cgitize.sh +1 -1
  15. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/Dockerfile +1 -1
  16. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/etc/cgit/common +2 -0
  17. {cgitize-5.0.4 → cgitize-5.1.0}/docker/in_cron.sh +1 -1
  18. {cgitize-5.0.4 → cgitize-5.1.0}/pyproject.toml +1 -1
  19. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/docker/git_server/Dockerfile +1 -1
  20. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/local/test.sh +20 -27
  21. {cgitize-5.0.4 → cgitize-5.1.0}/test/unit/test_bitbucket.py +1 -1
  22. {cgitize-5.0.4 → cgitize-5.1.0}/test/unit/test_github.py +1 -1
  23. {cgitize-5.0.4 → cgitize-5.1.0}/test/unit/test_gitlab.py +1 -1
  24. {cgitize-5.0.4 → cgitize-5.1.0}/.dockerignore +0 -0
  25. {cgitize-5.0.4 → cgitize-5.1.0}/.gitattributes +0 -0
  26. {cgitize-5.0.4 → cgitize-5.1.0}/.github/workflows/ci.yml +0 -0
  27. {cgitize-5.0.4 → cgitize-5.1.0}/.gitignore +0 -0
  28. {cgitize-5.0.4 → cgitize-5.1.0}/.pylintrc +0 -0
  29. {cgitize-5.0.4 → cgitize-5.1.0}/.python-version +0 -0
  30. {cgitize-5.0.4 → cgitize-5.1.0}/DEVELOPMENT.md +0 -0
  31. {cgitize-5.0.4 → cgitize-5.1.0}/Makefile +0 -0
  32. {cgitize-5.0.4 → cgitize-5.1.0}/README.md +0 -0
  33. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/__init__.py +0 -0
  34. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize/version.py +0 -0
  35. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize.egg-info/SOURCES.txt +0 -0
  36. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize.egg-info/dependency_links.txt +0 -0
  37. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize.egg-info/entry_points.txt +0 -0
  38. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize.egg-info/requires.txt +0 -0
  39. {cgitize-5.0.4 → cgitize-5.1.0}/cgitize.egg-info/top_level.txt +0 -0
  40. {cgitize-5.0.4 → cgitize-5.1.0}/docker/README.md +0 -0
  41. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/cmd.sh +0 -0
  42. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/etc/cgitrc +0 -0
  43. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/etc/nginx/conf.d/default.conf +0 -0
  44. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/usr/lib/cgit/filters/about-formatting.sh +0 -0
  45. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/usr/lib/cgit/filters/html-converters/.gitattributes +0 -0
  46. {cgitize-5.0.4 → cgitize-5.1.0}/docker/frontend/usr/lib/cgit/filters/html-converters/md2html +0 -0
  47. {cgitize-5.0.4 → cgitize-5.1.0}/docker/get_output_dir.py +0 -0
  48. {cgitize-5.0.4 → cgitize-5.1.0}/docker-compose.yml +0 -0
  49. {cgitize-5.0.4 → cgitize-5.1.0}/docs/api.md +0 -0
  50. {cgitize-5.0.4 → cgitize-5.1.0}/docs/auth.md +0 -0
  51. {cgitize-5.0.4 → cgitize-5.1.0}/examples/cgitize.toml +0 -0
  52. {cgitize-5.0.4 → cgitize-5.1.0}/examples/docker/cgitize.toml +0 -0
  53. {cgitize-5.0.4 → cgitize-5.1.0}/prelude.mk +0 -0
  54. {cgitize-5.0.4 → cgitize-5.1.0}/requirements.txt +0 -0
  55. {cgitize-5.0.4 → cgitize-5.1.0}/setup.cfg +0 -0
  56. {cgitize-5.0.4 → cgitize-5.1.0}/test/__init__.py +0 -0
  57. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/docker/.dockerignore +0 -0
  58. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/docker/cgitize/.gitignore +0 -0
  59. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/docker/cgitize/etc/cgitize.toml +0 -0
  60. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/docker/docker-compose.yml +0 -0
  61. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/docker/git_server/setup_repo.sh +0 -0
  62. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/docker/test.sh +0 -0
  63. {cgitize-5.0.4 → cgitize-5.1.0}/test/integration/example/test.sh +0 -0
  64. {cgitize-5.0.4 → cgitize-5.1.0}/test/unit/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com>
3
+ Copyright (c) 2018 Egor Tensin <egor@tensin.name>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cgitize
3
- Version: 5.0.4
3
+ Version: 5.1.0
4
4
  Summary: Self-host your repositories using cgit
5
- Author-email: Egor Tensin <Egor.Tensin@gmail.com>
5
+ Author-email: Egor Tensin <egor@tensin.name>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/egor-tensin/cgitize
8
8
  Project-URL: Bug Tracker, https://github.com/egor-tensin/cgitize/issues
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2018 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -166,10 +166,4 @@ class CGitRepositories:
166
166
  repo_dir = self.get_repo_dir(repo)
167
167
  with chdir(repo_dir):
168
168
  with Git.setup_auth(repo):
169
- if not Git.check('remote', 'update', '--prune'):
170
- return False
171
- # In case the local repository is not a bare repository, but a
172
- # full-fledged working copy:
173
- if Git.check('rev-parse', '--verify', '--quiet', 'origin/master'):
174
- return Git.check('reset', '--soft', 'origin/master')
175
- return True
169
+ return Git.check('remote', 'update', '--prune')
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -43,6 +43,10 @@ class MainSection(Section):
43
43
  def output_dir(self):
44
44
  return self._get_config_path('output_dir', default=MainSection.DEFAULT_OUTPUT_DIR)
45
45
 
46
+ @property
47
+ def error_header_path(self):
48
+ return os.path.join(self.output_dir, 'error.html')
49
+
46
50
  @property
47
51
  def clone_url(self):
48
52
  return self._get_config_value('clone_url', required=False)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2018 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -32,23 +32,42 @@ def parse_args(argv=None):
32
32
  return parser.parse_args(argv)
33
33
 
34
34
 
35
+ def setup_error_header_file(error_header_path, success, error=None):
36
+ with open(error_header_path, 'w') as file:
37
+ contents = ''
38
+ if not success:
39
+ contents = '''<p style="text-align: center; color: red; font-weight: bold;">'''
40
+ contents += '''Some repositories couldn't be updated, please check application logs for details.'''
41
+ if error is not None:
42
+ contents += f'''<br>{type(error).__name__}: {error}'''
43
+ contents += '''</p>\n'''
44
+ file.write(contents)
45
+
46
+
35
47
  def main(argv=None):
36
48
  args = parse_args(argv)
37
49
  with setup_logging(args.verbose):
38
50
  config = Config.read(args.config)
39
- cgit_server = CGitServer(config.main.clone_url)
40
- output = CGitRepositories(config.main.output_dir, cgit_server, force=args.force)
41
51
  success = True
42
- for repo in config.parse_repositories():
43
- if args.repos is None or repo.name in args.repos:
44
- if not output.update(repo):
45
- success = False
52
+ error = None
53
+
54
+ try:
55
+ cgit_server = CGitServer(config.main.clone_url)
56
+ output = CGitRepositories(config.main.output_dir, cgit_server, force=args.force)
57
+ for repo in config.parse_repositories():
58
+ if args.repos is None or repo.name in args.repos:
59
+ success = success and output.update(repo)
60
+ except Exception as e:
61
+ success = False
62
+ error = e
63
+
46
64
  if success:
47
65
  logging.info('All repositories were updated successfully')
48
- return 0
49
66
  else:
50
67
  logging.warning("Some repositories couldn't be updated!")
51
- return 1
68
+
69
+ setup_error_header_file(config.main.error_header_path, success, error)
70
+ return int(not success)
52
71
 
53
72
 
54
73
  if __name__ == '__main__':
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2018 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2018 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cgitize
3
- Version: 5.0.4
3
+ Version: 5.1.0
4
4
  Summary: Self-host your repositories using cgit
5
- Author-email: Egor Tensin <Egor.Tensin@gmail.com>
5
+ Author-email: Egor Tensin <egor@tensin.name>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/egor-tensin/cgitize
8
8
  Project-URL: Bug Tracker, https://github.com/egor-tensin/cgitize/issues
@@ -28,7 +28,7 @@ RUN pip3 install -q --no-cache-dir --target=/deps -r /tmp/requirements.txt
28
28
 
29
29
  FROM base
30
30
 
31
- LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>"
31
+ LABEL maintainer="Egor Tensin <egor@tensin.name>"
32
32
 
33
33
  RUN apk add -q --no-cache bash git openssh-client tini
34
34
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- # Copyright (c) 2023 Egor Tensin <Egor.Tensin@gmail.com>
3
+ # Copyright (c) 2023 Egor Tensin <egor@tensin.name>
4
4
  # This file is part of the "cgitize" project.
5
5
  # For details, see https://github.com/egor-tensin/cgitize.
6
6
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- FROM nginx:1.25-alpine AS base
1
+ FROM nginx:1.27-alpine AS base
2
2
 
3
3
  FROM base AS builder
4
4
 
@@ -37,3 +37,5 @@ source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
37
37
 
38
38
  # Set the directory path to search for repositories.
39
39
  scan-path=/mnt/cgitize
40
+
41
+ header=/mnt/cgitize/error.html
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
3
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
4
4
  # This file is part of the "cgitize" project.
5
5
  # For details, see https://github.com/egor-tensin/cgitize.
6
6
  # Distributed under the MIT License.
@@ -7,7 +7,7 @@ name = "cgitize"
7
7
  description = "Self-host your repositories using cgit"
8
8
  license = {text = "MIT"}
9
9
  dynamic = ["version"]
10
- authors = [{name = "Egor Tensin", email = "Egor.Tensin@gmail.com"}]
10
+ authors = [{name = "Egor Tensin", email = "egor@tensin.name"}]
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.6"
13
13
 
@@ -1,4 +1,4 @@
1
- FROM alpine:3.19
1
+ FROM alpine:3.20
2
2
 
3
3
  RUN apk add -q --no-cache bash git openssh-server tini && \
4
4
  echo 'root:root' | chpasswd && \
@@ -107,18 +107,6 @@ setup_bare() {
107
107
  setup_cgitize
108
108
  }
109
109
 
110
- setup_workdir() {
111
- setup_bare
112
-
113
- echo
114
- echo ----------------------------------------------------------------------
115
- echo Setting up local repository clone
116
- echo ----------------------------------------------------------------------
117
-
118
- mkdir -p -- "$output_dir"
119
- _git clone --quiet -- "$upstream_repo_dir" "$output_dir/test_repo"
120
- }
121
-
122
110
  cgitize() {
123
111
  echo
124
112
  echo ----------------------------------------------------------------------
@@ -179,34 +167,39 @@ verify_added_commits() {
179
167
  verify_commits 'first commit' 'second commit' 'third commit'
180
168
  }
181
169
 
182
- test_bare() {
170
+ verify_error_header_empty() {
183
171
  echo
184
- echo ======================================================================
185
- echo "${FUNCNAME[0]}"
186
- echo ======================================================================
172
+ echo ----------------------------------------------------------------------
173
+ echo Verifying the error header
174
+ echo ----------------------------------------------------------------------
187
175
 
188
- setup_bare
189
- cgitize
190
- verify_initial_commits
191
- add_commits
192
- cgitize
193
- verify_added_commits
194
- cleanup
195
- success
176
+ test ! -s "$output_dir/error.html"
196
177
  }
197
178
 
198
- test_workdir() {
179
+ verify_error_header() {
180
+ echo
181
+ echo ----------------------------------------------------------------------
182
+ echo Verifying the error header
183
+ echo ----------------------------------------------------------------------
184
+
185
+ local contents
186
+ contents="$( cat -- "$output_dir/error.html" )"
187
+ check_contains "$contents" "Some repositories couldn't be updated"
188
+ }
189
+
190
+ test_bare() {
199
191
  echo
200
192
  echo ======================================================================
201
193
  echo "${FUNCNAME[0]}"
202
194
  echo ======================================================================
203
195
 
204
- setup_workdir
196
+ setup_bare
205
197
  cgitize
206
198
  verify_initial_commits
207
199
  add_commits
208
200
  cgitize
209
201
  verify_added_commits
202
+ verify_error_header_empty
210
203
  cleanup
211
204
  success
212
205
  }
@@ -237,6 +230,7 @@ test_failure() {
237
230
  echo "The added commits should not have been pulled." >&2
238
231
  return 1
239
232
  fi
233
+ verify_error_header
240
234
  cleanup
241
235
  success
242
236
  }
@@ -244,7 +238,6 @@ test_failure() {
244
238
  main() {
245
239
  trap cleanup EXIT
246
240
  test_bare
247
- test_workdir
248
241
  test_failure
249
242
  }
250
243
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com>
1
+ # Copyright (c) 2021 Egor Tensin <egor@tensin.name>
2
2
  # This file is part of the "cgitize" project.
3
3
  # For details, see https://github.com/egor-tensin/cgitize.
4
4
  # Distributed under the MIT License.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes