From c3da62423ea5c91dcbe4df02d1f4f6a03a3ad049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Thu, 21 Jul 2022 10:22:14 +0200 Subject: [PATCH 1/3] Add {debian,FreeBSD} packaging scripts --- opam-graph.opam | 2 ++ packaging/FreeBSD/MANIFEST | 15 +++++++++++ packaging/FreeBSD/create_package.sh | 42 +++++++++++++++++++++++++++++ packaging/debian/changelog | 5 ++++ packaging/debian/control | 12 +++++++++ packaging/debian/copyright | 8 ++++++ packaging/debian/create_package.sh | 28 +++++++++++++++++++ 7 files changed, 112 insertions(+) create mode 100644 packaging/FreeBSD/MANIFEST create mode 100644 packaging/FreeBSD/create_package.sh create mode 100644 packaging/debian/changelog create mode 100644 packaging/debian/control create mode 100644 packaging/debian/copyright create mode 100644 packaging/debian/create_package.sh diff --git a/opam-graph.opam b/opam-graph.opam index f885b2e..d5cebc5 100644 --- a/opam-graph.opam +++ b/opam-graph.opam @@ -22,6 +22,8 @@ depends: [ build: [ ["dune" "subst"] {dev} ["dune" "build" "-p" name "-j" jobs] + ["sh" "-ex" "packaging/FreeBSD/create_package.sh"] {os = "freebsd"} + ["sh" "-ex" "packaging/debian/create_package.sh"] {os-family = "debian"} ] synopsis: "Graphing dependencies of opam packages" diff --git a/packaging/FreeBSD/MANIFEST b/packaging/FreeBSD/MANIFEST new file mode 100644 index 0000000..7436597 --- /dev/null +++ b/packaging/FreeBSD/MANIFEST @@ -0,0 +1,15 @@ +name: opam-graph +version: %%VERSION_NUM%% +origin: local/opam-graph +comment: Opam graph visualization tool +www: https://git.robur.io/robur/opam-graph +maintainer: Robur +prefix: /usr/local +licenselogic: single +licenses: [ISCL] +flatsize: %%FLATSIZE%% +categories: [local] +desc = < "$manifest" + +{ + printf '\nfiles {\n' + find "$rootdir" -type f -exec sha256 -r {} + | sort | + awk '{print " " $2 ": \"" $1 "\","}' + fidn "$rootdir" -type l | sort | + awk '{print " " $1 ": -,"}' + printf '}\n' +} | sed -e "s:${rootdir}::" >> "$manifest" + +export SOURCE_DATE_EPOCH=$(git log -1 --pretty=format:%ct) +pkg create -r "$rootdir" -M "$manifest" -o "$basedir/" +mv "$basedir"/builder-web-*.pkg "$basedir/builder-web.pkg" +echo 'bin: [ "builder-web.pkg" ]' > "$basedir/builder-web.install" +echo 'doc: [ "README.md" ]' >> "$basedir/builder-web.install" diff --git a/packaging/debian/changelog b/packaging/debian/changelog new file mode 100644 index 0000000..a303220 --- /dev/null +++ b/packaging/debian/changelog @@ -0,0 +1,5 @@ +opam-graph (%%VERSION_NUM%%) unstable; urgency=medium + + * Initial release + + --Robur team diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 0000000..eccb782 --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,12 @@ +Package: opam-graph +Version: %%VERSION_NUM%% +Section: unknown +Priority: optional +Maintainer: Robur Team +Stadnards-Version: 4.4.1 +Homepage: https://git.robur.io/robur/opam-graph +Vcs-Browser: https://git.robur.io/robur/opam-graph +Vsc-Git: https://git.robur.io/robur/opam-graph.git +Architecture: FIXME +Descrption: Graphing dependencies of opam packages + This package outputs graphs (in svg and dot) of opam packages. diff --git a/packaging/debian/copyright b/packaging/debian/copyright new file mode 100644 index 0000000..0cb689d --- /dev/null +++ b/packaging/debian/copyright @@ -0,0 +1,8 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: opam-graph +Upstream-Contact: Robur Team +Source: https://git.robur.io/robur/opam-graph + +Files: * +Copyright: "Hannes Mehnert " +License: ISC diff --git a/packaging/debian/create_package.sh b/packaging/debian/create_package.sh new file mode 100644 index 0000000..3d54202 --- /dev/null +++ b/packaging/debian/create_package.sh @@ -0,0 +1,28 @@ +#!/bin/sh -e + +# only execute anything if either +# - running under orb with package = builder-web +# - not running under opam at all +if [ "$ORB_BUILDING_PACKAGE" != "opam-graph" -a "$OPAM_PACKAGE_NAME" != "" ]; then + exit 0; +fi + +basedir=$(realpath "$(dirname "$0")"/../..) +bdir=$basedir/_build/install/default/bin +tmpd=$basedir/_build/stage +rootdir=$tmpd/rootdir +bindir=$rootdir/usr/bin +debiandir=$rootdir/DEBIAN +libexecdir=$rootdir/usr/libexec + +trap 'rm -rf $tmpd' 0 INT EXIT + +mkdir -p "$debiandir" "$bindir" "$libexecdir" + +install "$bdir/opam-graph" "$bindir/opam-graph" + +ARCH=$(dpkg-architecture -q DEB_TARGET_ARCH) +sed -i -e "s/^Architecture:.*/Architecture: ${ARCH}/" "$debiandir"/control + +dpkg-deb --build "$rootdir" "$basedir"/builder-web.deb +echo 'bin: [ "builder-web.deb" ]' > "$basedir/builder-web.install" From 34ce8df43da75fbba98dcb934059cbd8a44c425f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Thu, 21 Jul 2022 10:48:27 +0200 Subject: [PATCH 2/3] packaging/debian/control: fix typos --- packaging/debian/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/debian/control b/packaging/debian/control index eccb782..3827ea8 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -3,10 +3,10 @@ Version: %%VERSION_NUM%% Section: unknown Priority: optional Maintainer: Robur Team -Stadnards-Version: 4.4.1 +Standards-Version: 4.4.1 Homepage: https://git.robur.io/robur/opam-graph Vcs-Browser: https://git.robur.io/robur/opam-graph -Vsc-Git: https://git.robur.io/robur/opam-graph.git +Vcs-Git: https://git.robur.io/robur/opam-graph.git Architecture: FIXME -Descrption: Graphing dependencies of opam packages +Description: Graphing dependencies of opam packages This package outputs graphs (in svg and dot) of opam packages. From 21cf8a3dcd0c5213b841496d6d9b3db678ff7ce4 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Wed, 27 Jul 2022 10:15:22 +0200 Subject: [PATCH 3/3] minor fixes --- README.md | 3 +++ packaging/FreeBSD/create_package.sh | 8 ++++---- packaging/debian/copyright | 2 +- packaging/debian/create_package.sh | 9 ++++----- 4 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0e9312d --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# opam-graph + +Visualizes dependencies of "opam switch export" as dot or svg. diff --git a/packaging/FreeBSD/create_package.sh b/packaging/FreeBSD/create_package.sh index c75b4fb..7c18490 100644 --- a/packaging/FreeBSD/create_package.sh +++ b/packaging/FreeBSD/create_package.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # only execute anything if either -# - running under orb with package = builder-web +# - running under orb with package = opam-graph # - not running under opam at all if [ "$ORB_BUILDING_PACKAGE" != "opam-graph" -a "$OPAM_PACKAGE_NAME" != "" ]; then exit 0; @@ -37,6 +37,6 @@ sed -e "s:%%FLATSIZE%%:${flatsize}:" -e "/^[Vversion:/s/-/./g" "$pdir/MANIFEST" export SOURCE_DATE_EPOCH=$(git log -1 --pretty=format:%ct) pkg create -r "$rootdir" -M "$manifest" -o "$basedir/" -mv "$basedir"/builder-web-*.pkg "$basedir/builder-web.pkg" -echo 'bin: [ "builder-web.pkg" ]' > "$basedir/builder-web.install" -echo 'doc: [ "README.md" ]' >> "$basedir/builder-web.install" +mv "$basedir"/opam-graph-*.pkg "$basedir/opam-graph.pkg" +echo 'bin: [ "opam-graph.pkg" ]' > "$basedir/opam-graph.install" +echo 'doc: [ "README.md" ]' >> "$basedir/opam-graph.install" diff --git a/packaging/debian/copyright b/packaging/debian/copyright index 0cb689d..4bb5e47 100644 --- a/packaging/debian/copyright +++ b/packaging/debian/copyright @@ -4,5 +4,5 @@ Upstream-Contact: Robur Team Source: https://git.robur.io/robur/opam-graph Files: * -Copyright: "Hannes Mehnert " +Copyright: "Robur Team " License: ISC diff --git a/packaging/debian/create_package.sh b/packaging/debian/create_package.sh index 3d54202..8edd0bd 100644 --- a/packaging/debian/create_package.sh +++ b/packaging/debian/create_package.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # only execute anything if either -# - running under orb with package = builder-web +# - running under orb with package = opam-graph # - not running under opam at all if [ "$ORB_BUILDING_PACKAGE" != "opam-graph" -a "$OPAM_PACKAGE_NAME" != "" ]; then exit 0; @@ -13,16 +13,15 @@ tmpd=$basedir/_build/stage rootdir=$tmpd/rootdir bindir=$rootdir/usr/bin debiandir=$rootdir/DEBIAN -libexecdir=$rootdir/usr/libexec trap 'rm -rf $tmpd' 0 INT EXIT -mkdir -p "$debiandir" "$bindir" "$libexecdir" +mkdir -p "$debiandir" "$bindir" install "$bdir/opam-graph" "$bindir/opam-graph" ARCH=$(dpkg-architecture -q DEB_TARGET_ARCH) sed -i -e "s/^Architecture:.*/Architecture: ${ARCH}/" "$debiandir"/control -dpkg-deb --build "$rootdir" "$basedir"/builder-web.deb -echo 'bin: [ "builder-web.deb" ]' > "$basedir/builder-web.install" +dpkg-deb --build "$rootdir" "$basedir"/opam-graph.deb +echo 'bin: [ "opam-graph.deb" ]' > "$basedir/opam-graph.install"