Skip to content
Draft
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
29 changes: 26 additions & 3 deletions open-build-service-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,21 +424,21 @@
}
}

#[derive(Deserialize, Debug)]
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct PackageBuildMetaDisable {
#[serde(default, rename = "@repository")]
pub repository: Option<String>,
#[serde(default, rename = "@arch")]
pub arch: Option<String>,
}

#[derive(Deserialize, Debug, Default)]
#[derive(Deserialize, Serialize, Debug, Default, Clone)]
pub struct PackageBuildMeta {
#[serde(rename = "disable")]
pub disabled: Vec<PackageBuildMetaDisable>,
}

#[derive(Deserialize, Debug)]
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct PackageMeta {
#[serde(rename = "@name")]
pub name: String,
Expand Down Expand Up @@ -972,6 +972,29 @@
self.client.request(u).await
}

pub async fn set_meta(&self, meta: &PackageMeta) -> Result<()> {
let mut u = self.client.base.clone();
u.path_segments_mut()
.map_err(|_| Error::InvalidUrl)?
.push("source")
.push(&self.project)
.push(&self.package)
.push("_meta");

let mut body = Vec::new();
quick_xml::se::to_writer(&mut body, meta)?;

Check failure on line 985 in open-build-service-api/src/lib.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied

error[E0277]: the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied --> open-build-service-api/src/lib.rs:985:39 | 985 | quick_xml::se::to_writer(&mut body, meta)?; | ------------------------ ^^^^ the trait `std::fmt::Write` is not implemented for `std::vec::Vec<_>` | | | required by a bound introduced by this call | = help: the following other types implement trait `std::fmt::Write`: &mut W bytes::BytesMut std::ffi::OsString std::fmt::Formatter<'_> std::string::String writeable::parts_write_adapter::CoreWriteAsPartsWrite<W> zerotrie::cursor::ZeroAsciiIgnoreCaseTrieCursor<'_> zerotrie::cursor::ZeroTrieSimpleAsciiCursor<'_> = note: required for `&mut std::vec::Vec<_>` to implement `std::fmt::Write` note: required by a bound in `quick_xml::se::to_writer` --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/quick-xml-0.38.1/src/se/mod.rs:133:8 | 131 | pub fn to_writer<W, T>(mut writer: W, value: &T) -> Result<WriteResult, SeError> | --------- required by a bound in this function 132 | where 133 | W: Write, | ^^^^^ required by this bound in `to_writer`

Check failure on line 985 in open-build-service-api/src/lib.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied

error[E0277]: the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied --> open-build-service-api/src/lib.rs:985:39 | 985 | quick_xml::se::to_writer(&mut body, meta)?; | ------------------------ ^^^^ the trait `std::fmt::Write` is not implemented for `std::vec::Vec<_>` | | | required by a bound introduced by this call | = help: the following other types implement trait `std::fmt::Write`: &mut W bytes::BytesMut std::ffi::OsString std::fmt::Formatter<'_> std::string::String writeable::parts_write_adapter::CoreWriteAsPartsWrite<W> zerotrie::cursor::ZeroAsciiIgnoreCaseTrieCursor<'_> zerotrie::cursor::ZeroTrieSimpleAsciiCursor<'_> = note: required for `&mut std::vec::Vec<_>` to implement `std::fmt::Write` note: required by a bound in `quick_xml::se::to_writer` --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/quick-xml-0.38.1/src/se/mod.rs:133:8 | 131 | pub fn to_writer<W, T>(mut writer: W, value: &T) -> Result<WriteResult, SeError> | --------- required by a bound in this function 132 | where 133 | W: Write, | ^^^^^ required by this bound in `to_writer`

Check failure on line 985 in open-build-service-api/src/lib.rs

View workflow job for this annotation

GitHub Actions / cargo clippy

the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied

error[E0277]: the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied --> open-build-service-api/src/lib.rs:985:39 | 985 | quick_xml::se::to_writer(&mut body, meta)?; | ------------------------ ^^^^ the trait `std::fmt::Write` is not implemented for `std::vec::Vec<_>` | | | required by a bound introduced by this call | = help: the following other types implement trait `std::fmt::Write`: &mut W bytes::BytesMut std::ffi::OsString std::fmt::Formatter<'_> std::string::String writeable::parts_write_adapter::CoreWriteAsPartsWrite<W> zerotrie::cursor::ZeroAsciiIgnoreCaseTrieCursor<'_> zerotrie::cursor::ZeroTrieSimpleAsciiCursor<'_> = note: required for `&mut std::vec::Vec<_>` to implement `std::fmt::Write` note: required by a bound in `quick_xml::se::to_writer` --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/quick-xml-0.38.1/src/se/mod.rs:133:8 | 131 | pub fn to_writer<W, T>(mut writer: W, value: &T) -> Result<WriteResult, SeError> | --------- required by a bound in this function 132 | where 133 | W: Write, | ^^^^^ required by this bound in `to_writer`

Check failure on line 985 in open-build-service-api/src/lib.rs

View workflow job for this annotation

GitHub Actions / cargo clippy

the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied

error[E0277]: the trait bound `std::vec::Vec<_>: std::fmt::Write` is not satisfied --> open-build-service-api/src/lib.rs:985:39 | 985 | quick_xml::se::to_writer(&mut body, meta)?; | ------------------------ ^^^^ the trait `std::fmt::Write` is not implemented for `std::vec::Vec<_>` | | | required by a bound introduced by this call | = help: the following other types implement trait `std::fmt::Write`: &mut W bytes::BytesMut std::ffi::OsString std::fmt::Formatter<'_> std::string::String writeable::parts_write_adapter::CoreWriteAsPartsWrite<W> zerotrie::cursor::ZeroAsciiIgnoreCaseTrieCursor<'_> zerotrie::cursor::ZeroTrieSimpleAsciiCursor<'_> = note: required for `&mut std::vec::Vec<_>` to implement `std::fmt::Write` note: required by a bound in `quick_xml::se::to_writer` --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/quick-xml-0.38.1/src/se/mod.rs:133:8 | 131 | pub fn to_writer<W, T>(mut writer: W, value: &T) -> Result<WriteResult, SeError> | --------- required by a bound in this function 132 | where 133 | W: Write, | ^^^^^ required by this bound in `to_writer`

Client::send_with_error(
self.client
.authenticated_request(Method::PUT, u)
.header(CONTENT_TYPE, "application/xml")
.body(body),
)
.await?;

Ok(())
}

pub async fn source_file(&self, file: &str) -> Result<impl Stream<Item = Result<Bytes>>> {
let mut u = self.client.base.clone();
u.path_segments_mut()
Expand Down
Loading