Compare commits

..

No commits in common. "bdc7b77eaecbd64bf78cd805af999e16a862a8ff" and "33713184b4a809481ce9a21b95d218663af2b746" have entirely different histories.

9 changed files with 7 additions and 185 deletions

View file

@ -1,3 +0,0 @@
vendor
target
rpmbuild

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
/target /target
vendor vendor
rpmbuild
*.tar.* *.tar.*

View file

@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021" edition = "2021"
description = "A simple demonstration of the Iced GUI library." description = "A simple demonstration of the Iced GUI library."
license = "MIT" license = "MIT"
#license-file = "LICENSE.txt"
repository = "no" repository = "no"
# This application was created and tested with Rust version 1.81.0-nightly # This application was created and tested with Rust version 1.81.0-nightly

View file

@ -1,15 +0,0 @@
# This image is used for building the RPMs for SolutionTM
FROM fedora:40 as build
# Some general tools used for RPM building
RUN dnf install rpm-build rpmdevtools dnf-plugins-core git -y
RUN rpmdev-setuptree
# Get the build deps
ADD ./SolutionTM.spec ./
RUN dnf builddep ./SolutionTM.spec -y
# Where the source will be mounted
RUN mkdir /source
WORKDIR /source

View file

@ -1,56 +0,0 @@
# Generated by rust2rpm 26
%bcond_without check
# prevent library files from being installed
%global cargo_install_lib 0
%global crate SolutionTM
Name: SolutionTM
Version: 0.1.0
Release: %autorelease
Summary: Simple demonstration of the Iced GUI library
SourceLicense: MIT
# FIXME: paste output of %%cargo_license_summary here
License: MIT
# LICENSE.dependencies contains a full license breakdown
URL: no
Source: %{crate}-%{version}.tar.gz
Source: %{crate}-%{version}-vendor.tar.gz
BuildRequires: cargo-rpm-macros >= 26
BuildRequires: cargo >= 1.78
%global _description %{expand:
A simple demonstration of the Iced GUI library.}
%description %{_description}
%prep
%autosetup -n %{crate}-%{version} -p1 -a1
%cargo_prep -v vendor
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%{cargo_vendor_manifest}
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%files
%license LICENCE.txt
%license LICENSE.dependencies
%license cargo-vendor.txt
%{_bindir}/SolutionTM
%changelog
%autochangelog

View file

@ -1,8 +0,0 @@
#!/bin/bash
# First we build the 'Containerfile' for podman
podman build -t solutiontm:latest -f Containerfile || exit 1
# Run it, mount repo as /source and execute "bash build_rpm.sh"
podman run -d -v $(pwd):/source:Z -n rpmbuild solutiontm:latest bash build_rpm.sh || exit 1
echo "Continuing build in background..."

View file

@ -1,61 +0,0 @@
#!/bin/bash
# This is a simple script to build an RPM package from a spec file.
# We need to install the required dependencies to build RPM packages.
# We also need to set up the RPM build tree:
#
# $ sudo dnf install rpm-build rpmdevtools dnf-plugins-core
# $ rpmdev-setuptree
#
# To install the builddeps:
#
# $ sudo dnf builddep SolutionTM.spec
version=0.1.0
name=SolutionTM
rpmbuild=$PWD/rpmbuild
mkdir -p $rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo "Building RPM package for $name version $version."
# Check so that all versions are coherent
grep -q "Version:.*$version" $name.spec
if [ $? -eq 0 ]; then
echo "Version number in spec file is $version."
else
echo "Version number in spec file is not $version. Exiting."
exit 1
fi
grep -q "version = \"$version\"" Cargo.toml
if [ $? -eq 0 ]; then
echo "Version number in Cargo.toml is $version."
else
echo "Version number in Cargo.toml is not $version. Exiting."
exit 1
fi
source_tar=$name-$version.tar.gz
vendor_tar=$name-$version-vendor.tar.gz
echo "Building source tarball $source_tar."
echo "Building vendor tarball $vendor_tar."
# First, we need a tarball of the source code in this very repo.
git archive --format=tar.gz --prefix=$name-$version/ -o $source_tar HEAD
# If we want an unclean build, comment out the above line and use the following instead.
# git ls-files | tar --transform="s,^,$name-$version/," -T - -czf $source_tar
# Then we need a vendor tarball of the dependencies.
cargo vendor --versioned-dirs vendor
tar -cvzf $vendor_tar vendor
# Then we move the tarball to the SOURCES directory.
mv $source_tar $rpmbuild/SOURCES/
mv $vendor_tar $rpmbuild/SOURCES/
rpmbuild --define "_topdir $rpmbuild" -ba $name.spec

