Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
significantProperties
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
significantProperties
Commits
e1120f75
Commit
e1120f75
authored
1 month ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- added debianize-job
parent
1b681114
No related branches found
No related tags found
No related merge requests found
Pipeline
#10488
failed
1 month ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+12
-0
12 additions, 0 deletions
.gitlab-ci.yml
.shellcheckrc
+15
-0
15 additions, 0 deletions
.shellcheckrc
debianize.sh
+207
-0
207 additions, 0 deletions
debianize.sh
with
234 additions
and
0 deletions
.gitlab-ci.yml
+
12
−
0
View file @
e1120f75
...
@@ -15,6 +15,7 @@ cache:
...
@@ -15,6 +15,7 @@ cache:
stages
:
# List of stages for jobs, and their order of execution
stages
:
# List of stages for jobs, and their order of execution
-
build
-
build
-
test
-
test
-
packaging
build-env-job
:
# This job runs in the build stage, which runs first.
build-env-job
:
# This job runs in the build stage, which runs first.
stage
:
build
stage
:
build
...
@@ -35,3 +36,14 @@ validate-job: # This job runs in the test stage.
...
@@ -35,3 +36,14 @@ validate-job: # This job runs in the test stage.
script
:
script
:
-
for file in *.xml; do xmllint --noout --schema sigprops.xsd $file; done
-
for file in *.xml; do xmllint --noout --schema sigprops.xsd $file; done
debianize-job
:
stage:packaging
timeout
:
30min
tags
:
-
"
docker"
script
:
-
./debianize.sh
artifacts
:
paths
:
-
artifacts/*.{deb,rpm,sh,tar.gz}
-
./*.{deb,rpm,sh,tar.gz}
This diff is collapsed.
Click to expand it.
.shellcheckrc
0 → 100644
+
15
−
0
View file @
e1120f75
### ENABLE SOME OPTIONAL CHECKS
# use "shellcheck --list-optional" to list available checks
enable=add-default-case
enable=avoid-nullary-conditions
enable=require-variable-braces
### DISABLE CHECKS
# https://github.com/koalaman/shellcheck/wiki/SC1091
disable=SC1091
# https://github.com/koalaman/shellcheck/issues/2457
disable=SC2020
This diff is collapsed.
Click to expand it.
debianize.sh
0 → 100755
+
207
−
0
View file @
e1120f75
#!/usr/bin/env bash
# based on build_applefonts.sh by Jörg Sachse, licensed as gpl3.
### META
# AUTHORS:
# - Andreas Romeyke (<Andreas.Romeyke@slub-dresden.de>)
#hh debianize.sh - creates a debian package in `build/` subdirectory.
#hh
#hh Usage: debianize.sh [-h] [-V] [-m] [-M]
#hh The generated Debian package can be found below the `build/` subdirectory.
#hh This path is also used for all intermediate steps, so you can use it to
#hh debug the package creation or tweak package build options.
#hh
#hh Options:
#hh You can use the following CLI arguments to configure the behaviour of
#hh debianize.sh. Please note that the CLI arguments need to be space
#hh separated. Combining arguments like "-hV" is currently NOT supported.
#hh
#hh -h, --help
#hh Show this help and exit.
#hh -V, --version
#hh Show version number and exit.
#hh -m, --man, --manpage, --manual
#hh Create a manpage from this help section and exit.
#hh Requires "help2man".
#hh -M, --showman
#hh Print the Manpage.
#hh Requires "help2man".
### DEFAULTS
RED
=
"
\\
e[31m"
WHITE
=
"
\\
e[0m"
ERROR
=
"
${
RED
}
[ERROR]
\t
${
WHITE
}
"
PKG_VERSION
=
"1.0"
PKG_NAME
=
"significant-properties-slubarchive"
### INIT
SCRIPTPATH
=
"
$(
dirname
"
$(
realpath
"
$0
"
)
"
)
"
# list external required binaries here (space separated)
REQUIREMENTS
=
"help2man man gzip make dpkg curl p7zip alien tar dh_make"
for
REQUIREMENT
in
${
REQUIREMENTS
}
;
do
command
-v
"
${
REQUIREMENT
}
"
>
/dev/null 2>&1
||
{
echo
>
&2
"
${
ERROR
}
'
${
REQUIREMENT
}
' required but not installed. Aborting."
;
exit
1
;
}
done
# make sure this runs as root if you use `alien`. We don't.
#[[ ${UID} -ne 0 ]] && echo "Please run this script with sudo. This is required by 'alien' package generator." && exit 1
### FUNCTIONS
# Don't just call this function "help()", as that's a reserved command in Bash.
comment_help
()
{
sed
-rn
's/^#hh ?//;T;p'
"
$0
"
}
create_manpage
(){
# https://www.gnu.org/software/help2man/
help2man
--section
1
--source
=
"SLUB Dresden"
--no-info
"
${
0
}
"
|
gzip
>
./
"
$(
basename
"
${
0
}
"
".sh"
)
.gz"
}
show_manpage
(){
help2man
--section
1
--source
=
"SLUB Dresden"
--no-info
"
${
0
}
"
| man
-l
-
}
get_cli_args
(){
while
[[
$#
-gt
0
]]
;
do
case
${
1
}
in
-h
|
--help
)
comment_help
exit
0
;;
-V
|
--version
)
echo
"
$(
basename
"
${
0
}
"
)
v1.0.0"
echo
-e
"
\n\n
Copyright (C)
\n
"
echo
"This software is licensed under the GNU General Public License version 3 (GNU GPLv3)."
exit
0
;;
-m
|
--man
|
--manpage
|
--manual
)
create_manpage
exit
0
;;
-M
|
--showman
)
show_manpage
exit
0
;;
*
)
echo
"'
${
1
}
' is not a valid parameter. Please use '
$(
basename
"
${
0
}
"
)
--help'. Exiting."
exit
1
;;
esac
done
}
cleanup_build_dir
()
{
if
[[
-d
"
${
SCRIPTPATH
}
/build/"
]]
;
then
rm
-rf
"
${
SCRIPTPATH
}
/build/"
fi
}
create_build_dir
()
{
mkdir
-p
"
${
SCRIPTPATH
}
"
/build/
"
${
PKG_NAME
}
"
-
"
${
PKG_VERSION
}
"
/usr/share/significant_properties/
mkdir
-p
"
${
SCRIPTPATH
}
"
/build/
"
${
PKG_NAME
}
"
-
"
${
PKG_VERSION
}
"
/usr/share/doc/significant_properties/
}
prepare_sigprops
()
{
/usr/bin/cp
--reflink
=
auto
-t
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/usr/share/significant_properties/"
./
*
.xml ./
*
.xsd
/usr/bin/cp
--reflink
=
auto
-t
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/usr/share/doc/significant_properties/"
./README.md ./LICENSE.txt
}
# https://wiki.debian.org/SimplePackagingTutorial
# https://www.internalpointers.com/post/build-binary-deb-package-practical-guide
package_sigprops
()
{
cd
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/"
||
exit
1
export
DEBFULLNAME
=
"Andreas Romeyke"
export
DEBEMAIL
=
"langzeitarchiv@slub-dresden.de"
export
DPKG_DEB_THREADS_MAX
=
4
# As of Debian 12 Bookworm, reprepro doesn't fully support zstd
# compression. Do NOT use `DPKG_DEB_COMPRESSOR_TYPE="zstd"`! Instead,
# use one of 'none', 'gzip', 'xz'.
export
DPKG_DEB_COMPRESSOR_TYPE
=
"gzip"
export
DPKG_DEB_COMPRESSOR_LEVEL
=
9
export
DEBIAN_FRONTEND
=
"non-interactive"
dh_make
--email
"langzeitarchiv@slub-dresden.de"
\
--indep
\
--createorig
\
--packagename
"
${
PKG_NAME
}
_
${
PKG_VERSION
}
"
\
--yes
# remove all unnecessary files from the prepared package directory
rm
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/"
*
".ex"
rm
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/"
*
".docs"
rm
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/README"
*
rm
-rf
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/source/"
# build your own control file
cat
<<-
EOF
> "
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/control"
Source:
${
PKG_NAME
}
Priority: optional
Maintainer:
${
DEBFULLNAME
}
<
${
DEBEMAIL
}
>
Section: misc
Package:
${
PKG_NAME
}
Architecture: all
Description: Significant properties of several digital preservation
workflows of Saxon State library (SLUB)
Version:
${
PKG_VERSION
}
EOF
echo
"10"
>
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/compat"
#echo "yep" > "${SCRIPTPATH}/build/${PKG_NAME}-${PKG_VERSION}/debian/copyright"
/usr/bin/cp
--reflink
=
auto ./LICENSE.txt
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/copyright"
sed
-i
"s/UNRELEASED/stable/"
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/changelog"
# make sure that all mandatory files are present
for
FILE
in
control copyright changelog compat rules
;
do
if
[[
!
-f
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/
${
FILE
}
"
]]
;
then
echo
"ERROR: '
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/
${
FILE
}
' expected but not found. This file is mandatory for Debian packages."
exit
1
fi
done
rm
-Rf
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
/debian/upstream"
# Rename the debian/ directory, because dpkg-deb expects the name to be all upper case. Smh! -.-
mv
"./debian"
"./DEBIAN"
cd
"
${
SCRIPTPATH
}
/build/"
||
exit
dpkg-deb
--root-owner-group
--build
"
${
PKG_NAME
}
-
${
PKG_VERSION
}
/"
#CAUTION: `alien` creates packages that cannot be ingested into `reprepro`, so we cannot use it!
#export EMAIL="langzeitarchiv@slub-dresden.de"
#alien --to-deb \
# --description "Applefonts grabbed straight from Apple Inc. to be installed on your Debian system." \
# --version "1.0" \
# --fixperms \
# "${SCRIPTPATH}/build/applefonts.tar.gz"
#rm "${SCRIPTPATH}/build/applefonts.tar.gz"
}
save_deb_package
()
{
mkdir
-p
"
${
SCRIPTPATH
}
/artifacts/"
mv
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
.deb"
"
${
SCRIPTPATH
}
/artifacts/"
}
check_deb_package
()
{
lintian
"
${
SCRIPTPATH
}
/build/
${
PKG_NAME
}
-
${
PKG_VERSION
}
.deb"
}
### MAIN
get_cli_args
"
${
@
}
"
cleanup_build_dir
create_build_dir
prepare_sigprops
package_sigprops
check_deb_package
save_deb_package
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment