Skip to content

Commit

Permalink
feat(parser): replace with new srcinfo parser (#995)
Browse files Browse the repository at this point in the history
Co-authored-by: Elsie <[email protected]>
  • Loading branch information
saenai255 and Elsie19 authored Sep 21, 2024
1 parent 43713e4 commit f429b14
Show file tree
Hide file tree
Showing 42 changed files with 407 additions and 973 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ COPY --from=client /root/client/dist/ /root/client/dist/
COPY --from=server /root/server/dist/ /root/server/dist/
COPY ./Makefile ./Makefile

RUN apt update && apt install make git jo jq -y
RUN apt update && apt install make git jq -y

RUN make dist \
&& rm -rf server client
Expand Down
11 changes: 4 additions & 7 deletions client/src/components/package-details/MinimalPackageTable.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Table, Tbody, Th, Thead, Tr } from '@chakra-ui/react'
import { FC } from 'react'
import PackageInfo from '../../types/package-info'
import { ArchDistroString } from '../../types/package-info'
import MinimalPackageTableRow from './MinimalPackageTableRow'
import { useTranslation } from 'react-i18next'

const MinimalPackageTable: FC<{ packages: (PackageInfo | string)[] }> = ({
const MinimalPackageTable: FC<{ packages: (ArchDistroString | string)[] }> = ({
packages,
}) => {
const { t } = useTranslation()
Expand All @@ -22,11 +22,8 @@ const MinimalPackageTable: FC<{ packages: (PackageInfo | string)[] }> = ({
{packages.map((pkg, i) => (
<MinimalPackageTableRow
external={typeof pkg === 'string'}
key={
(typeof pkg === 'string' ? pkg : pkg.packageName) +
i
}
pkg={typeof pkg === 'string' ? pkg : pkg.packageName}
key={(typeof pkg === 'string' ? pkg : pkg.value) + i}
pkg={typeof pkg === 'string' ? pkg : pkg.value}
/>
))}
</Tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { useTranslation } from 'react-i18next'
import { Link as Rlink } from 'react-router-dom'

const getDescription = (nameWithDescription: string): string | null => {
return nameWithDescription.includes(':')
return nameWithDescription?.includes(':')
? nameWithDescription.split(':')[1].trim()
: null
}

const getName = (nameWithDescription: string): string => {
return nameWithDescription.includes(':')
return nameWithDescription?.includes(':')
? nameWithDescription.split(':')[0]
: nameWithDescription
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/package-details/PackageDetailsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Container, UseDisclosureProps } from '@chakra-ui/react'
import { FC } from 'react'
import { Helmet } from 'react-helmet'
import PackageInfo from '../../types/package-info'
import PackageInfo, { ArchDistroString } from '../../types/package-info'
import HowToInstall from './HowToInstall'
import PackageDependenciesModal from './PackageDependenciesModal'
import PackageDetailsHeader from './PackageDetailsHeader'
Expand All @@ -10,7 +10,7 @@ import PackageRequiredByModal from './PackageRequiredByModal'

type PackageDetailsPageProps = {
data: PackageInfo
allDependencies: string[]
allDependencies: ArchDistroString[]
isMobile: boolean
requiredByModal: UseDisclosureProps
dependenciesModal: UseDisclosureProps
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/packages/PackageTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const PackageTableRow: FC<{ pkg: PackageInfo; disabled?: boolean }> = ({
<Tooltip
openDelay={500}
label={
pkg.maintainers.length
pkg.maintainers?.length
? t(
'packageSearch.maintainerTooltip.maintainedBy',
{
Expand All @@ -68,7 +68,7 @@ const PackageTableRow: FC<{ pkg: PackageInfo; disabled?: boolean }> = ({
}
>
<Text fontSize='sm'>
{pkg.maintainers
{(pkg.maintainers ?? [])
.map(maintainer => maintainer.split('<')[0].trim())
.join(', ') || t('packageDetails.orphaned')}
</Text>
Expand All @@ -81,7 +81,7 @@ const PackageTableRow: FC<{ pkg: PackageInfo; disabled?: boolean }> = ({
<SemanticVersionColor
git={pkg.packageName.endsWith('-git')}
fill
version={pkg.version.substring(0, 14)}
version={pkg.version.substring(0, 18)}
status={pkg.updateStatus}
/>
</Text>
Expand Down
10 changes: 5 additions & 5 deletions client/src/types/package-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PackageInfo from './package-info'
import PackageInfo, { ArchDistroString } from './package-info'

export default interface PackageDependencies {
runtimeDependencies: (PackageInfo | string)[]
buildDependencies: (PackageInfo | string)[]
optionalDependencies: (PackageInfo | string)[]
pacstallDependencies: (PackageInfo | string)[]
runtimeDependencies: (ArchDistroString | string)[]
buildDependencies: (ArchDistroString | string)[]
optionalDependencies: (ArchDistroString | string)[]
pacstallDependencies: (ArchDistroString | string)[]
}
48 changes: 37 additions & 11 deletions client/src/types/package-info.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,50 @@
export default interface PackageInfo {
architectures: string[]
version: string
packageName: string
maintainers: string[]
description: string
source: string[]
runtimeDependencies: string[]
buildDependencies: string[]
optionalDependencies: string[]
conflicts: string[]
gives: string
replaces: string[]
hash?: string
ppa: string[]
pacstallDependencies: string[]
patch: string[]
source: ArchDistroString[]
runtimeDependencies: ArchDistroString[]
buildDependencies: ArchDistroString[]
optionalDependencies: ArchDistroString[]
checkDependencies: ArchDistroString[]
pacstallDependencies: ArchDistroString[]
conflicts: ArchDistroString[]
gives: ArchDistroString
replaces: ArchDistroString[]
sha1sums: ArchDistroString[]
sha224sums: ArchDistroString[]
sha256sums: ArchDistroString[]
sha384sums: ArchDistroString[]
sha512sums: ArchDistroString[]
md5sums: ArchDistroString[]
priority: ArchDistroString[]
requiredBy: string[]
suggests: ArchDistroString[]
recommends: ArchDistroString[]
latestVersion?: string
prettyName: string
updateStatus: UpdateStatus
lastUpdatedAt: string
enhances: ArchDistroString[]
changelog: string
backup: string[]
compatible: string[]
incompatible: string[]
epoch: string
install: string
license: string[]
mask: string[]
noExtract: string[]
validPgpKeys: string[]
groups: string[]
}

export interface ArchDistroString {
arch?: string
distro?: string
value: string
}

export enum UpdateStatus {
Expand Down
2 changes: 1 addition & 1 deletion server/consts/consts.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package consts

const PACSCRIPT_FILE_EXTENSION = "pacscript"
const SRCINFO_FILE_EXTENSION = ".SRCINFO"

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit f429b14

Please sign in to comment.