View file

@ -1,26 +0,0 @@
#!/bin/bash
# Currently not used
$name=SolutionTM
$version=0.1.0
# If git is unclean, exit
if ! git diff-index --quiet HEAD --; then
echo "Git is unclean. Please commit your changes before building the RPM package."
exit 1
fi
# These should all set the first occurrence of the
# version number in the respective files.
# Set the version number in the spec file.
sed -i "0,/Version: .*/s/Version: .*/Version: $version/" $name.spec
# Set the version number in the Cargo.toml file.
sed -i "0,/version = \".*\"/s/version = \".*\"/version = \"$version\"/" Cargo.toml
# Set the version number in the Cargo.lock file.
sed -i "0,/version = \".*\"/s/version = \".*\"/version = \"$version\"/" Cargo.lock
git diff

View file

@ -3,7 +3,6 @@ use race::Race;
use iced::widget::{button, column, combo_box, row, text, Column, ComboBox, Text}; use iced::widget::{button, column, combo_box, row, text, Column, ComboBox, Text};
use iced::{Alignment, Padding}; use iced::{Alignment, Padding};
use iced::{Element, Sandbox};
/// Represents the state of our application and handles /// Represents the state of our application and handles
/// message matching and updating the state accordingly. /// message matching and updating the state accordingly.
@ -37,9 +36,7 @@ enum Command {
Closed, Closed,
} }
impl Sandbox for State { impl State {
type Message = Command;
// Constructor for the state, nothing special here. // Constructor for the state, nothing special here.
fn new() -> Self { fn new() -> Self {
Self { Self {
@ -50,10 +47,6 @@ impl Sandbox for State {
} }
} }
fn title(&self) -> String {
String::from("Test Example")
}
// On each update, we recieve a command and update the state accordingly. // On each update, we recieve a command and update the state accordingly.
fn update(&mut self, command: Command) { fn update(&mut self, command: Command) {
match command { match command {
@ -67,7 +60,7 @@ impl Sandbox for State {
// Called every frame to render the user interface. // Called every frame to render the user interface.
// Changes to the state are reflected here. // Changes to the state are reflected here.
fn view(&self) -> Element<Command> { fn view(&self) -> Column<Command> {
// Our combo box // Our combo box
let combo_box: ComboBox<Race, Command> = combo_box::ComboBox::new( let combo_box: ComboBox<Race, Command> = combo_box::ComboBox::new(
&self.races, &self.races,
@ -100,16 +93,14 @@ impl Sandbox for State {
.align_items(Alignment::Start) .align_items(Alignment::Start)
.spacing(10) .spacing(10)
.width(iced::Length::Fill) .width(iced::Length::Fill)
.into()
} }
} }
fn main() { fn main() {
// Iced::run is an entry point for the application. // Iced::run is an entry point for the application.
// It may fail so we match on the result. // It may fail so we match on the result.
// match iced::run("Test Example", State::update, State::view) { match iced::run("Test Example", State::update, State::view) {
// Ok(_) => {} Ok(_) => {}
// Err(error) => eprintln!("Error: {}", error), Err(error) => eprintln!("Error: {}", error),
// } }
State::run(iced::Settings::default());
} }