Skip to content

Commit 730370b

Browse files
committed
Fix RPM packaging review feedback
Signed-off-by: Xingqiu Xu <hilbertanjou83@gmail.com>
1 parent 2236efc commit 730370b

3 files changed

Lines changed: 51 additions & 3 deletions

File tree

HMCL/src/main/java/org/jackhuang/hmcl/upgrade/PackageManagerIntegration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ public static boolean isPackageManaged() {
4545
}
4646

4747
/// Parses a package-managed marker value.
48-
private static boolean isEnabled(@Nullable String value) {
48+
static boolean isEnabled(@Nullable String value) {
4949
return value != null
5050
&& !value.isBlank()
5151
&& !"0".equals(value)
52-
&& !"false".equalsIgnoreCase(value);
52+
&& !"false".equalsIgnoreCase(value)
53+
&& !"no".equalsIgnoreCase(value)
54+
&& !"off".equalsIgnoreCase(value);
5355
}
5456
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Hello Minecraft! Launcher
3+
* Copyright (C) 2026 huangyuhui <huanghongxun2008@126.com> and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
package org.jackhuang.hmcl.upgrade;
19+
20+
import org.jetbrains.annotations.NotNullByDefault;
21+
import org.jetbrains.annotations.Nullable;
22+
import org.junit.jupiter.params.ParameterizedTest;
23+
import org.junit.jupiter.params.provider.NullSource;
24+
import org.junit.jupiter.params.provider.ValueSource;
25+
26+
import static org.junit.jupiter.api.Assertions.assertFalse;
27+
import static org.junit.jupiter.api.Assertions.assertTrue;
28+
29+
/// Tests parsing of package-manager marker values.
30+
@NotNullByDefault
31+
public final class PackageManagerIntegrationTest {
32+
/// Verifies that conventional disabled marker values are not enabled.
33+
@ParameterizedTest
34+
@NullSource
35+
@ValueSource(strings = {"", " ", "0", "false", "FALSE", "no", "NO", "off", "OFF"})
36+
public void shouldRejectDisabledMarkers(@Nullable String value) {
37+
assertFalse(PackageManagerIntegration.isEnabled(value));
38+
}
39+
40+
/// Verifies that package type markers and conventional enabled values remain enabled.
41+
@ParameterizedTest
42+
@ValueSource(strings = {"1", "true", "deb", "rpm"})
43+
public void shouldAcceptEnabledMarkers(String value) {
44+
assertTrue(PackageManagerIntegration.isEnabled(value));
45+
}
46+
}

buildSrc/src/main/java/org/jackhuang/hmcl/gradle/pack/CreateRpm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private String getSpec(ReleaseType releaseType, String rpmVersion) {
177177
fi
178178
179179
%%files
180-
%%dir /usr/share/java/hmcl
180+
%%attr(0755,root,root) %%dir /usr/share/java/hmcl
181181
%%attr(0755,root,root) %s
182182
%%attr(0755,root,root) %s
183183
%%attr(0644,root,root) %s

0 commit comments

Comments
 (0)