Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sumo formula 1.21.0 #23

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/example_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
if: matrix.sumo_version == 'head'
run: brew install --with-examples --HEAD sumo

- run: python $(brew --prefix sumo)/share/sumo/docs/examples/runAll.py
- run: python "$(brew --prefix sumo)/share/sumo/docs/examples/runAll.py"
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
run: brew pr-pull --debug --tap=$GITHUB_REPOSITORY $PULL_REQUEST
run: brew pr-pull --debug --tap="$GITHUB_REPOSITORY" "$PULL_REQUEST"

- name: Push commits
uses: Homebrew/actions/git-try-push@master
Expand All @@ -30,4 +30,4 @@ jobs:
if: github.event.pull_request.head.repo.fork == false
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
run: git push --delete origin $BRANCH
run: git push --delete origin "$BRANCH"
File renamed without changes.
15 changes: 6 additions & 9 deletions Formula/sumo.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
class Sumo < Formula
desc "Simulation of Urban MObility"
homepage "https://www.eclipse.dev/sumo"
url "https://sumo.dlr.de/releases/1.20.0/sumo-src-1.20.0.tar.gz"
sha256 "34320ba1695db74c769d6b4931cb6bc6ec5b26c37e556451ab29d3963d6af8ec"
url "https://sumo.dlr.de/releases/1.21.0/sumo-src-1.21.0.tar.gz"
sha256 "1a246c30159abd4b5a878c0ce4eba3779bc6fce95f9c815c5f45567ceaa4ea53"
license "EPL-2.0"
head "https://github.com/eclipse-sumo/sumo.git", branch: "main"

bottle do
root_url "https://github.com/DLR-TS/homebrew-sumo/releases/download/sumo-1.20.0"
sha256 cellar: :any, arm64_sonoma: "de437553bbfff2c123b1e2c90f2bc0e35693cb34a1f371887891cd837577a279"
sha256 cellar: :any, arm64_ventura: "0416595756b2ce18e84c6c760257982210ffb3df07c9c43f60ade8a26d34578d"
sha256 cellar: :any, ventura: "711ff64f1d59c52b669a340cc3924097cdc1bbbc0000042b28e13156051d5f21"
sha256 cellar: :any, monterey: "dd3c1d156ed3a48fbe61227a314b213ae4c6c903cf03edb4f5e344b3689a09c3"
end
# stable do
# url "https://sumo.dlr.de/releases/1.21.0/sumo-src-1.21.0.tar.gz"
# sha256 "1a246c30159abd4b5a878c0ce4eba3779bc6fce95f9c815c5f45567ceaa4ea53"
# end

option "with-examples", "Install docs/examples and docs/tutorial folder"

Expand Down
136 changes: 136 additions & 0 deletions Formula/sumo@1.20.0.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
class SumoAT1200 < Formula
desc "Simulation of Urban MObility"
homepage "https://www.eclipse.dev/sumo"
url "https://sumo.dlr.de/releases/1.20.0/sumo-src-1.20.0.tar.gz"
sha256 "34320ba1695db74c769d6b4931cb6bc6ec5b26c37e556451ab29d3963d6af8ec"
license "EPL-2.0"
head "https://github.com/eclipse-sumo/sumo.git", branch: "main"

bottle do
root_url "https://github.com/DLR-TS/homebrew-sumo/releases/download/sumo-1.20.0"
sha256 cellar: :any, arm64_sonoma: "de437553bbfff2c123b1e2c90f2bc0e35693cb34a1f371887891cd837577a279"
sha256 cellar: :any, arm64_ventura: "0416595756b2ce18e84c6c760257982210ffb3df07c9c43f60ade8a26d34578d"
sha256 cellar: :any, ventura: "711ff64f1d59c52b669a340cc3924097cdc1bbbc0000042b28e13156051d5f21"
sha256 cellar: :any, monterey: "dd3c1d156ed3a48fbe61227a314b213ae4c6c903cf03edb4f5e344b3689a09c3"
end

option "with-examples", "Install docs/examples and docs/tutorial folder"

depends_on "cmake" => :build
depends_on "fontconfig"
depends_on "fox"
# indirect dependencies due to fox
depends_on "freetype"
depends_on "gettext"
depends_on "jpeg-turbo"
depends_on "libice"
depends_on "libpng"
depends_on "libtiff"
depends_on "libx11"
depends_on "libxcursor"
depends_on "libxext"
depends_on "libxfixes"
depends_on "libxft"
depends_on "libxi"
depends_on "libxrandr"
depends_on "libxrender"
depends_on "mesa"
depends_on "mesa-glu"

depends_on "proj"
depends_on "python" if build.head? && build.with?("examples")
depends_on "xerces-c"

depends_on "ffmpeg" => :optional
depends_on "gdal" => :optional
depends_on "gl2ps" => :optional
depends_on "open-scene-graph" => :optional
depends_on "swig" => :optional

