尝试在circleci构建脚本中下载pandoc的最新版本

问题描述 投票:1回答:1

我正在尝试将我的自述文件从markdown转换为reStructuredText使用pandoc,以便我可以构建一个可以部署到pypi的鸡蛋。不幸的是,circleci使用的pandoc版本(1.17.2)在如何组织某些表方面存在问题。看起来如果我使用的是最新版本的pandoc(2.9.1.1),一切都可以正常运行,但是我似乎无法获得circleci来下载最新版本。

到目前为止,我已经尝试在。circleci / config.yml中使用以下内容:

steps:
- run: sudo apt-get update && sudo apt-get install -y pandoc

并且我得到以下输出:

Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:3 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:4 http://deb.debian.org/debian stretch-backports InRelease [91.8 kB]
Hit:5 http://deb.debian.org/debian stretch Release
Fetched 277 kB in 0s (624 kB/s)

Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done

The following additional packages will be installed:
  liblua5.1-0 libluajit-5.1-2 libluajit-5.1-common pandoc-data
Suggested packages:
  texlive-latex-recommended texlive-xetex texlive-luatex pandoc-citeproc
  texlive-latex-extra wkhtmltopdf
The following NEW packages will be installed:
  liblua5.1-0 libluajit-5.1-2 libluajit-5.1-common pandoc pandoc-data
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 9724 kB of archives.
After this operation, 72.6 MB of additional disk space will be used.

Get:1 http://deb.debian.org/debian stretch/main amd64 liblua5.1-0 amd64 5.1.5-8.1+b2 [111 kB]
Get:2 http://deb.debian.org/debian stretch/main amd64 libluajit-5.1-common all 2.0.4+dfsg-1 [36.6 kB]
Get:3 http://deb.debian.org/debian stretch/main amd64 libluajit-5.1-2 amd64 2.0.4+dfsg-1+b1 [207 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 pandoc-data all 1.17.2~dfsg-3 [265 kB]
Get:5 http://deb.debian.org/debian stretch/main amd64 pandoc amd64 1.17.2~dfsg-3 [9104 kB]

Fetched 9724 kB in 0s (80.5 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package liblua5.1-0:amd64.
(Reading database ... 42585 files and directories currently installed.)
Preparing to unpack .../liblua5.1-0_5.1.5-8.1+b2_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8.1+b2) ...
Selecting previously unselected package libluajit-5.1-common.
Preparing to unpack .../libluajit-5.1-common_2.0.4+dfsg-1_all.deb ...
Unpacking libluajit-5.1-common (2.0.4+dfsg-1) ...
Selecting previously unselected package libluajit-5.1-2:amd64.
Preparing to unpack .../libluajit-5.1-2_2.0.4+dfsg-1+b1_amd64.deb ...
Unpacking libluajit-5.1-2:amd64 (2.0.4+dfsg-1+b1) ...
Selecting previously unselected package pandoc-data.
Preparing to unpack .../pandoc-data_1.17.2~dfsg-3_all.deb ...
Unpacking pandoc-data (1.17.2~dfsg-3) ...
Selecting previously unselected package pandoc.
Preparing to unpack .../pandoc_1.17.2~dfsg-3_amd64.deb ...
Unpacking pandoc (1.17.2~dfsg-3) ...
Setting up libluajit-5.1-common (2.0.4+dfsg-1) ...
Setting up pandoc-data (1.17.2~dfsg-3) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up libluajit-5.1-2:amd64 (2.0.4+dfsg-1+b1) ...
Setting up liblua5.1-0:amd64 (5.1.5-8.1+b2) ...
Setting up pandoc (1.17.2~dfsg-3) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...

以下是有关在我的构建中使用什么操作系统的信息:

> cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

我想尝试并获得最新版本2.9.1.1

pandoc circleci
1个回答
0
投票

您可以使用此代码,我们也use with pandoc/lua-filter可以始终使用最新的pandoc版本:

RELEASES_URL='https://github.com/jgm/pandoc/releases'

# the 'latest' URL redirects to the name of the latest tag.
export PANDOCVERSION=$(curl -I "$RELEASES_URL/latest" | sed -ne 's#Location:.*tag/\(.*\)$#\1#p' | tr -d "\n\r")

# Show pandoc version in logs
echo $PANDOCVERSION

# downloads and extract
wget $RELEASES_URL/download/$PANDOCVERSION/pandoc-$PANDOCVERSION-linux-amd64.tar.gz
tar xvzf pandoc-$PANDOCVERSION-linux-amd64.tar.gz

# add executable to PATH
export PATH=$HOME/pandoc-$PANDOCVERSION/bin:$PATH
© www.soinside.com 2019 - 2024. All rights reserved.