# workaround due to dependency gdal -> numpy -> openblas -> gcc (originally gfortran)
# (use 'brew deps --tree sumo' to see dependencies of higher levels)
# also see: https://github.com/davidchall/homebrew-hep/issues/28
cxxstdlib_check :skip

def install
# cf. https://rubydoc.brew.sh/Formula.html#std_cmake_args-instance_method
cmake_args = *std_cmake_args(find_framework: "LAST")

# bottling uses default formula options and we want minimal requirement bottles,
# therefore, by default, do not check for optional libs
if build.with?("ffmpeg") ||
build.with?("gdal") ||
build.with?("gl2ps") ||
build.with?("open-scene-graph")
ohai "Enabling check for optional libraries..."
cmake_args << "-DCHECK_OPTIONAL_LIBS=ON"
else
cmake_args << "-DCHECK_OPTIONAL_LIBS=OFF"
end

# If found, SWIG is enabled by default by sumo cmake config step
# but Java/Python library paths found by cmake might still be broken,
# so we disable SWIG by default here.
cmake_args << "-DSWIG_EXECUTABLE=\"\"" if build.without?("swig")
# XXX: pointers for getting '--with-swig' to work:
# cmake_args << "-DJAVA_HOME=#{Formula["openjdk"].opt_prefix}/libexec/openjdk.jdk/Contents/Home"
# cmake_args << "-DPython_ROOT_DIR=#{Formula["python"].opt_prefix}"

mkdir "build/cmake-build" do # creates and changes to dir in block
system "cmake", "../..", *cmake_args
system "make"
system "make", "install"
system "make", "examples" if build.head? && build.with?("examples")
end

if build.with?("examples")
(pkgshare/"docs").install "docs/examples"
(pkgshare/"docs").install "docs/tutorial"
end
end

def caveats
<<~EOS
In order to let X11 start automatically whenever a GUI-based SUMO application
(e.g., "sumo-gui") is called, you need to log out and in again.
Alternatively, start X11 manually by pressing cmd-space and entering "XQuartz".

Don't forget to set your SUMO_HOME environment variable:
export SUMO_HOME="#{prefix}/share/sumo"

Please report any problems with this formula directly to the eclipse-sumo/sumo issue tracker:
https://github.com/eclipse-sumo/sumo/issues

EOS
end

test do # will create, run in and delete a temporary directory
# This small test verifies the functionality of SUMO.
# Run with 'brew test sumo'.
# Options passed to 'brew install' such as '--HEAD' also need to be provided to 'brew test'.

(testpath/"nodes.xml").write <<~EOS
<nodes>
<node id="0" x="0.0" y="0.0"/>
<node id="1" x="500.0" y="0.0"/>
</nodes>
EOS

(testpath/"edges.xml").write <<~EOS
<edges>
<edge id="0to1" from="0" to="1" numLanes="2" speed="30"/>
</edges>
EOS

system "#{bin}/netconvert", "-n", "#{testpath}/nodes.xml", "-e", "#{testpath}/edges.xml", "-o",
"#{testpath}/net.xml"

(testpath/"flows.xml").write <<~EOS
<routes>
<flow id="0to1" from="0to1" to="0to1" end="3600" vehsPerHour="1000"/>
</routes>
EOS

system "#{bin}/sumo", "-n", "#{testpath}/net.xml", "-r", "#{testpath}/flows.xml"
end
end
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ If you want to use `sumo-gui` and/or `netedit`, you need to install XQuartz as a

## Usage

By default, the above command lines install a bottled SUMO stable version (currently ```1.20.0```) with minimal requirements (```fox```, ```proj```, ```xerces-c```).
By default, the above command lines install a bottled SUMO stable version (currently ```1.21.0```) with minimal requirements (```fox```, ```proj```, ```xerces-c```).
Alternatively, ```brew``` can compile SUMO from source with the following command line options:


brew install [OPTIONS] sumo

==> Options
--with-examples
Install docs/examples and docs/tutorial folder
Expand Down
48 changes: 24 additions & 24 deletions update_formula.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ FORMULA_NAME=dlr-ts/sumo/sumo
README_FILE=README.md

# check for cmd line parameters
if [ $# -ne 2 ]; then
echo ""
echo "Usage: $0 <NEW_VERSION> <SUMO_SRC_URL>"
echo "Examples:"
echo " NEW_VERSION: 1.3.1"
echo " SUMO_SRC_URL: https://github.com/eclipse-sumo/sumo/archive/v1_3_1.tar.gz"
echo ""
exit 1
if [[ $# -ne 2 ]]
then
echo ""
echo "Usage: $0 <NEW_VERSION> <SUMO_SRC_URL>"
echo "Examples:"
echo " NEW_VERSION: 1.3.1"
echo " SUMO_SRC_URL: https://github.com/eclipse-sumo/sumo/archive/v1_3_1.tar.gz"
echo ""
exit 1
fi

NEW_VERSION=$1
SUMO_SRC_URL=$2
DATE_STRING=$(date +"%Y-%m-%d")
NEW_VERSION="$1"
SUMO_SRC_URL="$2"
NEW_MAJOR=$(echo "${NEW_VERSION}" | awk -F . '{ print $1 }')
NEW_MINOR=$(echo "${NEW_VERSION}" | awk -F . '{ print $2 }')
NEW_PATCH=$(echo "${NEW_VERSION}" | awk -F . '{ print $3 }')
Expand All @@ -31,50 +31,50 @@ brew uninstall sumo
brew install sumo

# figure out version number
OLD_VERSION_WITH_REVISION=$(brew ls sumo --versions | awk '{print $2}')
OLD_VERSION_WITH_REVISION=$(brew ls sumo --versions | awk '{print $2}' || true)
OLD_VERSION=$(echo "${OLD_VERSION_WITH_REVISION}" | awk -F _ '{print $1}')
OLD_MAJOR=$(echo "${OLD_VERSION}" | awk -F . '{ print $1 }')
OLD_MINOR=$(echo "${OLD_VERSION}" | awk -F . '{ print $2 }')
OLD_PATCH=$(echo "${OLD_VERSION}" | awk -F . '{ print $3 }')
echo "old sumo version: '$OLD_VERSION'"
echo "old sumo version: '${OLD_VERSION}'"

# generate full string (including version number) for formula class name
FORMULA_CLASS_NAME="SumoAT$(echo $OLD_VERSION | sed 's/\.//g')"
echo "formula class name: '$FORMULA_CLASS_NAME'"
FORMULA_CLASS_NAME="SumoAT${OLD_VERSION//./}"
echo "formula class name: '${FORMULA_CLASS_NAME}'"

ARCHIVED_FORMULA_FILENAME="sumo@${OLD_VERSION}.rb"

# archive old formula
echo "copying formula to Formula/${ARCHIVED_FORMULA_FILENAME} and updating class name of archived formula..."
sed "s/class Sumo/class ${FORMULA_CLASS_NAME}/" Formula/sumo.rb >> Formula/${ARCHIVED_FORMULA_FILENAME}
sed "s/class Sumo/class ${FORMULA_CLASS_NAME}/" Formula/sumo.rb >>Formula/"${ARCHIVED_FORMULA_FILENAME}"
echo "done archiving old formula!"

echo "creating git branch"
git checkout -b sumo

echo "adding archived formula to git"
git add Formula/${ARCHIVED_FORMULA_FILENAME}
git add Formula/"${ARCHIVED_FORMULA_FILENAME}"
git commit -m "sumo: archive formula for version ${OLD_VERSION}"

### BUMP formula version (https://docs.brew.sh/Manpage#bump-formula-pr-options-formula)
echo "bumping formula version..."
brew bump-formula-pr -v --write-only --no-audit --url=${SUMO_SRC_URL} ${FORMULA_NAME}
brew bump-formula-pr -v --write-only --no-audit --url="${SUMO_SRC_URL}" "${FORMULA_NAME}"
# remove bottle block
# NOTE: dirty hack assumes lines 12-17 (including extra blank line)
sed '12,17d' /usr/local/Homebrew/Library/Taps/dlr-ts/homebrew-sumo/Formula/sumo.rb > Formula/sumo.rb
sed '12,17d' /usr/local/Homebrew/Library/Taps/dlr-ts/homebrew-sumo/Formula/sumo.rb >Formula/sumo.rb
git add Formula/sumo.rb
git commit -m "sumo: update formula to v${NEW_VERSION}"

### UPDATE alias link
echo "updating Alias symlink..."
git mv Aliases/sumo\@${OLD_MAJOR}.${OLD_MINOR}.${OLD_PATCH} Aliases/sumo\@${NEW_MAJOR}.${NEW_MINOR}.${NEW_PATCH}
git mv Aliases/sumo@"${OLD_MAJOR}.${OLD_MINOR}.${OLD_PATCH}" Aliases/sumo@"${NEW_MAJOR}.${NEW_MINOR}.${NEW_PATCH}"
git commit -m "sumo: update alias"

### UPDATE version number in README.md
echo "updating version number in README.md"
sed "s/${OLD_VERSION}/${NEW_VERSION}/" ${README_FILE} >> ${README_FILE}.NEW
mv ${README_FILE}.NEW ${README_FILE}
git add ${README_FILE}
sed "s/${OLD_VERSION}/${NEW_VERSION}/" "${README_FILE}" >>"${README_FILE}.NEW"
mv "${README_FILE}.NEW" "${README_FILE}"
git add "${README_FILE}"
git commit -m "update version number in README"

echo "You now need to create a pull request from the new branch to trigger the workflows ..."
Expand Down
Loading